About the ComponentTask tag

You can specify one or more Flash JavaScript (JSFL) files to perform tasks for your component from within the Flash authoring environment, and the tasks then appear, automatically, in the Component Inspector wizards menu (click the "magic wand") based on the taskName attribute. Use the ComponentTask tag to define this association between your component and its JSFL file and to associate any additional files required a JSFL file. The JSFL files interact with the JavaScript API in the Flash authoring environment.

NOTE

Any JSFL task files and required dependency files declared with the ComponentTask tag must reside in the same folder as your component FLA file when you export your component as a SWC file.

The ComponentTask tag has the following syntax:

[ComponentTask [taskName,taskFile [,otherFile[,…]]]

The taskName and taskFile attributes are required. The otherFile attribute is optional

The following example associates SetUp.jsfl and AddNewSymbol.jsfl with the component class named myComponent. The AddNewSymbol.jsfl requires a testXML.xml file and is specified in the otherFile attribute.

[ComponentTask("Do Some Setup","SetUp.jsfl")]
[ComponentTask("Add a new Symbol","AddNewSymbol.jsfl","testXML.xml")]
class myComponent{
    //...
}

The following table describes the attributes of the ComponentTask tag:

Attribute

Type

Description

taskName

String

(Required) The name of the task as a string. This name is displayed in the Tasks pop-up menu that appears on the Schema tab of the Component inspector.

taskFile

String

(Required) The name of the JSFL file that implements the tasks within the authoring environment. The file must reside in the same folder as your component FLA when you export your component as a SWC file.

otherFile

String

(Optional) One or more names of files that are required by the JSFL file such as an XML file. The file(s) must reside in the same folder as your component FLA when you export your component as a SWC file.