MACROMEDIA FLASH MEDIA SERVER 2-CLIENT-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR FLASH MEDIA SERVER 2 Manuel d'utilisateur Page 33

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 172
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 32
30
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
If you register a class that has its prototype set to another class, you must set the prototype constructor back to the
original class after setting the prototype. The second example below illustrates this point.
Note: Client-side classes must be defined as function function_name(){}, as shown in the following examples. If not
defined in the correct way,
application.registerClass() does not identify the class when its instance passes from
the client to the server, and an error is returned.
Availability
Flash Communication Server 1
Parameters
className A string indicating the name of an ActionScript class.
constructor A constructor function used to create an object of a specific class type during object deserialization. The
name of the constructor function must be the same as
className. During object serialization, the name of the
constructor function is serialized as the object’s type. To unregister the class, pass the value
null as the constructor
parameter. Serialization is the process of turning an object into something that you can send to another computer over
the network.
Example
The following example defines a Color constructor function with properties and methods. After the application
connects, the
registerClass() method is called to register a class for the objects of type Color. When a typed object
is sent from the client to the server, this class is called to create the server-side object. After the application stops, the
registerClass() method is called again and passes the value null to unregister the class.
function Color(){
this.red = 255;
this.green = 0;
this.blue = 0;
}
Color.prototype.getRed = function(){
return this.red;
}
Color.prototype.getGreen = function(){
return this.green;
}
Color.prototype.getBlue = function(){
return this.blue;
}
Color.prototype.setRed = function(value){
this.red = value;
}
Color.prototype.setGreen = function(value){
this.green = value;
}
Color.prototype.setBlue = function(value){
this.blue = value;
}
application.onAppStart = function(){
application.registerClass("Color", Color);
};
application.onAppStop = function(){
application.registerClass("Color", null);
};
Vue de la page 32
1 2 ... 28 29 30 31 32 33 34 35 36 37 38 ... 171 172

Commentaires sur ces manuels

Pas de commentaire