Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd say you have two possible routes here.</p> <ol> <li><p>Create a script on your server to initiate a connection to your air app. For example using php and a <a href="http://php.net/manual/en/sockets.examples.php" rel="nofollow">socket</a>, the link would be something like <code>http://myserver/nextslide.php</code> which could then connect to your air app on a TCP port of your choice. There are loads of options here depending on your server and what scripting languages you have available. </p></li> <li><p>Setup your air app as a web server to allow your browser to send an HTTP request directly. For example there is a very simple air HTTP server <a href="http://coenraets.org/blog/2009/12/air-2-0-web-server-using-the-new-server-socket-api/" rel="nofollow">here</a> (which is not much more than a socket server which closes the connection at the end of each request). You could still serve your html from the main web server as you currently do, but from the HTTP server in the air app you just need to move onto the next slide when the relevant URI is found in the HTTP header. If you only need it to work within your local network this is what I would go for.</p></li> </ol> <hr> <p>Example as3 code for option 2 above, tested using an air projector with FlashDevelop:</p> <pre><code>package { import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flash.events.ProgressEvent; import flash.events.ServerSocketConnectEvent; import flash.net.ServerSocket; import flash.net.Socket; import flash.utils.ByteArray; public class Main extends Sprite { private var serverSocket:ServerSocket; private var port:int = 8080; public function Main():void { listen(); } private function listen():void { try { serverSocket = new ServerSocket(); serverSocket.addEventListener(Event.CONNECT, socketConnectHandler); serverSocket.bind(port); serverSocket.listen(); trace("Listening on port " + port + "...\n"); } catch (error:Error) { trace("Failed to open server socket"); } } private function socketConnectHandler(event:ServerSocketConnectEvent):void { var socket:Socket = event.socket; socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler); } private function socketDataHandler(event:ProgressEvent):void { try { var socket:Socket = event.target as Socket; var bytes:ByteArray = new ByteArray(); socket.readBytes(bytes); var request:String = "" + bytes; trace(request); var url:String = request.substring(4, request.indexOf("HTTP/") - 1); socket.writeUTFBytes("HTTP/1.1 200 OK\n"); socket.writeUTFBytes("Content-Type: text/plain\n\n"); if (url == "/next") { socket.writeUTFBytes("next frame triggered"); var someMovie:MovieClip = new MovieClip(); //define this as a reference to the movie clip you want to control someMovie.nextFrame(); } else { socket.writeUTFBytes("The url is " + url); } socket.flush(); socket.close(); } catch (error:Error) { trace(error); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload