An embedded Flash movie always presents a certain time delay before being available for use. You can
circumvent the problem by delaying the execution 500 milliseconds or so or by using the JavaScript
DOM functionalities to monitor the presence and availability of the Flash movie. The server script is the
same as the previous code and the client can be as follows.
// content of the file Client.hx
class Client
{
public static function main()
{
haxe.Timer.delayed(function()
{
var cnx = haxe.remoting.Connection.flashConnect(???flashmovie8???);
trace(cnx.Calc.sum.call([5,4]));
}, 500)();
}
}
The method flashConnect() looks for an HTML element with id equal to flashmovie8 that embeds
the Flash server movie.
AsyncConnection
The haxe.remoting.AsyncConnection class works almost the same as Connection . The biggest
difference is in the use of the call() method. The method accepts an extra optional argument that is the
function invoked when the client receives a response from the server. If omitted the client sends a
request to the server but it is not possible to intercept the answer.
Pages:
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812