Books
in black and white
Main menu
Home About us Share a book
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

macromedia flash mx - Reinhardt R.

Reinhardt R., Lott J macromedia flash mx - John Wiley & Sons, 2004. - 987 p.
ISBN 0-7645-4354-7
Download (direct link): macromediaflash2004.pdf
Previous << 1 .. 49 50 51 52 53 54 < 55 > 56 57 58 59 60 61 .. 419 >> Next

1. Make sure Flash is closed.
2. Open the ActionsPanel.xml document from the location specified earlier in this chapter.
3. Select all the text in the file and delete it.
4. Insert the following into the document, and save the document:
<?xml version="1.0"?>
<actionspanel>
</actionspanel>
5. Open Flash, and open the Actions panel. You should see the following folders in the Actions toolbox: Data, Components (both generated by XML documents in
CustomActions), and Index.
3) Data ill Components Index
Chapter 4 Learning ActionScript Basics 87
6. Close the Flash application.
7. In the ActionsPanel.xml document, add the following element between the opening and closing Actions panel tags, and save the document:
<folder name="MyFolder" id="MyFolder" tiptext="this is my new folder"> </folder>
8. Open Flash, and open the Actions panel. In addition to the previously available folders, you should now see the MyFolder folder at the top of the Actions panel.
9. Close Flash.
10. In the ActionsPanel.xml document, add the following elements between opening and closing folder tags:
<action name="MyAction" tiptext="my very first action" quickey="ma" text="MyAction();" text2="MyAction (% paraml, param2 %);" />
folder name="MyProperties" id="MyProperties" tiptext=
"my properties folder">
<string name="myProperty" tiptext="my very first property" text=".myProperty" object="MyAction" />
</folder>
<folder name="MyMethods" id="MyMethods" tiptext="my methods folder"> <string name="myMethod" tiptext="my very first method" text=".myMethod(% paraml %)" type="procedure" object="MyAction" /> </folder>
<folder name="MyEvents" id="MyEvents" tiptext="my events folder">
<string name="myEvent" tiptext="my very first event" text=".myEvent" type="event" object="MyAction" />
</folder>
<folder name="MyListeners" id="MyListeners" tiptext=
"my listeners folder">
<string name="myListener" tiptext=
"my very first listener" text=".myListener" type="listener" object="MyAction" />
</folder>
11. Open Flash, and open the Actions panel. Within the MyFolder folder, you should now have a code item (MyAction) as well as four folders (MyProperties, MyMethods, MyEvents, and MyListeners), each containing a single code item (myProperty, myMethod, myEvent, and myListener, respectively).
Continued
88 Part II Laying the ActionScript Foundation
Continued
|J My Folder
My Action [Esc-ma] MyEvents [ MyLisleners MyMethods MyProperlies 01 Dt<
7" ] Components |] index
12. In the Script pane, type the following:
var anInstance:MyAction; anlnstance.
If the code hint doesn't come up automatically, invoke it manually. You should see a menu code hint with four choices: myProperty, myMethod, myEvent, and myListener.
13. Select myMethod from the list. It should appear in the Script pane, the cursor should be placed between the parentheses automatically, and the tooltip code hint should appear.
14. Close Flash.
15. Close ActionsPanel.xml.
16. To restore the default ActionsPanel.xml, delete the file, and restart Flash MX 2004. The default contents should appear in the Actions toolbox. If it does not, for some reason, close Flash, overwrite ActionsPanel.xml with your backup copy, and then restart Flash.
Chapter 4 Learning ActionScript Basics 89
AsColorSyntax.xml
Using the AsColorSyntax.xml file, you can modify which words are recognized by Flash as identifiers and keywords for syntax color coding in the Script pane. The ActionScript Editor Preferences allow you to modify the color in which six types of elements are coded in the Script pane. Of those six, however, four are nonconfigurable by their very nature. The foreground is always the foreground, the background is always the background, comments are always comments, and quoted string literals are always quoted string literals. But words to be designated as keywords and identifiers need to be flexible so that new words can be added for new objects, functions, and so on.
If you open the default AsColorSyntax.xml file, you see that it is really quite simple. Aside from the root element and the conditional elements, there are only three types of elements in the file: identifier, keyword, and property. The type of element determines how the word will be coded in the Script pane.
Tag Attribute Description
<colorsyntax> Required as the root element. This means that it encapsulates the rest of the elements of the XML document.
<identifier> Indicates a keyword that Flash should color code using the identifier color (see "Setting Actions Panel Preferences").
text Specifies the word that will be color coded when entered into the Script pane.
<keyword> Indicates a keyword that Flash should color code using the keyword color (see "Setting Actions Panel Preferences").
text Specifies the word that will be color coded when entered into the Script pane.
<property> Indicates a property that Flash should color code using the keyword color (see "Setting Actions Panel Preferences"). Notice that the <keyword> and <property> fags define keywords that are color coded with the same color.
Previous << 1 .. 49 50 51 52 53 54 < 55 > 56 57 58 59 60 61 .. 419 >> Next