call a function of a flash script from another flash script -


Hello I am a novice of Flash, I am trying to do the following:

A flash Page Script I want to call a function related to another flash script, how to do it?

Thanks in advance. Local connection: local connection / constructor inside (local connection = new local connection (); // if / If both SWFs are in separate domains then the local connection.Oldommen ("sender.svf.s.domain"); // If the receiver is in HTTPS and the sender is a non-HTTPS local connection. Alok Unsor Demon ("sender.swf. S.domain "); localConnection.connect (" connectionName "); LocalConnection.client = this; // initialize textfield (tf) here} public function writeMsg (msg: string): zero {t} F.text + = "\ n Received message \ n" + msg;}

Sending SWF:

  Private var Local connection: Local connection ; Personal var connectionName: inside the string; // use the same name as the connection {connectionName = "connectionName"; // localConnection = new local connection (); LocalConnection.addEventListener (StatusEvent.STATUS, onStatus); LocalConnection.addEventListener (SecurityErrorEvent.SECURITY_ERROR, onserver);} // sender SWF localConnection.send (connectionName, "writeMsg", "This works!") From the recipient to call the "writeMsg" function in SWF A; Personal function on status (e: status event): zero {trace ("status event handler: code =" + encoded + ", level =" + e. Level); } Private function onSecError (e: SecurityErrorEvent): Zero {trace ("Unable to create local connection due to security error:" + e.text); }  

Remember local connections are simple - communication is the only way. For two-way communication, you have to set the second pair of local connections and call connect with the appropriate SWF with a different connection name.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -