beautypg.com

Swfpanel.name – Adobe Extending Flash Professional CS5 User Manual

Page 434

background image

412

EXTENDING FLASH PROFESSIONAL

swfPanel object

Last updated 5/2/2011

function callMyPanel(panelName, arg)
{

if(fl.swfPanels.length > 0){

for(x = 0; x < fl.swfPanels.length; x++){

// look for a SWF panel of the specified name, then call the specified AS3

function

// in this example, the panel is named "test" and the AS3 callback is "callMySWF"
if(fl.swfPanels[x].name == panelName) // name busted?
{

fl.swfPanels[x].call("callMySWF",arg);
break;

}

}

}
else

fl.trace("no panels");

}


// define the various handlers for events
documentClosedHandler = function () { callMyPanel("fileStatus", "Document Closed");};
fl.addEventListener("documentClosed", documentClosedHandler );

var dater = "New Document";
documentNewHandler = function () { callMyPanel("fileStatus", dater );};
fl.addEventListener("documentNew", documentNewHandler );

documentOpenedHandler = function () { callMyPanel("fileStatus", "Document Opened");};
fl.addEventListener("documentOpened", documentOpenedHandler );

10 Save the JSFL file in the same directory as the SWF file, with the name fileOp.jsfl.

11 Choose Window > Other panels > fileStatus.

Now, as you create, open, and close FLA files, the fileStatus panel displays a message indicating the action you have
taken.

swfPanel.name

Availability
Flash CS4 Professional.

Usage

swfPanel.name

Description
Read-only property: a string that represents the name of the specified Window SWF panel.

Example
The following code displays the name of the first registered Window SWF panel in the Output panel:

This manual is related to the following products: