MACROMEDIA FLASH MEDIA SERVER 2-CLIENT-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR FLASH MEDIA SERVER 2 Instrukcja Użytkownika Strona 32

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 172
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 31
29
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
theConnection.client = client;
theConnection.connect(uri);
}
function makeConnection2(uri:String){
if (theConnection2){
theConnection2.close();
}
theConnection2 = new NetConnection();
theConnection2.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
theConnection2.client = client;
theConnection2.connect(uri);
}
function netStatusHandler(event:NetStatusEvent):void{
//Check the Redirect code and make connection to redirect URI if appropriate.
try{
if (event.info.ex.code == 302){
var redirectURI:String;
redirectURI = event.info.ex.redirect;
if (redirectURI.charCodeAt(redirectURI.length-1) == 13){
redirectURI = redirectURI.slice(0,(redirectURI.length-1));
}
makeConnection2(redirectURI);
}
}
}
init();
application.registerClass()
application.registerClass(className, constructor)
Registers a constructor function that is used when deserializing an object of a certain class type. If the constructor for
a class is not registered, you cannot call the deserialized object’s methods. This method is also used to unregister the
constructor for a class. This is an advanced use of the server and is necessary only when sending ActionScript objects
between a client and a server.
The client and the server communicate over a network connection. Therefore, if you use typed objects, each side must
have the prototype of the same objects they both use. In other words, both the client-side and Server-Side ActionScript
must define and declare the types of data they share so that there is a clear, reciprocal relationship between an object,
method, or property on the client and the corresponding element on the server. You can call
application.registerClass() to register the object’s class type on the server side so that you can use the methods
defined in the class.
Constructor functions should be used to initialize properties and methods; they should not be used for executing
server code. Constructor functions are called automatically when messages are received from the client and need to be
“safe” in case they are executed by a malicious client. You shouldn’t define procedures that could result in negative
situations, such as filling up the hard disk or consuming the processor.
The constructor function is called before the object’s properties are set. A class can define an onInitialize()
method, which is called after the object has been initialized with all its properties. You can use this method to process
data after an object is deserialized.
Przeglądanie stron 31
1 2 ... 27 28 29 30 31 32 33 34 35 36 37 ... 171 172

Komentarze do niniejszej Instrukcji

Brak uwag