MACROMEDIA FLASH COMMUNICATION SERVER MX-SERVER-SIDE COMMUNICATION ACTIONSCRIPT DICTIONARY Spezifikationen Seite 145

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 369
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 144
Application Development Tips and Tricks 67
The following example demonstrates a correct technique for creating an object, but should be
used only when you want properties of the object to be instance-based rather than prototype-
based:
// Less desirable practice for creating an object
MyObject = function()
{
this.name = "";
this.setName = function(name)
{
this.name = name;
}
this.getName = function()
{
return this.name;
}
}
In the first example, each instance of MyObject points to the same functions and properties
defined in the object’s prototype. Note, for instance, that only one copy of
getName exists in
memory, regardless of the number of
MyObject objects created.
In the second example, each instance of
MyObject created makes a copy of each property and
function. These extra property and function copies use additional memory, and in most cases, do
not provide any advantages.
Naming variables to support code hinting
The Macromedia Flash MX ActionScript editor has built-in code hinting support. To take
advantage of this, variables must be named in a specific format. The default format is to add a
suffix to the variable name that indicates the variable type. Below is a table of supported suffix
strings.
File types and paths
Flash Communication Server creates files when certain features are used. This section discusses
where Flash Communication Server stores files that it creates.
Note: This section assumes that you are passing an instance name along with your application name (see
“Applications and application instances” on page 14), If you don’t pass an instance name, Flash Communication
Server stores files in a subdirectory named \_definst_ (for “default instance”) in your application directory.
Object type Suffix string Example
Camera _cam my_cam
Video _video small_video
Microphone _mic the_mic
NetConnection _nc my_nc
NetStream _ns a_ns
SharedObject _so myRemote_so
Seitenansicht 144
1 2 ... 140 141 142 143 144 145 146 147 148 149 150 ... 368 369

Kommentare zu diesen Handbüchern

Keine Kommentare