Server-Side CommunicationActionScript DictionaryMacromedia Flash™ Communication Server MX 1.5
10Method summary for the Application objectProperty summary for the Application object Event handler summary for the Application objectApplication.acc
Server-Side Communication ActionScript 11ParametersclientObj A client to accept. ReturnsNothing.DescriptionMethod; accepts the connection call from a
12DescriptionMethod; removes persistent shared objects (FSO files) specified by the soPath parameter and clears all properties from active shared obje
Server-Side Communication ActionScript 13DescriptionMethod; clears recorded streams (FLV) files and MP3 files associated with the application instance
14The following example clears all MP3 files from the application instance’s /disco subdirectory:function onApplicationStop(){application.clearStreams
Server-Side Communication ActionScript 15DescriptionMethod; causes the server to terminate a client connection to the application. When this method is
16DescriptionProperty (read-only); contains the hostname of the server for default virtual hosts and the virtual hostname for non-default virtual host
Server-Side Communication ActionScript 17ExampleThe following example defines an anonymous function for the application.onAppStart event handler that
18Application.onConnectAvailabilityFlash Communication Server MX.Usageapplication.onConnect = function (clientObj [, p1, ..., pN]){// insert code here
Server-Side Communication ActionScript 19Note: Returning 1 or 0 is not the same as returning true or false. The values 1 and 0 are treated the same as
TrademarksAfterburner, AppletAce, Attain, Attain Enterprise Learning System, Attain Essentials, Attain Objects for Dreamweaver, Authorware, Authorware
20ExampleThis example verifies that the user has sent the password “XXXX”. If the password is sent, the user’s access rights are modified and the user
Server-Side Communication ActionScript 21Application.onConnectAcceptAvailabilityFlash Communication Server MX (with communication components only)Usag
22The second example is server-side code you would include in your application’s main.asc file://When using components, always load components.ascload
Server-Side Communication ActionScript 23When you use components, the last line (in order of execution) of the onConnect method should be either appli
24ParametersclientObj A client disconnecting from the application.ReturnsThe server ignores any return value.DescriptionEvent handler; invoked when a
Server-Side Communication ActionScript 25Application.registerClassAvailabilityFlash Communication Server MX.Usageapplication.registerClass(className,
26ExampleThis example defines a Color constructor function with properties and methods. After the application connects, the registerClass method is ca
Server-Side Communication ActionScript 27proxyConnection A Client or NetConnection object. All requests to execute the remote method specified by meth
28DescriptionMethod; rejects the connection call from a client to the server. The application.onConnect event handler notifies a script when a new cli
Server-Side Communication ActionScript 29ExampleThe following example checks the server property against a string before executing the code inside the
3CONTENTSServer-Side Communication ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Using server-side ActionScript. . . . . . .
30When you call NetConnection.call from a client-side ActionScript script, the method that executes in the server-side script must be a method of the
Server-Side Communication ActionScript 31The above example works, but must be executed every time a client connects. If you want the same methods and
32Method summary for the Client object Property summary for the Client object Event handler summary for the Client object Client.agentAvailabilityFlas
Server-Side Communication ActionScript 33ExampleThe following example checks the agent property against the string "WIN" and executes differ
34The following server-side script uses the Client.call method inside the application.onConnect handler to call the random method that was defined on
Server-Side Communication ActionScript 35The sum method can then be called from NetConnection.call on the Flash client side, as shown in the following
36ReturnsAn integer indicating bytes per second.DescriptionMethod; returns the maximum bandwidth that the client or the server can use for this connec
Server-Side Communication ActionScript 37Client.ipAvailabilityFlash Communication Server MX.UsageClient.ipDescriptionProperty (read-only); contains th
38Client.pingAvailabilityFlash Communication Server MX.UsageClient.pingDescriptionMethod; sends a "ping" message to the client and waits for
Server-Side Communication ActionScript 39Clients with read access to a directory that contains streams can play streams in the specified access levels
Contents4Client.writeAccess . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41load. . . . .
40ReturnsThe value of the undefined property, which is specified by the propName parameter.DescriptionMethod; provides values for undefined properties
Server-Side Communication ActionScript 41Client.writeAccessAvailabilityFlash Communication Server MX.UsageClient.writeAccessDescriptionProperty; provi
42DescriptionMethod (global); loads an ActionScript file inside the main.asc file. This method executes only when the ActionScript file is first loade
Server-Side Communication ActionScript 43Method summary for the NetConnection object Property summary for the NetConnection object Event handler summa
44Parameters name A string that identifies the header and the ActionScript object data associated with it.mustUnderstand A Boolean value; true indicat
Server-Side Communication ActionScript 45DescriptionMethod; invokes a command or method on a Flash Communication Server or an application server to wh
46ExampleThe following code closes the NetConnection instance myNetConn:myNetConn.close();NetConnection.connectAvailabilityFlash Communication Server
Server-Side Communication ActionScript 47NetConnection.isConnectedAvailabilityFlash Communication Server MX.UsagemyNetConnection.isConnectedDescriptio
48ExampleThis example defines a function for the onStatus handler that outputs messages to indicate whether the NetConnection was successful:nc = new
Server-Side Communication ActionScript 49DescriptionMethod (global); continually calls a function or method at a specified time interval until the cle
Server-Side Communication ActionScript 5Server-Side Communication ActionScriptServer-Side Communication ActionScript is a scripting language on the se
50Every shared object is identified by a unique name and contains a list of name-value pairs, called properties, just like any other ActionScript obje
Server-Side Communication ActionScript 51Method summary for the SharedObject object Property summary for the SharedObject object Event summary for the
52ParametersNone.ReturnsReturns true if successful; false otherwise. DescriptionMethod; deletes all properties and sends a “clear” event to all client
Server-Side Communication ActionScript 53SharedObject.flushAvailabilityFlash Communication Server MX.UsageSharedObject.flush()ParametersNone.ReturnsA
54DescriptionStatic method; returns a reference to a shared object instance. To perform any operation on a shared object, the server-side script must
Server-Side Communication ActionScript 55ExampleThis example creates a shared object named foo inside the function onProcessCmd. The function is passe
56SharedObject.getPropertyNamesAvailabilityFlash Communication Server MX.UsagemySharedObject.getPropertyNames()Parameters None.ReturnsAn array contain
Server-Side Communication ActionScript 57The this keyword used in the body of the function is set to the shared object instance returned by SharedObje
58ExampleThis example outputs foo to the NetConnection Debugger:mySO = SharedObject.get("foo");trace(mySO.name);SharedObject.onStatusAvailab
Server-Side Communication ActionScript 59Local shared objectsNote: Changing or deleting a property on the server side using the SharedObject.setProper
6To install and test the server-side ActionScript file, do the following: 1 Locate the Macromedia Flash Communication Server /applications directory.T
60ExampleThe following example creates a function that is invoked whenever a property of the shared object so changes:// create a new NetConnection ob
Server-Side Communication ActionScript 61ExampleThis example deletes all properties of the myShared shared object that are older than the value of Sha
62ParametersmethodName The name of a method on a client shared object instance. For example, if you specify doSomething, the client must invoke the Sh
Server-Side Communication ActionScript 63DescriptionMethod; updates the value of a property in a shared object. A shared object property can be modifi
64ExampleThis example gets the number of properties of a shared object and assigns that number to the variable len: var myShared = SharedObjecd.get(ap
Server-Side Communication ActionScript 65Stream (object)The Stream object lets you handle each stream in a Flash Communication Server application. A s
66Stream.bufferTimeAvailabilityFlash Communication Server MX.UsageStream.bufferTimeDescriptionProperty (read-only); indicates how long to buffer messa
Server-Side Communication ActionScript 67Note: The Stream information object is nearly identical to the client-side ActionScript NetStream information
68ExampleThis example gets the length of the recorded stream file myVideo and assigns it to the variable streamLen:function onProcessCmd(cmd){var stre
Server-Side Communication ActionScript 69DescriptionEvent handler; invoked every time the status of a Stream object changes. For example, if you play
Server-Side Communication ActionScript 7Using JavaScript syntaxYou must follow all syntax rules of JavaScript. For example, JavaScript is case-sensiti
70You can also specify a number value of 2 or 3 for the reset parameter, which is useful when playing recorded stream files that contain message data.
Server-Side Communication ActionScript 71If the flag is set to true, some compression is invoked on the server. Using the previous example, if the fla
72The following example creates a playlist of three MP3 files (beethoven.mp3, mozart.mp3, and chopin.mp3) and plays each file in turn over the live st
Server-Side Communication ActionScript 73ExampleThis example opens a stream s and, when it is open, plays sample and records it. Because no value is p
74The following example is the client-side ActionScript that receives the Stream.send call. The method Test is defined on the Stream object:tStream.Te
Server-Side Communication ActionScript 75traceAvailabilityFlash Communication Server MX.Usagetrace("Hello world");trace("Value of i = &
77APPENDIXServer-Side Information ObjectsThe Application, NetConnection, and Stream objects provide an onStatus event handler that uses an information
Appendix78NetConnection information objectsThe NetConnection object has the same information objects as the client-side NetConnection object. Applicat
Server-Side Information Objects 79Stream information objectsThe information objects of the Stream object are similar to those of the client-side NetSt
8getBandwidthLimit Client.getBandwidthLimitgetProperty SharedObject.getPropertygetPropertyNames SharedObject.getPropertyNameshandlerName SharedObject.
Appendix80
Server-Side Communication ActionScript 9Application (object)The Application object contains information about a Flash Communication Server application
Commenti su questo manuale