The ActionScript 3.0 Language and Components Reference supports several Adobe products, including Flash CS4 and Flex. The content covers application programming interfaces (APIs) that are specific to ActionScript and that may be implemented differently depending on the authoring tool you are using. Therefore, to test and use the example code in the ActionScript 3.0 Language and Components Reference, you need to know the implementation for the authoring tool you are using. For example, the ActionScript 3.0 Language and Components Reference contains some examples that use a class structure (such as the flash.ui.ContextMenu class example) and other examples that do not (such as the flash.display.DisplayObjectContainer.mouseChildren property example). Flash Builder users can test the ContextMenu class example by pasting it directly into an ActionScript Project. (For MXML-based projects the class structure examples often need some additional Flex-specific code.) Flash authoring users need to paste that content into a class file to test it. The directions for each authoring tool are as follows:
Flash CS4 instructions
You can paste the examples that do not use a class structure into the Actions panel for the first layer of the first frame of the main timeline and test them using the Control > Test Movie menu option. For the examples that use a class structure, follow these steps:
Flash Builder instructions
You can paste examples that do not use a class structure into the mx:Script
tag contents of your MXML application. The simplest way to test the examples that use a class structure is to paste them into an ActionScript Project as follows:
Note: If you test ActionScript examples that use the addChild()
ActionScript method with Flash Player display objects (like a text field) within an MXML application, you will need to attach the code to a Flex UIComponent instead of adding the Flash Player display object.