Adobe Extending Flash Professional CS5 Manual de usuario Pagina 433

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 565
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 432
411
EXTENDING FLASH PROFESSIONAL
swfPanel object
Last updated 5/2/2011
Returns
Either null or a string that is returned by the function call. The function result could be an empty string.
Description
Method; works in conjunction with the ActionScript ExternalInterface.addCallback() and MMExecute()
methods to communicate with the SWF panel from the authoring environment.
Example
The following example illustrates how to use ActionScript and JavaScript code to create a Window SWF panel and
communicate with it from the authoring environment.
1 Create an ActionScript 3.0 FLA file, set its color to a medium gray, and set its size to 400 pixels wide and 250 pixels
high.
2 Place a dynamic text box in the center of the Stage, set its Instance name to myTextField, and type the word
"Status" in the text box.
3 Set other text box properties similar to the following:
Center aligned
355 pixels wide and 46 pixels high
Times New Roman font, 28 points, red
4 Add the following ActionScript code:
// Here's the callback function to be called from JSAPI
function callMeFromJavascript(arg:String):void
{
try {
var name:String = String(arg);
myTextField.text = name;
} catch (e:Error) {
}
}
// Expose the callback function as "callMySWF"
ExternalInterface.addCallback("callMySWF", callMeFromJavascript);
// run the JSAPI to wire up the callback
MMExecute("fl.runScript( fl.configURI + \"WindowSWF/fileOp.jsfl\" );");
MMExecute("fl.trace(\"AS3 File Status Panel Initialized\");");
5 Save the file as fileStatus.fla, and publish the SWF file with the default Publish settings.
6 Close Flash.
7 Copy the fileStatus.swf file to the WindowSWF folder, which is a subfolder of the Configuration folder (see Saving
JSFL files” on page 2). For example, on Windows XP, the folder is in boot drive\Documents and Settings\user\Local
Settings\Application Data\Adobe\Flash CS4\language\Configuration\WindowSWF.
8 Start Flash.
9 Create a JSFL file with the following code:
Vista de pagina 432
1 2 ... 428 429 430 431 432 433 434 435 436 437 438 ... 564 565

Comentarios a estos manuales

Sin comentarios