MACROMEDIA FLASH 8-EXTENDING FLASH Manual
Summary of FLASH 8-EXTENDING FLASH
Page 1
Extending flash.
Page 2
Trademarks 1 step robopdf, activeedit, activetest, authorware, blue sky software, blue sky, breeze, breezo, captivate, central, coldfusion, contribute, database explorer, director, dreamweaver, fireworks, flash, flashcast, flashhelp, flash lite, flashpaper, flash video encoder, flex, flex builder, f...
Page 3
3 contents introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 overview of the macromedia flash javascript api . . . . . . . . . . . . . . . . . 5 what’s new in the javascript api . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 th...
Page 4
4 contents outputpanel object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .334 parameter object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .337 path object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....
Page 5
5 introduction as a macromedia flash user, you may be familiar with actionscript, which lets you create scripts that execute at runtime in macromedia flash player. The flash javascript application programming interface (javascript api) is a complementary programming tool that lets you create scripts...
Page 6
6 introduction the flash javascript api is designed to resemble the macromedia dreamweaver and macromedia fireworks javascript api (which were designed based on the netscape javascript api). The flash javascript api is based on a document object model (dom), which allows flash documents to be access...
Page 7
Overview of the macromedia flash javascript api 7 to copy commands from the history panel to the clipboard: 1. Select one or more commands in the history panel. 2. Do one of the following: ■ click the copy button. ■ select copy steps from the options pop-up menu. To view javascript commands in the h...
Page 8
8 introduction there are three locations where you can store command, effect, and tool files so they can be accessed in the authoring environment. ■ for scripts that will appear as items in the commands menu, save the jsfl file in the commands folder in the following location: ■ windows 2000 or wind...
Page 9
Overview of the macromedia flash javascript api 9 running jsfl files there are several ways to run jsfl files. The most common ways are discussed in this section. To run a script that is in the commands folder, do one of the following: ■ select commands > script name. ■ use a keyboard shortcut that ...
Page 10
10 introduction to run a script from the command line on windows: ■ use the following syntax (add path information as required): "flash.Exe" mytestfile.Jsfl to run a script from the command line on the macintosh: ■ use the following syntax (add path information as required): osascript -e 'tell appli...
Page 11
What’s new in the javascript api 11 new objects the following objects are new in flash 8: filter object project object projectitem object the following object was implemented in a flash mx 2004 update release, but is newly documented in this release: flfile object new methods and properties the foll...
Page 12
12 introduction document.Setmetadata() document.Swapstrokeandfill() document.Union() document.Zoomfactor element.Layer element.Selected fill.Focalpoint fill.Linearrgb fill.Overflow fl.Browseforfolderurl() fl.Closeproject() fl.Contactsensitiveselection fl.Createproject() fl.Objectdrawingmode fl.Getap...
Page 13
What’s new in the javascript api 13 symbolitem.Scalinggridrect text.Antialiassharpness text.Antialiasthickness textattrs.Letterspacing text.Fontrenderingmode videoitem.Sourcefilepath videoitem.Videotype xmlui.Getcontrolitemelement() xmlui.Getenabled() xmlui.Getvisible() xmlui.Setcontrolitemelement()...
Page 14
14 introduction the flash document object model the flash document object model (dom) for the flash javascript api consists of a set of top-level functions (see “top-level functions and methods” on page 23 ) and two top-level objects—the flfile object and the flash object (fl). Each object is guaran...
Page 15
The flash document object model 15 the document object an important property of the top-level flash object is the fl.Documents property. (see fl.Documents property.) the fl.Documents property contains an array of document objects that each represent one of the fla files currently open in the authori...
Page 16
16 introduction specifying the target of an action unless otherwise specified, methods affect the current focus or selection. For example, the following script doubles the size of the current selection because no particular object is specified: fl.Getdocumentdom().Scaleselection(2, 2); in some cases...
Page 17
The flash document object model 17 finally, some objects are subclasses of other objects, rather than being children of other objects. An object that is a subclass of another object has methods and/or properties of its own in addition to the methods and properties of the other object (the superclass...
Page 18
18 introduction 06 instance object (abstract class, subclass of element object ) 06 bitmapinstance object (subclass of instance object ) 06 compiledclipinstance object (subclass of instance object ) 06 componentinstance object (subclass of symbolinstance object ) 07 parameter object ( componentinsta...
Page 19
Sample implementations 19 02 math object 02 outputpanel object 02 project object 03 projectitem object ( project.Items array) 02 tools object ( fl.Tools array) 03 toolobj object ( tools.Toolobjs array) 02 xmlui object sample implementations several sample jsfl implementations are included with flash...
Page 20
20 introduction sample get and set filters command a sample javascript api script named filtersgetset.Jsfl is located in the extendingflash/ filtersgetset folder (see “sample implementations” on page 19 ). This script adds filters to a selected object and displays information about the filters being...
Page 21
Sample implementations 21 to remove the earlier version of the polystar.Jsfl file that was installed with flash: 1. Select edit > customize tools panel (windows) or flash > customize tools panel (macintosh). 2. In the customize tools panel dialog box, click the rectangle tool on the left side of the...
Page 22
22 introduction sample trace bitmap panel a set of files named tracebitmap.Fla and tracebitmap.Swf are located in the extendingflash/ tracebitmappanel folder (see “sample implementations” on page 19 ). These files illustrate how to design and build a panel to control the functions of flash. They als...
Page 23
23 1 chapter 1 top-level functions and methods this chapter describes the top-level functions and methods that are available when you use the macromedia flash javascript application programming interface (javascript api). For information about where to store javascript api files, see “saving jsfl fi...
Page 24
24 top-level functions and methods extensible tools the following functions are available in scripts that create extensible tools: activate() configuretool() deactivate() keydown() keyup() mousedoubleclick() mousedown() mousemove() mouseup() notifysettingschanged() setcursor() activate() availabilit...
Page 25
Alert() 25 example the following example sets the value of tools.Activetool when the extensible tool is selected in the tools panel: function activate() { var thetool = fl.Tools.Activetool } see also tools.Activetool alert() availability flash mx 2004. Usage alert ( alerttext ) parameters alerttext ...
Page 26
26 top-level functions and methods configureeffect() availability flash mx 2004. Usage function configureeffect() { // statements } parameters none. Returns nothing. Description function; called once when flash loads; place any global initialization statements for your effect inside this function. T...
Page 27
Confirm() 27 description function; called when flash opens and the extensible tool is loaded into the tools panel. Use this function to set any information flash needs to know about the tool. Example the following examples show two possible implementations of this function: function configuretool() ...
Page 28
28 top-level functions and methods example the following example displays the message “sort data?” in an alert dialog box: confirm("sort data?"); see also alert() , prompt() deactivate() availability flash mx 2004. Usage function deactivate() { // statements } parameters none. Returns nothing. Descr...
Page 29
Keydown() 29 executeeffect() availability flash mx 2004. Usage function executeeffect() { // statements } parameters none. Returns nothing. Description function; called when the user first applies an effect or changes an effect’s properties. The code contained in this function modifies the original ...
Page 30
30 top-level functions and methods description function; called when the extensible tool is active and the user presses a key. The script should call tools.Getkeydown() to determine which key was pressed. Example the following example displays information about which key was pressed when the extensi...
Page 31
Mousedoubleclick() 31 example the following example displays a message in the output panel when the extensible tool is active and a key is released. Function keyup() { fl.Trace("key is released"); } see also keydown() mousedoubleclick() availability flash mx 2004. Usage function mousedoubleclick() {...
Page 32
32 top-level functions and methods mousedown() availability flash mx 2004. Usage function mousedown( [ pt ] ) { // statements } parameters pt a point that specifies the location of the mouse when the button is pressed. It is passed to the function when the mouse button is pressed. This parameter is ...
Page 33
Mousemove() 33 mousemove() availability flash mx 2004. Usage function mousemove( [ pt ] ) { // statements } parameters pt a point that specifies the current location of the mouse. It is passed to the function whenever the mouse moves, which tracks the mouse location. If the stage is in edit or edit-...
Page 34
34 top-level functions and methods mouseup() availability flash mx 2004. Usage function mouseup() { // statements } parameters none. Returns nothing. Description function; called whenever the extensible tool is active and the mouse button is released after being pressed on the stage. Example the fol...
Page 35
Prompt() 35 returns nothing. Description function; called when the extensible tool is active and the user changes its options in the property inspector. You can use the tools.Activetool property to query the current values of the options (see tools.Activetool ). Example the following example display...
Page 36
36 top-level functions and methods example the following example prompts the user to enter a user name. If the user types a name and clicks ok, the name appears in the output panel. Var username = prompt("enter user name", "type user name here"); fl.Trace(username); see also alert() , confirm() remo...
Page 37
Setcursor() 37 setcursor() availability flash mx 2004. Usage function setcursor() { // statements } parameters none. Returns nothing. Description function; called when the extensible tool is active and the mouse moves, to allow the script to set custom pointers. The script should call tools.Setcurso...
Page 38
38 top-level functions and methods.
Page 39
39 2 chapter 2 objects this chapter briefly describes each of the objects available in the flash javascript application programming interface (javascript api). The objects are listed in alphabetical order in the following table: object description bitmapinstance object the bitmapinstance object is a...
Page 40
40 objects filter object the filter object contains all the properties for all filters. Flash object (fl) the flash object represents the flash application. Flfile object the flfile object lets you write flash extensions that can access, modify, and remove files and folders on the local file system....
Page 41
41 shape object the shape object is a subclass of the element object . The shape object provides more precise control than the drawing apis for manipulating or creating geometry on the stage. Sounditem object the sounditem object is a subclass of the item object . It represents a library item used t...
Page 42
42 objects bitmapinstance object inheritance element object > instance object > bitmapinstance object availability flash mx 2004. Description the bitmapinstance object is a subclass of the instance object and represents a bitmap in a frame (see instance object ). Method summary for the bitmapinstanc...
Page 43
Bitmapinstance object 43 parameters none. Returns an object that contains width , height , depth , bits , and, if the bitmap has a color table, ctab properties. The bits element is an array of bytes. The ctab element is an array of color values of the form "#rrggbb" . The length of the array is the ...
Page 44
44 objects example the following code retrieves the width of the bitmap in pixels: // get the number of pixels in the horizontal dimension. Var bmobj = fl.Getdocumentdom().Selection[0]; var isbitmap = bmobj.Instancetype; if(isbitmap == "bitmap"){ var numhorizontalpixels = bmobj.Hpixels; } see also b...
Page 45
Bitmapinstance object 45 example the following code tests whether the current selection is a bitmap, and then sets the height of the bitmap to 150 pixels: var isbitmap = fl.Getdocumentdom().Selection[0].Instancetype; if(isbitmap == "bitmap"){ var bits = fl.Getdocumentdom().Selection[0].Getbits(); bi...
Page 46
46 objects bitmapitem object inheritance item object > bitmapitem object availability flash mx 2004. Description a bitmapitem object refers to a bitmap in the library of a document. The bitmapitem object is a subclass of the item object (see item object ). Property summary for the bitmapitem object ...
Page 47
Bitmapitem object 47 example the following code sets the allowsmoothing property of the first item in the library of the current document to true : fl.Getdocumentdom().Library.Items[0].Allowsmoothing = true; alert(fl.Getdocumentdom().Library.Items[0].Allowsmoothing); bitmapitem.Compressiontype avail...
Page 48
48 objects example the following code sets the quality property of the first item in the library of the current document to 65: fl.Getdocumentdom().Library.Items[0].Quality = 65; alert(fl.Getdocumentdom().Library.Items[0].Quality); bitmapitem.Useimportedjpegquality availability flash mx 2004. Usage ...
Page 49
Compiledclipinstance object 49 compiledclipinstance object inheritance element object > instance object > compiledclipinstance object availability flash mx 2004. Description the compiledclipinstance object is a subclass of the instance object. It is essentially an instance of a movie clip that has b...
Page 50
50 objects compiledclipinstance.Accname availability flash mx 2004. Usage compiledclipinstance.Accname description property; a string that is equivalent to the name field in the accessibility panel. Screen readers identify objects by reading the name aloud. Example the following example gets and set...
Page 51
Compiledclipinstance object 51 compiledclipinstance.Description availability flash mx 2004. Usage compiledclipinstance.Description description property; a string that is equivalent to the description field in the accessibility panel. The description is read by the screen reader. Example the followin...
Page 52
52 objects compiledclipinstance.Shortcut availability flash mx 2004. Usage compiledclipinstance.Shortcut description property; a string that is equivalent to the shortcut field in the accessibility panel. The shortcut is read by the screen readers. This property is not available for dynamic text fie...
Page 53
Compiledclipinstance object 53 compiledclipinstance.Tabindex availability flash mx 2004. Usage compiledclipinstance.Tabindex description property; an integer that is equivalent to the tab index field in the accessibility panel. Creates a tab order in which objects are accessed when the user presses ...
Page 54
54 objects componentinstance object inheritance element object > instance object > symbolinstance object > componentinstance object availability flash mx 2004. Description the componentinstance object is a subclass of the symbolinstance object and represents a component in a frame. (see symbolinstan...
Page 55
Componentspanel object 55 componentspanel object availability flash mx 2004. Description the componentspanel object, which represents the components panel, is a property of the flash object (fl) and can be accessed by fl.Componentspanel. (see flash object (fl) .) method summary for the componentspan...
Page 56
56 objects description adds the specified component to the document at the specified position. Examples the following examples illustrate some ways to use this method: fl.Componentspanel.Additemtodocument({x:0, y:0}, "user interface", "checkbox"); fl.Componentspanel.Additemtodocument({x:0, y:100}, "...
Page 57
Contour object 57 contour object availability flash mx 2004. Description a contour object represents a closed path of half edges on the boundary of a shape. Method summary for the contour object you can use the following method with the contour object: property summary for the contour object you can...
Page 58
58 objects description method; returns a halfedge object on the contour of the selection. Example this example traverses all the contours of a selected shape and shows the coordinates of the vertices in the output panel: // with a shape selected var elt = fl.Getdocumentdom().Selection[0]; elt.Begine...
Page 59
Contour object 59 contour.Interior availability flash mx 2004. Usage contour.Interior description read-only property; the value is true if the contour encloses an area; false otherwise. Example this example traverses all the contours in the selected shape and shows the value of the interior property...
Page 60
60 objects example the following example traverses all the contours of the selected shape and shows the value of the orientation property of each contour in the output panel: var elt = fl.Getdocumentdom().Selection[0]; elt.Beginedit(); var contourarray = elt.Contours; var contourcount = 0; for (i=0;...
Page 61
Document object 61 document object availability flash mx 2004. Description the document object represents the stage. That is, only fla files are considered documents. Method summary for the document object you can use the following methods with the document object. Method description document.Adddat...
Page 62
62 objects document.Caneditsymbol() indicates whether edit symbols menu and functionality is enabled. Document.Canrevert() determines whether you can use the document.Revert() or fl.Revertdocument() method successfully. Document.Cantestmovie() determines whether you can use the document.Testmovie() ...
Page 63
Document object 63 document.Distributetolayers() performs a distribute-to-layers operation on the current selection; equivalent to selecting distribute to layers. Document.Documenthasdata() checks the document for persistent data with the specified name. Document.Duplicatepublishprofile() duplicates...
Page 64
64 objects document.Getelementtextattr() gets a specified textattrs property of the selected text objects. Document.Getfilters() returns an array that contains the list of filters applied to the currently selected object(s). Document.Getmetadata() returns a string containing the xml metadata associa...
Page 65
Document object 65 document.Punch() uses top selected drawing object to punch through all selected drawing objects underneath it. Document.Removeallfilters() removes all filters from the selected object(s). Document.Removedatafromdocument() removes persistent data with the specified name that has be...
Page 66
66 objects document.Setblendmode() sets the blend mode for the selected objects. Document.Setcustomfill() sets the fill settings for the tools panel, property inspector, and any selected shapes. Document.Setcustomstroke() sets the stroke settings for the tools panel, property inspector, and any sele...
Page 67
Document object 67 document.Settextselection() sets the text selection of the currently selected text field to the values specified by the startindex and endindex values. Document.Settextstring() inserts a string of text. Document.Settransformationpoint() moves the transformation point of the curren...
Page 68
68 objects property summary for the document object you can use the following properties with the document object. Property description document.Accname a string that is equivalent to the name field in the accessibility panel. Document.Autolabel a boolean value that is equivalent to the auto label c...
Page 69
Document object 69 document.Accname availability flash mx 2004. Usage document.Accname description property; a string that is equivalent to the name field in the accessibility panel. Screen readers identify objects by reading the name aloud. Example the following example sets the accessibility name ...
Page 70
70 objects parameters name a string that specifies the name of the data to add. Type a string that defines the type of data to add. Acceptable values are type are "integer" , "integerarray" , "double" , "doublearray" , "string" , and "bytearray" . Data the value to add. Valid types depend on the typ...
Page 71
Document object 71 description method; stores specified data with the selected object(s). Data is written to the fla file and is available to javascript when the file reopens. Only symbols and bitmaps support persistent data. Example the following example adds an integer value of 12 to the selected ...
Page 72
72 objects document.Additem() availability flash mx 2004. Usage document.Additem( position , item ) parameters position a point that specifies the x and y coordinates of the location at which to add the item. It uses the center of a symbol or the upper-left corner of a bitmap or video. Item an item ...
Page 73
Document object 73 document.Addnewline() availability flash mx 2004. Usage document.Addnewline( startpoint , endpoint ) parameters startpoint a pair of floating-point numbers that specify the x and y coordinates where the line starts. Endpoint a pair of floating-point numbers that specify the x and ...
Page 74
74 objects parameters boundingrectangle a rectangle that specifies the bounds of the oval to be added. For information on the format of boundingrectangle , see document.Addnewrectangle() . Bsuppressfill a boolean value that, if set to true , causes the method to create the shape without a fill. The ...
Page 75
Document object 75 document.Addnewpublishprofile() availability flash mx 2004. Usage document.Addnewpublishprofile( [profilename ] ) parameters profilename the unique name of the new profile. If you do not specify a name, a default name is provided. This parameter is optional. Returns an integer tha...
Page 76
76 objects parameters boundingrectangle a rectangle that specifies the bounds within which the new rectangle is added, in the format {left:value1,top:value2,right:value3,bottom:value4} . The left and top values specify the location of the upper-left corner (e.G., left:0,top:0 represents the upper-le...
Page 77
Document object 77 example the following example adds a new rectangle with no rounding on the corners within the specified coordinates; it is 100 pixels in width and in height: flash.Getdocumentdom().Addnewrectangle({left:0,top:0,right:100,bottom:100}, 0); the following example adds a new rectangle ...
Page 78
78 objects example the following example adds a new scene named myscene after the current scene in the current document. The variable success will be true when the new scene is created; false otherwise. Var success = flash.Getdocumentdom().Addnewscene("myscene"); the following example adds a new sce...
Page 79
Document object 79 document.Align() availability flash mx 2004. Usage document.Align( alignmode [, busedocumentbounds ] ) parameters alignmode a string that specifies how to align the selection. Acceptable values are "left" , "right" , "top" , "bottom" , "vertical center" , and "horizontal center" ....
Page 80
80 objects returns a boolean value: true if document.Screenoutline can be used safely; false otherwise. Description method; use before using the document.Screenoutline property. If this method returns the value true , you can safely access document.Screenoutline ; flash displays an error if you acce...
Page 81
Document object 81 example the following example moves the current selection to the front: fl.Getdocumentdom().Arrange("front"); document.Autolabel availability flash mx 2004. Usage document.Autolabel description property; a boolean value that is equivalent to the auto label check box in the accessi...
Page 82
82 objects example the following example sets the background color to black: fl.Getdocumentdom().Backgroundcolor = '#000000'; document.Breakapart() availability flash mx 2004. Usage document.Breakapart() parameters none. Returns nothing. Description method; performs a break-apart operation on the cu...
Page 83
Document object 83 description method; indicates whether the edit symbols menu and functionality are enabled. This is not related to whether the selection can be edited. This method should not be used to test whether fl.Getdocumentdom().Entereditmode() is allowed. Example the following example displ...
Page 84
84 objects document.Cantestmovie() availability flash mx 2004. Usage document.Cantestmovie() parameters none. Returns a boolean value: true if you can use the document.Testmovie() method successfully: false otherwise. Description method; determines whether you can use the document.Testmovie() method...
Page 85
Document object 85 returns a boolean value: true if you can use the document.Testscene() method successfully; false otherwise. Description method; determines whether you can use the document.Testscene() method successfully. Example the following example first tests whether fl.Getdocumentdom().Testsc...
Page 86
86 objects if you then issue the command fl.Getdocumentdom().Changefilterorder(0, 2), the filters are rearranged as follows: before: gradientbevelfilter, blurfilter, dropshadowfilter, glowfilter after: blurfilter, dropshadowfilter, gradientbevelfilter, glowfilter example the following example moves ...
Page 87
Document object 87 document.Clipcut() availability flash mx 2004. Usage document.Clipcut() parameters none. Returns nothing. Description method; cuts the current selection from the document and writes it to the clipboard. Example the following example cuts the current selection from the document and...
Page 88
88 objects example the following examples pastes the clipboard contents to the center of the document: fl.Getdocumentdom().Clippaste(); the following example pastes the clipboard contents in place in the current document: fl.Getdocumentdom().Clippaste(true); document.Close() availability flash mx 20...
Page 89
Document object 89 document.Convertlinestofills() availability flash mx 2004. Usage document.Convertlinestofills() parameters none. Returns nothing. Description method; converts lines to fills on the selected objects. Example the following example converts the current selected lines to fills: fl.Get...
Page 90
90 objects description method; converts the selected stage item(s) to a new symbol. For information on defining linkage and shared asset properties for a symbol, see item object . Example the following examples create a movie clip symbol with a specified name, a button symbol with a specified name, ...
Page 91
Document object 91 document.Currentpublishprofile availability flash mx 2004. Usage document.Currentpublishprofile description property; a string that specifies the name of the active publish profile for the specified document. Example the following example adds a new publish profile with the defaul...
Page 92
92 objects the following example changes the active timeline from the main timeline to a scene named "myscene" . Var i = 0; var curtimelines = fl.Getdocumentdom().Timelines; while(i if(curtimelines[i].Name == "myscene"){ fl.Getdocumentdom().Currenttimeline = i; } ++i; } see also document.Gettimeline...
Page 93
Document object 93 document.Deletepublishprofile() availability flash mx 2004. Usage document.Deletepublishprofile() parameters none. Returns an integer that is the index of the new current profile. If a new profile is not available, the method leaves the current profile unchanged and returns its in...
Page 94
94 objects description method; deletes the current scene ( timeline object ) and, if the deleted scene was not the last one, sets the next scene as the current timeline object. If the deleted scene was the last one, it sets the first object as the current timeline object. If only one timeline object...
Page 95
Document object 95 document.Description availability flash mx 2004. Usage document.Description description property; a string that is equivalent to the description field in the accessibility panel. The description is read by the screen reader. Example the following example sets the description of th...
Page 96
96 objects example the following example disables all filters on the selected objects: fl.Getdocumentdom().Disableallfilters(); see also document.Addfilter() , document.Changefilterorder() , document.Disablefilter() , document.Disableotherfilters() , document.Enableallfilters() , document.Getfilters...
Page 97
Document object 97 document.Disableotherfilters() availability flash 8. Usage document.Disableotherfilters( enabledfilterindex ) parameters enabledfilterindex an integer representing the zero-based index of the filter that should remain enabled after other filters are disabled. Returns nothing. Desc...
Page 98
98 objects parameters distributemode a string that specifies where to distribute the selected object. Acceptable values are "left edge" , "horizontal center" , "right edge" , "top edge" , "vertical center" , and "bottom edge" . Busedocumentbounds a boolean value that, when set to true , distributes ...
Page 99
Document object 99 returns nothing. Description method; performs a distribute-to-layers operation on the current selection—equivalent to selecting distribute to layers. This method displays an error if there is no selection. Example the following example distributes the current selection to layers: ...
Page 100
100 objects document.Duplicatepublishprofile() availability flash mx 2004. Usage document.Duplicatepublishprofile( [profilename ] ) parameters profilename a string that specifies the unique name of the duplicated profile. If you do not specify a name, the method uses the default name. This parameter...
Page 101
Document object 101 example the following example duplicates the second scene in the current document: fl.Getdocumentdom().Editscene(1); //set the middle scene to current scene var success = fl.Getdocumentdom().Duplicatescene(); document.Duplicateselection() availability flash mx 2004. Usage documen...
Page 102
102 objects description method; makes the specified scene the currently selected scene for editing. Example assuming that there are three scenes ( scene0 , scene1 , and scene2 ) in the current document, the following example makes scene2 the current scene and then deletes it: fl.Getdocumentdom().Edi...
Page 103
Document object 103 document.Enablefilter() availability flash 8. Usage document.Enablefilter( filterindex ) parameters filterindex an integer specifying the zero-based index of the filter in the filters list to enable. Returns nothing. Description method; enables the specified filter for the select...
Page 104
104 objects returns nothing. Description method; switches the authoring tool into the editing mode specified by the parameter. If no parameter is specified, the method defaults to symbol-editing mode, which has the same result as right-clicking the symbol to invoke the context menu and selecting edi...
Page 105
Document object 105 example the following example exits symbol-editing mode: fl.Getdocumentdom().Exiteditmode(); see also document.Entereditmode() document.Exportpng() availability flash 8. Usage document.Exportpng([fileuri [, bcurrentpngsettings [, bcurrentframe]]]) parameters fileuri a string, exp...
Page 106
106 objects document.Exportpublishprofile() availability flash mx 2004. Usage document.Exportpublishprofile( fileuri ) parameters fileuri a string, expressed as a file:/// uri, that specifies the path of the xml file to which the profile is exported. Returns nothing. Description method; exports the ...
Page 108
108 objects example the following example sets the arechildrenaccessible variable to the value of the forcesimple property; a value of false means the children are accessible: var arechildrenaccessible = fl.Getdocumentdom().Forcesimple; the following example sets the forcesimple property to allow th...
Page 109
Document object 109 description method; identical to retrieving the value of the to stage button in the align panel. Gets the preference that can be used for document.Align() , document.Distribute() , document.Match() , and document.Space() methods on the document. Example the following example retr...
Page 110
110 objects document.Getcustomfill() availability flash mx 2004. Usage document.Getcustomfill( [ objecttofill ] ) parameters objecttofill a string that specifies the location of the fill object. The following values are valid: ■ "toolbar" returns the fill object of the tools panel and property inspe...
Page 111
Document object 111 document.Getcustomstroke() availability flash mx 2004. Usage document.Getcustomstroke( [locationofstroke] ) parameters locationofstroke a string that specifies the location of the stroke object. The following values are valid: ■ "toolbar" , if set, returns the stroke object of th...
Page 112
112 objects document.Getdatafromdocument() availability flash mx 2004. Usage document.Getdatafromdocument( name ) parameters name a string that specifies the name of the data to return. Returns the specified data. Description method; retrieves the value of the specified data. The type returned depen...
Page 113
Document object 113 returns the value of the specified property. Returns null if the property is an indeterminate state, as when multiple elements are selected with different property values. Returns undefined if the property is not a valid property of the selected element. Description method; gets ...
Page 114
114 objects returns if one text field is selected, the property is returned if there is only one value used within the text. Returns undefined if there are several values used inside the text field. If several text fields are selected, and all the text alignment values are equal, the method returns ...
Page 115
Document object 115 description method; returns an array that contains the list of filters applied to the currently selected object(s). If multiple objects are selected and they don’t have identical filters, this method returns the list of filters applied to the first selected object. Example see do...
Page 116
116 objects document.Getselectionrect() availability flash mx 2004. Usage document.Getselectionrect() parameters none. Returns the bounding rectangle of the current selection, or 0 if nothing is selected. For information on the format of the return value, see document.Addnewrectangle() . Description...
Page 117
Document object 117 parameters startindex an integer that is an index of first character to get. This parameter is optional. Endindex an integer that is an index of last character to get. This parameter is optional. Returns a string that contains the selected text. Description method; gets the curre...
Page 118
118 objects returns the current timeline object. Description method; retrieves the current timeline object in the document. The current timeline can be the current scene, the current symbol being edited, or the current screen. Example the following example gets the timeline object and returns the nu...
Page 119
Document object 119 example the following example gets the transformation point for the current selection. The transpoint.X property gives the x coordinate of the transformation point. The transpoint.Y property gives the y coordinate of the transformation point: var transpoint = fl.Getdocumentdom()....
Page 120
120 objects description property; an integer that specifies the height of the document (stage) in pixels. Example the following example sets the height of the stage to 400 pixels: fl.Getdocumentdom().Height = 400; see also document.Width document.Importfile() availability flash 8. Usage document.Imp...
Page 121
Document object 121 document.Importpublishprofile() availability flash mx 2004. Usage document.Importpublishprofile( fileuri ) parameters fileuri a string, expressed as a file:/// uri, that specifies the path of the xml file defining the profile to import. Returns an integer that is the index of the...
Page 122
122 objects description method; imports a swf file into the document. This method performs the same operation as using the import menu command to specify a swf file. In flash 8 and later, you can also use document.Importfile() to import a swf file (as well as other types of files). Example the follo...
Page 123
Document object 123 document.Library availability flash mx 2004. Usage document.Library description read-only property; the library object for a document. Example the following example gets the library for the currently focused document: var mycurrentlib = fl.Getdocumentdom().Library; assuming the c...
Page 124
124 objects document.Match() availability flash mx 2004. Usage document.Match( bwidth, bheight [, busedocumentbounds] ) parameters bwidth a boolean value that, when set to true , causes the method to make the widths of the selected items the same. Bheight a boolean value that, when set to true , cau...
Page 125
Document object 125 document.Mouseclick() availability flash mx 2004. Usage document.Mouseclick( position , btogglesel , bshiftsel ) parameters position a pair of floating-point values that specify the x and y coordinates of the click in pixels. Btogglesel a boolean value that specifies the state of...
Page 126
126 objects parameters position a pair of floating-point values that specify the x and y coordinates of the click in pixels. Baltdown a boolean value that records whether the alt key is down at the time of the event: true for pressed; false for not pressed. Bshiftdown a boolean value that records wh...
Page 127
Document object 127 description method; if the selection contains at least one path with at least one bézier point selected, moves all selected bézier points on all selected paths by the specified amount. Example the following example moves the selected bézier points 10 pixels to the right and 5 pix...
Page 128
128 objects document.Name availability flash mx 2004. Usage document.Name description read-only property; a string that represents the name of a document (fla file). Example the following example sets the variable filename to the filename of the first document in the documents array: var filename = ...
Page 129
Document object 129 description method; optimizes smoothing for the current selection, allowing multiple passes, if specified, for optimal smoothing. This method is equivalent to selecting modify > shape > optimize. Example the following example optimizes the curve of the current selection to 50º of...
Page 130
130 objects description method; publishes the document according to the active publish settings (file > publish settings). This method is equivalent to selecting file > publish. Example the following example publishes the current document: fl.Getdocumentdom().Publish(); document.Publishprofiles avai...
Page 131
Document object 131 description method; uses top selected drawing object to punch through all selected drawing objects underneath it. This method returns false if there are no drawing objects selected, or if any of the selected items are not drawing objects. Example the following example punches thr...
Page 132
132 objects document.Removedatafromselection() availability flash mx 2004. Usage document.Removedatafromselection( name ) parameters name a string that specifies the name of the persistent data to remove. Returns nothing. Description method; removes persistent data with the specified name that has b...
Page 133
Document object 133 example the following example removes all filters from the selected object(s): fl.Getdocumentdom().Removeallfilters(); see also document.Addfilter() , document.Changefilterorder() , document.Disableallfilters() , document.Getfilters() , document.Removefilter() , filter object doc...
Page 134
134 objects document.Renamepublishprofile() availability flash mx 2004. Usage document.Renamepublishprofile( [profilenewname ] ) parameters profilenewname an optional parameter that specifies the new name for the profile. The new name must be unique. If the name is not specified, a default name is p...
Page 135
Document object 135 description method; renames the currently selected scene in the scenes panel. The new name for the selected scene must be unique. Example the following example renames the current scene to "new name" : var success = fl.Getdocumentdom().Renamescene("new name"); document.Reordersce...
Page 136
136 objects document.Resettransformation() availability flash mx 2004. Usage document.Resettransformation() parameters none. Returns nothing. Description method; resets the transformation matrix. This method is equivalent to selecting modify > transform > remove transform. Example the following exam...
Page 137
Document object 137 description method; reverts the specified document to its previously saved version. This method is equivalent to selecting file > revert. Example the following example reverts the current document to the previously saved version: fl.Getdocumentdom().Revert(); see also document.Ca...
Page 138
138 objects document.Save() availability flash mx 2004. Usage document.Save( [ boktosaveas ] ) parameters boktosaveas an optional parameter that specifies whether to open the save as dialog box. Returns a boolean value: true if the save operation completes successfully; false otherwise. Description ...
Page 139
Document object 139 parameters boktosaveas an optional parameter that, if true or omitted and the file was never saved, opens the save as dialog box. If false and the file was never saved, the file is not saved. The default value is true . Returns a boolean value: true if the save-and-compact operat...
Page 140
140 objects returns nothing. Description method; scales the selection by a specified amount. This method is equivalent to using the free transform tool to scale the object. Example the following example expands the width of the current selection to double the original width and shrinks the height to...
Page 141
Document object 141 see also document.Allowscreens() , screenoutline object document.Selectall() availability flash mx 2004. Usage document.Selectall() parameters none. Returns nothing. Description method; selects all items on the stage. This method is equivalent to pressing control+a (windows) or c...
Page 142
142 objects to add objects to the array, you must first select them in one of the following ways: ■ manually select object(s) on the stage. ■ use one of the selection methods, such as document.Setselectionrect() , document.Setselectionbounds() , document.Mouseclick() , document.Mousedblclk() , or do...
Page 143
Document object 143 the following example is an advanced example. It shows how to loop through the layer array and elements array to locate instances of a particular symbol and select them. You could extend this example to include loops for multiple frames or scenes. This example assigns all instanc...
Page 144
144 objects parameters none. Returns nothing. Description method; deselects any selected items. Example the following example deselects any items that are selected: fl.Getdocumentdom().Selectnone(); see also document.Selectall() , document.Selection document.Setaligntodocument() availability flash m...
Page 145
Document object 145 example the following example enables the to stage button in the align panel to align objects with the stage: fl.Getdocumentdom().Setaligntodocument(true); see also document.Getaligntodocument() document.Setblendmode() availability flash 8. Usage document.Setblendmode( mode ) par...
Page 146
146 objects document.Setcustomfill() availability flash mx 2004. Usage document.Setcustomfill( fill ) parameters fill a fill object that specifies the fill settings to be used. See fill object . Returns nothing. Description method; sets the fill settings for the tools panel, property inspector, and ...
Page 147
Document object 147 returns nothing. Description method; sets the stroke settings for the tools panel, property inspector, and any selected shapes. This allows a script to set the stroke settings before drawing the object, rather than drawing the object, selecting it, and changing the stroke setting...
Page 148
148 objects description method; sets the specified element property on selected object(s) in the document. This method does nothing if there is no selection. Example the following example sets the width of all selected objects to 100 and the height to 50: fl.Getdocumentdom().Setelementproperty("widt...
Page 149
Document object 149 example the following examples set the fillcolor, italic, and bold text attributes for the selected text items: var success = fl.Getdocumentdom().Setelementtextattr("fillcolor", "#00ff00"); var pass = fl.Getdocumentdom().Setelementtextattr("italic", true, 10); var ok = fl.Getdocu...
Page 150
150 objects document.Setfilterproperty() availability flash 8. Usage document.Setfilterproperty( property, filterindex, value ) parameters property a string specifying the property to be set. Acceptable values are "blurx" , "blury" , "quality" , angle" , "distance" , "strength" , "knockout" , "inner...
Page 151
Document object 151 document.Setfilters() availability flash 8. Usage document.Setfilters( filterarray ) parameters filterarray the array of filters currently specified. Returns nothing. Description method; applies filters to the selected objects. Use this method after calling document.Getfilters() ...
Page 152
152 objects parameters opacity an integer between 0 (transparent) and 100 (completely saturated) that adjusts the transparency of the instance. Returns nothing. Description methods; sets the opacity of the instance. Example the following example sets the opacity of the tint to a value of 50: fl.Getd...
Page 153
Document object 153 document.Setinstancetint() availability flash mx 2004. Usage document.Setinstancetint( color , strength ) parameters color the color of the tint, in one of the following formats: ■ a string in the format "#rrggbb" or "#rrggbbaa" ■ a hexadecimal number in the format 0xrrggbb ■ an ...
Page 154
154 objects returns a boolean value: true if successful; false otherwise. Description method; sets the xml metadata for the specified document, overwriting any existing metadata. The xml passed as strmetadata is validated and may be rewritten before being stored. If it cannot be validated as legal x...
Page 155
Document object 155 in the second example, metadata is in tags, but with different schemas all in one rdf:description tag. This example also includes comments, which will be ignored and discarded by the document.Setmetadata() : simple title simple description 2004-10-12t10:29-07:00 flash authoring w...
Page 156
156 objects parameters boundingrectangle a rectangle that specifies the new location and size of the selection. For information on the format of boundingrectangle , see document.Addnewrectangle() . Bcontactsensitiveselection a boolean value that specifies whether the contact sensitive selection mode...
Page 157
Document object 157 breplacecurrentselection a boolean value that specifies whether the method replaces the current selection ( true ) or adds to the current selection ( false ). The default value is true . Bcontactsensitiveselection a boolean value that specifies whether the contact sensitive selec...
Page 158
158 objects document.Setstroke() availability flash mx 2004. Usage document.Setstroke( color , size , stroketype ) parameters color the color of the stroke, in one of the following formats: ■ a string in the format "#rrggbb" or "#rrggbbaa" ■ a hexadecimal number in the format 0xrrggbb ■ an integer t...
Page 159
Document object 159 parameters color the color of the stroke, in one of the following formats: ■ a string in the format "#rrggbb" or "#rrggbbaa" ■ a hexadecimal number in the format 0xrrggbb ■ an integer that represents the decimal equivalent of a hexadecimal number returns nothing. Description meth...
Page 160
160 objects description method; changes the stroke size of the selection to the specified size. For information on changing the stroke in the tools panel and property inspector, see document.Setcustomstroke() . Example the following example changes the stroke size for the selection to 5: fl.Getdocum...
Page 161
Document object 161 document.Settextrectangle() availability flash mx 2004. Usage document.Settextrectangle( boundingrectangle ) parameters boundingrectangle a text rectangle object that specifies the new size within which the text item should flow. For information on the format of boundingrectangle...
Page 162
162 objects document.Settextselection() availability flash mx 2004. Usage document.Settextselection( startindex, endindex ) parameters startindex an integer that specifies the position of the first character to select. The first character position is 0 (zero). Endindex an integer that specifies the ...
Page 163
Document object 163 returns a boolean value: true if the text of at least one text string is set; false otherwise. Description method; inserts a string of text. If the optional parameters are not passed, the existing text selection is replaced; if the text object isn’t currently being edited, the wh...
Page 164
164 objects ■ text: transformationpoint is set relative to the text field. 0,0 is the upper-eft corner of text field. ■ bitmaps/videos: transformationpoint is set relative to bitmap/video. 0,0 is the upper- left corner of the bitmap or video. ■ groups: transformationpoint is set relative to document...
Page 165
Document object 165 example the following example sets the issilent variable to the value of the silent property: var issilent = fl.Getdocumentdom().Silent; the following example sets the silent property to false , indicating that the document is accessible: fl.Getdocumentdom().Silent = false; docum...
Page 166
166 objects document.Smoothselection() availability flash mx 2004. Usage document.Smoothselection() parameters none. Returns nothing. Description method; smooths the curve of each selected fill outline or curved line. This method performs the same action as the smooth button in the tools panel. Exam...
Page 167
Document object 167 description method; spaces the objects in the selection evenly. Example the following example spaces the objects horizontally, relative to the stage: fl.Getdocumentdom().Space("horizontal",true); the following example spaces the objects horizontally, relative to each other: fl.Ge...
Page 168
168 objects document.Swapelement() availability flash mx 2004. Usage document.Swapelement( name ) parameters name a string that specifies the name of the library item to use. Returns nothing. Description method; swaps the current selection with the specified one. The selection must contain a graphic...
Page 169
Document object 169 example the following example swaps the stroke and fill colors in the current document: fl.Getdocumentdom().Swapstrokeandfill(); document.Testmovie() availability flash mx 2004. Usage document.Testmovie() parameters none. Returns nothing. Description method; executes a test movie...
Page 170
170 objects returns nothing. Description method; executes a test scene operation on the current scene of the document. Example the following example tests the current scene in the document: fl.Getdocumentdom().Testscene(); see also document.Cantestscene() , document.Testmovie() document.Timelines av...
Page 171
Document object 171 document.Tracebitmap() availability flash mx 2004. Usage document.Tracebitmap( threshold , minimumarea , curvefit , cornerthreshold ) parameters threshold an integer that controls the number of colors in your traced bitmap. Acceptable values are integers between 0 and 500. Minimu...
Page 172
172 objects parameters a a floating-point number that specifies the (0,0) element of the transformation matrix. B a floating-point number that specifies the (0,1) element of the transformation matrix. C a floating-point number that specifies the (1,0) element of the transformation matrix. D a floati...
Page 173
Document object 173 document.Union() availability flash 8. Usage document.Union() parameters none. Returns a boolean value: true if successful; false otherwise. Description method; combines all selected shapes into a drawing object. Example the following example combines all selected shapes into a d...
Page 174
174 objects description method; unlocks all locked elements on the currently selected frame. Example the following example unlocks all locked objects in the current frame: fl.Getdocumentdom().Unlockallelements(); see also element.Locked document.Viewmatrix availability flash mx 2004. Usage document....
Page 175
Document object 175 document.Width availability flash mx 2004. Usage document.Width description property; an integer that specifies the width of the document (stage) in pixels. Example the following example sets the width of the stage to 400 pixels. Fl.Getdocumentdom().Width= 400; see also document....
Page 176
176 objects description method; posts an xmlui dialog box. See fl.Xmlui . Example the following example loads the test.Xml file and displays each property contained within it: var obj = fl.Getdocumentdom().Xmlpanel(fl.Configuri + "commands/test.Xml"); for (var prop in obj) { fl.Trace("property " + p...
Page 177
Drawinglayer object 177 drawinglayer object availability flash mx 2004. Description the drawinglayer object is accessible from javascript as a child of the flash object. The drawinglayer object is used for extensible tools when the user wants to temporarily draw while dragging—for example, when crea...
Page 178
178 objects drawinglayer.Begindraw() availability flash mx 2004. Usage drawinglayer.Begindraw([persistentdraw]) parameters persistentdraw a boolean value (optional). If set to true , it indicates that the drawing in the last frame remains on the stage until a new begindraw() or beginframe() call is ...
Page 179
Drawinglayer object 179 description method; erases what was previously drawn using the drawinglayer and prepares for more drawing commands. Should be called after drawinglayer.Begindraw() . Everything drawn between drawinglayer.Beginframe() and an drawinglayer.Endframe() remains on the stage until y...
Page 180
180 objects drawinglayer.Curveto() availability flash mx 2004. Usage drawinglayer.Curveto(xctl , yctl , xend , yend) parameters xctl a floating-point value that is the x position of the control point. Yctl a floating-point value that is the y position of the control point. Xend a floating-point valu...
Page 181
Drawinglayer object 181 description method; draws the path specified by the path parameter. You typically use this method only when creating extensible tools. Example the following example draws a path specified by the path object named gamepath : fl.Drawinglayer.Drawpath(gamepath); drawinglayer.End...
Page 182
182 objects parameters none. Returns nothing. Description method; signals the end of a group of drawing commands. A group of drawing commands refers to everything drawn between drawinglayer.Beginframe() and drawinglayer.Endframe() . The next call to drawinglayer.Beginframe() will erase whatever was ...
Page 183
Drawinglayer object 183 drawinglayer.Moveto() availability flash mx 2004. Usage drawinglayer.Moveto(x, y) parameters x a floating-point value that specifies the x coordinate of the position at which to start drawing. Y a floating-point value that specifies the y coordinate of the position at which t...
Page 184
184 objects description method; returns a new path object. You typically use this method only when creating extensible tools. See path object . Example the following example returns a new path object: fl.Drawinglayer.Newpath(); drawinglayer.Setcolor() availability flash mx 2004. Usage drawinglayer.S...
Page 185
Edge object 185 edge object availability flash mx 2004. Description the edge object represents an edge of a shape on the stage. Method summary for the edge object the following methods are available for the edge object: property summary for the edge object the following properties are available for ...
Page 186
186 objects parameters i an integer that specifies which control point of the edge to return. Specify 0 for the first control point, 1 for the middle control point, or 2 for the end control point. If the edge.Isline property is true , the middle control point is set to the midpoint of the segment jo...
Page 187
Edge object 187 example the following example stores the half edges of the specified edge in the hedge0 and hedge1 variables: var shape = fl.Getdocumentdom().Selection[0]; var edge = shape.Edges[0]; var hedge0 = edge.Gethalfedge(0); var hedge1 = edge.Gethalfedge(1); edge.Id availability flash mx 200...
Page 188
188 objects example the following example determines whether the specified edge is a straight line, and shows a value of 1 (it is a straight line) or 0 (it isn’t a straight line) in the output panel: var shape = fl.Getdocumentdom().Selection[0]; fl.Trace(shape.Edges[0].Isline); edge.Setcontrol() ava...
Page 189
Edge object 189 edge.Splitedge() availability flash mx 2004. Usage edge.Splitedge( t ) parameters t a floating-point value between 0 and 1 that specifies where to split the edge. A value of 0 represents one end point, and 1 the other. For example, passing a value of 0.5 splits the edge in the middle...
Page 190
190 objects effect object availability flash mx 2004. Description this is a single effect descriptor object. The fl.Activeeffect and the fl.Effects properties contain this type of object. The effect object represents an instance of a timeline effect. See fl.Activeeffect and fl.Effects . Property sum...
Page 191
Effect object 191 description read-only property; a string that appears in the context menu for effects. Each effect must be uniquely named. Example the following example stores the name of the current effect in the efname variable: var efname = fl.Activeeffect.Effectname; effect.Groupname availabil...
Page 192
192 objects example the following example stores the name of the jsfl effect source file in the efsourcefile variable: var efsourcefile = fl.Activeeffect.Sourcefile ; effect.Symboltype availability flash mx 2004. Usage effect.Symboltype description read-only property; a string that specifies the typ...
Page 193
Element object 193 element object availability flash mx 2004. Description everything that appears on the stage is of the type element. The following code example lets you select an element: fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Elements[0]; method summary for the element object the f...
Page 194
194 objects element.Depth availability flash mx 2004. Usage element.Depth description read-only property; an integer that has a value greater than 0 for the depth of the object in the view. The drawing order of objects on the stage specifies which one is on top of the others. Object order can also b...
Page 195
Element object 195 element.Elementtype availability flash mx 2004. Usage element.Elementtype description read-only property; a string that represents the type of the specified element. The value is one of the following: "shape" , "text" , "instance" , or "shapeobj" . A "shapeobj" is created with an ...
Page 196
196 objects returns the data specified by the name parameter, or 0 if the data doesn’t exist. Description method; retrieves the value of the data specified by the name parameter. The type of data depends on the type of the data that was stored (see element.Setpersistentdata() ). Only symbols and bit...
Page 197
Element object 197 example see element.Getpersistentdata() . Element.Height availability flash mx 2004. Usage element.Height description property; a float value that specifies the height of the element in pixels. Example the following example sets the height of the specified element to 100: fl.Getdo...
Page 198
198 objects element.Left availability flash mx 2004. Usage element.Left description read-only property; a float value that represents the left side of the element. The value of element.Left is relative to the upper left of the stage for elements that are in a scene, and is relative to the symbol’s r...
Page 199
Element object 199 element.Matrix availability flash mx 2004. Usage element.Matrix description property; a matrix object. A matrix has properties a , b , c , d , tx , and ty . The a , b , c , and d properties are floating-point values; the tx and ty properties are coordinates. See matrix object . Ex...
Page 200
200 objects example the following example sets the instance name of the first element in frame 1, top layer to "clip_mc": fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Elements[0].Name = "clip_mc"; see the element.Elementtype example. Element.Removepersistentdata() availability flash mx 2004...
Page 201
Element object 201 example the following example selects the element: element.Selected = true; element.Setpersistentdata() availability flash mx 2004. Usage element.Setpersistentdata( name, type, value ) parameters name a string that specifies the name to associate with the data. This name is used t...
Page 202
202 objects description read-only property; top side of the element. The value of element.Top is relative to the upper left of the stage for elements that are in a scene, and is relative to the symbol’s registration point if the element is stored within a symbol. Use document.Setselectionbounds() or...
Page 203
Fill object 203 fill object availability flash mx 2004. Description this object contains all the properties of the fill color setting of the tools panel or of a selected shape. To retrieve a fill object, use document.Getcustomfill() . Property summary for the fill object the following properties are...
Page 204
204 objects fill.Color availability flash mx 2004. Usage fill.Color description property; the color of the fill, in one of the following formats: ■ a string in the format "#rrggbb" or "#rrggbbaa" ■ a hexadecimal number in the format 0xrrggbb ■ an integer that represents the decimal equivalent of a h...
Page 205
Fill object 205 fill.Focalpoint availability flash 8. Usage fill.Focalpoin description property; an integer that specifies the gradient focal point horizontal offset from the transformation point. A value of 10, for example, would place the focal point at 10/255 of the distance from the transformati...
Page 206
206 objects fill.Matrix availability flash mx 2004. Usage fill.Matrix description property; a matrix object that defines the placement, orientation, and scales for gradient fills. Fill.Overflow availability flash 8. Usage fill.Overflow description property; a string that specifies the behavior of a ...
Page 207
Fill object 207 description property; an array of integers, each in the range 0 ... 255, indicating the position of the corresponding color. This property is available only if the value of the fill.Style property is either "radialgradient" or "lineargradient" . Example the following example specifie...
Page 208
208 objects filter object availability flash 8. Description this object contains all the properties for all filters. The filter.Name property specifies the type of filter, and determines which properties are applicable to each filter. See filter.Name . To return the filter list for an object or obje...
Page 209
Filter object 209 filter.Angle availability flash 8. Usage filter.Angle description property; a float value that specifies the angle of the shadow or highlight color, in degrees. Acceptable values are between 0 and 360. This property is defined for filter objects with a value of "bevelfilter" , "dro...
Page 210
210 objects filter.Blurx availability flash 8. Usage filter.Blurx description property; a float value that specifies the amount to blur in the x direction, in pixels. Acceptable values are between 0 and 255. This property is defined for filter objects with a value of "bevelfilter" , "blurfilter" , "...
Page 211
Filter object 211 example see filter.Blurx . See also document.Setfilterproperty() , filter.Blurx filter.Brightness availability flash 8. Usage filter.Brightness description property; a float value that specifies the brightness of the filter. Acceptable values are between -100 and 100. This property...
Page 212
212 objects description property; the color of the filter, in one of the following formats: ■ a string in the format "#rrggbb" or "#rrggbbaa" ■ a hexadecimal number in the format 0xrrggbb ■ an integer that represents the decimal equivalent of a hexadecimal number this property is defined for filter ...
Page 213
Filter object 213 example the following example sets the contrast value to -15.5 for the adjust color filters on the selected object(s): var myfilters = fl.Getdocumentdom().Getfilters(); for(i=0; i if(myfilters[i].Name == 'adjustcolorfilter'){ myfilters[i].Contrast = -15.5; } } fl.Getdocumentdom().S...
Page 214
214 objects filter.Hideobject availability flash 8. Usage filter.Hideobject description property; a boolean value that specifies whether the source image is hidden ( true ) or displayed ( false ). This property is defined for filter objects with a value of "dropshadowfilter" for the filter.Name prop...
Page 215
Filter object 215 example the following example sets the highlight color to "#ff00003e" for the bevel filters on the selected object(s): var myfilters = fl.Getdocumentdom().Getfilters(); for(i=0; i if(myfilters[i].Name == 'bevelfilter'){ myfilters[i].Highlightcolor = '#ff00003e'; } } fl.Getdocumentd...
Page 216
216 objects filter.Inner availability flash 8. Usage filter.Inner description property; a boolean value that specifies whether the shadow is an inner shadow ( true ) or not ( false ). This property is defined for filter objects with a value of "dropshadowfilter" or "glowfilter" for the filter.Name p...
Page 217
Filter object 217 example the following example sets the knockout property to true for the glow filters on the selected object(s): var myfilters = fl.Getdocumentdom().Getfilters(); for(i=0; i if(myfilters[i].Name == 'glowfilter'){ myfilters[i].Knockout = true; } } fl.Getdocumentdom().Setfilters(myfi...
Page 218
218 objects filter.Quality availability flash 8. Usage filter.Quality description property; a string that specifies the blur quality. Acceptable values are "low" , "medium" , and "high" ( "high" is similar to a gaussian blur). This property is defined for filter objects with a value of "bevelfilter"...
Page 219
Filter object 219 example the following example sets the saturation value to 0 (grayscale) for the adjust color filters on the selected object(s): var myfilters = fl.Getdocumentdom().Getfilters(); for(i=0; i if(myfilters[i].Name == 'adjustcolorfilter'){ myfilters[i].Saturation = 0; } } fl.Getdocumen...
Page 220
220 objects example the following example sets the shadow color to "#ff00003e" for the bevel filters on the selected object(s): var myfilters = fl.Getdocumentdom().Getfilters(); for(i=0; i if(myfilters[i].Name == 'bevelfilter'){ myfilters[i].Shadowcolor = '#ff00003e'; } } fl.Getdocumentdom().Setfilt...
Page 221
Filter object 221 filter.Type availability flash 8. Usage filter.Type description property; a string that specifies the type of bevel or glow. Acceptable values are "inner" , "outer" , and "full" . This property is defined for filter objects with a value of "bevelfilter" , "gradientglowfilter" , or ...
Page 222
222 objects flash object (fl) availability flash mx 2004. Description the flash object represents the flash application. You can use flash or fl to refer to this object. This documentation uses fl throughout. Method summary for the flash object the following methods can be used with the flash object...
Page 223
Flash object (fl) 223 property summary for the flash object the following properties can be used with the flash object. Fl.Opendocument() opens a flash (fla) document for editing in a new flash document window and gives it the focus. Fl.Openproject() opens a flash project (flp) file in the flash aut...
Page 224
224 objects fl.Contactsensitiveselection a boolean value that specifies whether contact sensitive selection mode is enabled. Fl.Createnewdoclist read-only; an array of strings that represent the various types of documents that can be created. Fl.Createnewdoclisttype read-only; an array of strings th...
Page 225
Flash object (fl) 225 fl.Activeeffect availability flash mx 2004. Usage fl.Activeeffect description read-only property; the effect object for the current effect being applied. For a list of properties available to fl.Activeeffect , see “property summary for the effect object” on page 190 . Example t...
Page 226
226 objects description method; opens a file open or file save system dialog box and lets the user specify a file to be opened or saved. Example the following example lets the user choose a fla file to open and then opens the file. (the fl.Browseforfileurl() method can browse for any type of file, b...
Page 227
Flash object (fl) 227 example the following example lets the user select a folder and then displays a list of files in that folder. Var folderuri = fl.Browseforfolderurl("select a folder."); var foldercontents = flfile.Listfolder(folderuri); see also fl.Browseforfileurl() , flfile object fl.Closeall...
Page 228
228 objects parameters documentobject , [ bprompttosavechanges ] documentobject a document object . If documentobject refers to the active document, the document window might not close until the script that calls this method finishes executing. Bprompttosavechanges a boolean value. If it is false , ...
Page 229
Flash object (fl) 229 description method; closes the flash project (flp) file that is currently open. The following example attempts to close a project file, and displays a message indicating whether the file was successfully closed. Fl.Trace("the project was" + (fl.Closeproject() ? "closed" : "not ...
Page 230
230 objects example the following example displays the configuration directory in the output panel. Fl.Trace( "my local configuration directory is " + fl.Configdirectory ); fl.Configuri availability flash mx 2004. Usage fl.Configuri description read-only property; a string that specifies the full pa...
Page 231
Flash object (fl) 231 example the following example shows how to disable contact sensitive selection mode before making a selection, and then how to reset it to its original value after making the selection. Var contact = fl.Contactsensitiveselection; fl.Contactsensitiveselection = false; // insert ...
Page 232
232 objects fl.Createnewdoclist availability flash mx 2004. Usage fl.Createnewdoclist description read-only property; an array of strings that represent the various types of documents that can be created. Example the following example displays the types of documents that can be created in the output...
Page 233
Flash object (fl) 233 fl.Createnewtemplatelist availability flash mx 2004. Usage fl.Createnewtemplatelist description read-only property; an array of strings that represent the various types of templates that can be created. Example the following example displays the types of templates that can be c...
Page 234
234 objects description method; creates a flash project (flp) file with the specified name. If the file can’t be created, an informational dialog box is displayed. If the file already exists, a dialog box is displayed asking whether to overwrite the file. Example the following example creates a proj...
Page 235
Flash object (fl) 235 fl.Drawinglayer availability flash mx 2004. Usage fl.Drawinglayer description read-only property; the drawinglayer object that an extensible tool should use when the user wants to temporarily draw while dragging (for example, when creating a selection marquee). Example see draw...
Page 236
236 objects parameters benableupdates a boolean value that specifies whether to enable ( true ) or disable ( false ) immediate visual updates of the timeline when executing effects. Returns nothing. Description method; lets the script developer enable immediate visual updates of the timeline when ex...
Page 238
238 objects fl.Getappmemoryinfo() availability flash 8 (windows only). Usage fl.Getappmemoryinfo( memtype ) parameters memtype an integer that specifies the memory utilization area to be queried. For a list of acceptable values, see the following description. Returns an integer that represents the n...
Page 239
Flash object (fl) 239 fl.Getdocumentdom() availability flash mx 2004. Usage fl.Getdocumentdom() parameters none. Returns a document object, or null if no documents are open. Description method; retrieves the dom ( document object ) of the currently active document (fla file). If one or more document...
Page 240
240 objects description method; returns a project object that represents the currently open project. Example the following example displays the name of the currently open project in the output panel. Fl.Trace("current project: " + fl.Getproject().Name); see also fl.Createproject() , fl.Openproject()...
Page 241
Flash object (fl) 241 fl.Math availability flash mx 2004. Usage fl.Math description read-only property; the math object provides methods for matrix and point operations. Example the following shows the transformation matrix of the selected object, and its inverse. // select an element on the stage a...
Page 242
242 objects fl.Mrurecentfilelisttype availability flash mx 2004. Usage fl.Mrurecentfilelisttype description read-only property; an array of the file types in the mru list that the flash authoring tool manages. This array corresponds to the array in the fl.Mrurecentfilelist property. Example the foll...
Page 243
Flash object (fl) 243 fl.Opendocument() availability flash mx 2004. Usage fl.Opendocument( fileuri ) parameters fileuri a string, expressed as a file:/// uri, that specifies the name of the file to be opened. Returns the document object for the newly opened document, if the method is successful. If ...
Page 244
244 objects parameters fileuri a string, expressed as a file:/// uri, that specifies the path of the flash project (flp) file to open. Returns nothing in flash mx 2004; a project object in flash 8. Description method; opens a flash project (flp) file in the flash authoring tool for editing. Example ...
Page 245
Flash object (fl) 245 fl.Outputpanel availability flash mx 2004. Usage fl.Outputpanel description read-only property; reference to the outputpanel object . Example see outputpanel object . Fl.Quit() availability flash mx 2004. Usage fl.Quit( [bpromptifneeded] ) parameters bpromptifneeded a boolean v...
Page 246
246 objects example the following example illustrates quitting with and without asking to save modified documents. // quit with prompt to save any modified documents. Fl.Quit(); fl.Quit(true); // true is optional. // quit without saving any files. Fl.Quit(false); fl.Reloadeffects() availability flas...
Page 247
Flash object (fl) 247 parameters none. Returns nothing. Description method; rebuilds the tools panel from the toolconfig.Xml file. This method is used only when creating extensible tools. Use this method when you need to reload the tools panel, for example, after modifying the jsfl file that defines...
Page 248
248 objects example the following example reverts the current fla document to its last saved version; any changes made since the last save are lost. Fl.Revertdocument(fl.Getdocumentdom()); fl.Runscript() availability flash mx 2004. Usage fl.Runscript( fileuri [, funcname [, arg1, arg2, ...] ]) param...
Page 250
250 objects see also document.Save() , document.Saveandcompact() , fl.Savedocument() , fl.Savedocumentas() fl.Savedocument() availability flash mx 2004. Usage fl.Savedocument( document [, fileuri] ) parameters document a document object that specifies the document to be saved. If document is null , ...
Page 251
Flash object (fl) 251 fl.Savedocumentas() availability flash mx 2004. Usage fl.Savedocumentas( document ) parameters document a document object that specifies the document to save. If document is null , the active document is saved. Returns a boolean value: true if the save as operation completes su...
Page 252
252 objects description method; sets the active window to be the specified document. This method is also supported by dreamweaver and fireworks. If the document has multiple views (created by edit in new window), the first view is selected. Example the following example shows two ways to save a spec...
Page 253
Flash object (fl) 253 fl.Tools availability flash mx 2004. Usage fl.Tools description read-only property; an array of tools objects (see tools object ). This property is used only when creating extensible tools. Fl.Trace() availability flash mx 2004. Usage fl.Trace( message ) parameters message a st...
Page 254
254 objects example the following example displays several lines of text in the output panel: fl.Outputpanel.Clear(); fl.Trace("hello world!!!"); var mypet = "cat"; fl.Trace("i have a " + mypet); fl.Trace(""); fl.Trace("i love my " + mypet); fl.Trace("do you have a " + mypet +"?"); fl.Version avai...
Page 255
Flfile object 255 flfile object availability flash mx 2004 7.2. Description the flfile object lets you write flash extensions that can access, modify, and remove files and folders on the local file system. The flfile api is provided in the form of an extension to the javascript api. This extension i...
Page 256
256 objects method summary for the flfile object the following methods can be used with the flfile object. Flfile.Copy() availability flash mx 2004 7.2. Usage flfile.Copy( fileuri, copyuri ) method description flfile.Copy() copies a file. Flfile.Createfolder() creates one or more folders. Flfile.Exi...
Page 257
Flfile object 257 parameters fileuri a string, expressed as a file:/// uri, that specifies the file you want to copy. Copyuri a string, expressed as a file:/// uri, that specifies the location and name of the copied file. Returns a boolean value of true if successful; false otherwise. Description me...
Page 260
260 objects description method; returns a string representing the attributes of the specified file or folder, or an empty string if the file has no specific attributes (that it, it is not read-only, not hidden, and so on). You should always use flfile.Exists() to test for the existence of a file or ...
Page 261
Flfile object 261 returns a string containing a hexadecimal number that represents the number of seconds that have elapsed between january 1, 1970, and the time the file or folder was created, or "00000000" if the file or folder doesn’t exist. Description method; specifies how many seconds have pass...
Page 262
262 objects description method; returns a javascript date object that represents the date and time when the specified file or folder was created. Example the following example displays (in human-readable form) the date a file was created in the output panel: // make sure the specified file exists. V...
Page 265
Flfile object 265 flfile.Listfolder() availability flash mx 2004 7.2. Usage flfile.Listfolder( folderuri [, filesordirectories ] ) parameters folderuri a string, expressed as a file:/// uri, specifying the folder whose contents you want to retrieve. You can include a wildcard mask as part of folderu...
Page 267
Flfile object 267 flfile.Remove() availability flash mx 2004 7.2. Usage flfile.Remove( fileorfolderuri ) parameters fileorfolderuri a string, expressed as a file:/// uri, specifying the file or folder you want to remove (delete). Returns a boolean value of true if successful; false otherwise. Descri...
Page 269
Flfile object 269 if you include both r and w in strattrs , the r is ignored and the file is set as writable. Similarly, if you pass h and v , the h is ignored and the file is set as visible. If you want to make sure the archive attribute is not set, use this command with the n parameter before sett...
Page 270
270 objects returns a boolean value of true if successful; false otherwise. Description method; writes the specified string to the specified file (as utf-8). If the specified file does not exist, it is created. However, the folder in which you are placing the file must exist before you use this meth...
Page 271
Folderitem object 271 folderitem object inheritance item object > folderitem object availability flash mx 2004. Description the folderitem object is a subclass of the item object. There are no unique methods or properties of folderitem. See item object . Chapter 18 objects.
Page 272
272 objects fontitem object inheritance item object > fontitem object availability flash mx 2004. Description the fontitem object is a subclass of the item object. There are no unique methods or properties of fontitem. See item object . Chapter 19 objects.
Page 273
Frame object 273 frame object availability flash mx 2004. Description the frame object represents frames in the layer. Method summary for the frame object the following methods can be used with the frame object. Property summary for the frame object the following properties can be used with the fram...
Page 274
274 objects frame.Motiontweenrotatetimes an integer that specifies the number of times the tweened element rotates between the starting keyframe and the next keyframe. Frame.Motiontweenscale a boolean value; specifies whether the tweened element scales to the size of the object in the following keyf...
Page 275
Frame object 275 frame.Actionscript availability flash mx 2004. Usage frame.Actionscript description property; a string that represents actionscript code. To insert a new line character, use "\" . Example the following example assigns stop() to first frame top layer action: fl.Getdocumentdom().Get...
Page 276
276 objects frame.Elements availability flash mx 2004. Usage frame.Elements description read-only property; an array of element objects (see element object ). The order of elements is the order in which they are stored in the fla file. If there are multiple shapes on the stage, and each is ungrouped...
Page 277
Frame object 277 description method; returns an array of objects that represent the control points for the cubic bézier curve that defines the ease curve. Example the following example returns the custom ease value of the position property for the first frame in the top layer: var theframe = fl.Getd...
Page 278
278 objects frame.Labeltype availability flash mx 2004. Usage frame.Labeltype description property; a string that specifies the type of frame name. Acceptable values are "none" , "name" , "comment" , and "anchor" . Setting a label to "none" clears the frame.Name property. Example the following examp...
Page 279
Frame object 279 frame.Motiontweenrotate availability flash mx 2004. Usage frame.Motiontweenrotate description property; a string that specifies how the tweened element rotates. Acceptable values are "none" , "auto" , "clockwise" , and "counter-clockwise" . A value of "auto" means the object will ro...
Page 280
280 objects frame.Motiontweenscale availability flash mx 2004. Usage frame.Motiontweenscale description property; a boolean value; specifies whether the tweened element scales to the size of the object in the following keyframe, increasing its size with each frame in the tween ( true ) or doesn’t sc...
Page 281
Frame object 281 description property; a boolean value; if set to true , synchronizes the animation of the tweened object with the main timeline. Example the following example specifies that tweened object should be synchronized with the timeline: fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0...
Page 282
282 objects parameters property a string that specifies the property the ease curve should be used for. Acceptable values are "all" , "position" , "rotation" , "scale" , "color" , and "filters" . Easecurve an array of objects that defines the ease curve. Each array element must be a javascript objec...
Page 283
Frame object 283 frame.Shapetweenblend availability flash mx 2004. Usage frame.Shapetweenblend description property; a string that specifies how a shape tween is blended between the shape in the keyframe at the start of the tween and the shape in the following keyframe. Acceptable values are "distri...
Page 284
284 objects description property; a library item (see sounditem object ) used to create a sound. The sound is attached directly to the frame. Example the following example assigns the first item in the library to the soundlibraryitem property of the first frame: // the first item in the library must...
Page 285
Frame object 285 example the following example specifies that a sound should play two times: fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Soundloopmode = "repeat"; fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Soundloop = 2; frame.Soundname availability flash mx 2004. Usage frame.So...
Page 286
286 objects frame.Startframe availability flash mx 2004. Usage frame.Startframe description read-only property; the index of the first frame in a sequence. Example in the following example, stframe is the index of the first frame in the frame sequence. In this example, a frame sequence is spanning t...
Page 287
Frame object 287 example the following example specifies that the motion of the tweened object should begin fairly rapidly and decelerate toward the end of the animation: fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Tweeneasing = 50; frame.Tweentype availability flash mx 2004. Usage frame.T...
Page 288
288 objects frame.Usesingleeasecurve availability flash 8. Usage frame.Usesingleeasecurve description property; a boolean value. If true , a single custom ease curve is used for easing information for all properties. If false , each property has its own ease curve. This property is ignored if the fr...
Page 289
Halfedge object 289 halfedge object availability flash mx 2004. Description the halfedge object is the directed side of the edge of a shape object . An edge has two half edges. You can transverse the contours of a shape by “walking around” these half edges. For example, starting from a half edge, yo...
Page 290
290 objects usage halfedge.Getedge() parameters none. Returns an edge object . Description method; gets the edge object for the halfedge object. See edge object . Example the following example illustrates getting an edge and a half edge for the specified shape. Var shape = fl.Getdocumentdom().Select...
Page 291
Halfedge object 291 example the following example stores the next half edge of the specified contour in the nexthalfedge variable: var shape = fl.Getdocumentdom().Selection[0]; var hedge = shape.Edges[0].Gethalfedge( 0 ); var nexthalfedge = hedge.Getnext(); halfedge.Getoppositehalfedge() availabilit...
Page 292
292 objects returns a halfedge object. Description method; gets the preceding halfedge object on the current contour. Example the following example stores the previous half edge of the specified contour in the prevhalfedge variable: var shape = fl.Getdocumentdom().Selection[0]; var hedge = shape.Edg...
Page 293
Halfedge object 293 halfedge.Id availability flash mx 2004. Usage halfedge.Id description read-only property; a unique integer identifier for the halfedge object. Example the following example displays a unique identifier for the specified half edge in the output panel: var shape = fl.Getdocumentdom...
Page 294
294 objects instance object inheritance element object > instance object availability flash mx 2004. Description instance is a subclass of the element object . Property summary for the instance object in addition to all of the element object properties, instance has the following properties: instanc...
Page 295
Instance object 295 instance.Libraryitem availability flash mx 2004. Usage instance.Libraryitem description property; a library item used to instantiate this instance. You can change this property only to another library item of the same type (that is, you cannot set a symbol instance to refer to a ...
Page 296
296 objects item object availability flash mx 2004. Description the item object is an abstract base class. Anything in the library derives from item. See also library object . Method summary for the item object the following methods are available for the item object. Property summary for the item ob...
Page 297
Item object 297 item.Adddata() availability flash mx 2004. Usage item.Adddata( name, type, data ) parameters name a string that specifies the name of the data. Type a string that specifies the type of data. Valid types are "integer" , "integerarray" , "double" , "doublearray" , "string" , and "bytea...
Page 298
298 objects item.Getdata() availability flash mx 2004. Usage item.Getdata( name ) parameters name a string that specifies the name of the data to retrieve. Returns the data specified by the name parameter. The type of data returned depends on the type of stored data. Description method; retrieves th...
Page 299
Item object 299 example the following example shows a message in the output panel if the first item in the library contains data point named mydata: if ( fl.Getdocumentdom().Library.Items[0].Hasdata( "mydata" ) ){ fl.Trace("yep, it's there!"); } item.Itemtype availability flash mx 2004. Usage item.I...
Page 300
300 objects example the following example specifies that the actionscript 2.0 class name associated with the first item in the library is myclass: fl.Getdocumentdom().Library.Items[0].Linkageclassname = "myclass"; item.Linkageexportforas availability flash mx 2004. Usage item.Linkageexportforas desc...
Page 301
Item object 301 description property; a boolean value. If this property is true , the item is exported for runtime sharing. You can also set the item.Linkageexportforas and item.Linkageexportinfirstframe properties to true . If you set this property to true, the item.Linkageimportforrs property must...
Page 302
302 objects item.Linkageidentifier availability flash mx 2004. Usage item.Linkageidentifier description property; a string that specifies the name flash will use to identify the asset when linking to the destination swf file. Flash ignores this property if item.Linkageimportforrs , item.Linkageexpor...
Page 303
Item object 303 item.Linkageurl availability flash mx 2004. Usage item.Linkageurl description property; a string that specifies the url where the swf file containing the shared asset is located. Flash ignores this property if item.Linkageimportforrs , item.Linkageexportforas , and item.Linkageexport...
Page 304
304 objects item.Removedata() availability flash mx 2004. Usage item.Removedata( name ) parameters name s pecifies the name of the data to remove from the library item. Returns nothing. Description property; removes persistent data from the library item. Example the following example removes the dat...
Page 305
Layer object 305 layer object availability flash mx 2004. Description the layer object represents a layer in the timeline. The timeline.Layers property contains an array of layer objects, which can be accessed by fl.Getdocumentdom().Gettimeline().Layers . Property summary for the layer object the fo...
Page 306
306 objects layer.Color availability flash mx 2004. Usage layer.Color description property; the color assigned to outline the layer, in one of the following formats: ■ a string in the format "#rrggbb" or "#rrggbbaa" ■ a hexadecimal number in the format 0xrrggbb ■ an integer that represents the decim...
Page 307
Layer object 307 layer.Frames availability flash mx 2004. Usage layer.Frames description read-only property; an array of frame objects (see frame object ). Example the following example sets the variable framearray to the array of frame objects for the frames in the current document: var framearray ...
Page 308
308 objects example the following example stores the percentage value of the first layer’s height setting: var layerheight = fl.Getdocumentdom().Gettimeline().Layers[0].Height; the following example sets the height of the first layer to 300 percent: fl.Getdocumentdom().Gettimeline().Layers[0].Height...
Page 309
Layer object 309 example the following example stores the boolean value for the status of the first layer in the lockstatus variable: var lockstatus = fl.Getdocumentdom().Gettimeline().Layers[0].Locked; the following example sets the status of the first layer to unlocked: fl.Getdocumentdom().Gettime...
Page 310
310 objects layer.Parentlayer availability flash mx 2004. Usage layer.Parentlayer description property; a layer object that represents the layer’s containing folder, guiding, or masking layer. Acceptable values for the parent layer are a folder, guide, or mask layer that precedes the layer, or the p...
Page 311
Library object 311 library object availability flash mx 2004. Description the library object represents the library panel. It is a property of the document object (see document.Library ) and can be accessed by fl.Getdocumentdom().Library . The library object contains an array of items of different t...
Page 312
312 objects property summary for the library object the following property is available for the library object. Library.Additemtodocument() availability flash mx 2004. Usage library.Additemtodocument( position [, namepath] ) parameters position a point that specifies the x,y position of the center o...
Page 313
Library object 313 description method; adds the current or specified item to the stage at the specified position. Example the following example adds the currently selected item to the stage at the (3, 60) position: fl.Getdocumentdom().Library.Additemtodocument({x:3, y:60}); the following example add...
Page 314
314 objects library.Deleteitem() availability flash mx 2004. Usage library.Deleteitem( [ namepath ] ) parameters namepath a string that specifies the name of the item to be deleted. If the item is in a folder, you can specify its name and path using slash notation. If you pass a folder name, the fol...
Page 315
Library object 315 returns a boolean value: true if the item is duplicated successfully; false otherwise. If more than one item is selected, flash returns false . Description method; makes a copy of the currently selected or specified item. The new item has a default name (such as item copy ) and is...
Page 316
316 objects library.Expandfolder() availability flash mx 2004. Usage library.Expandfolder( bexpand [, brecursenestedparents [, namepath ] ] ) parameters bexpand a boolean value: if true , the folder is expanded; if false (the default), the folder is collapsed. Brecursenestedparents a boolean value: ...
Page 317
Library object 317 parameters namepath a string that specifies the name of the item. If the item is in a folder, you can specify its name and path using slash notation. Returns an integer value representing the item’s zero-based index value. Description method; returns the library item’s index value...
Page 318
318 objects library.Getitemtype() availability flash mx 2004. Usage library.Getitemtype( [ namepath ] ) parameters namepath a string that specifies the name of the item. If the item is in a folder, specify its name and path using slash notation. If namepath is not specified, flash provides the type ...
Page 319
Library object 319 example the following example stores the array of currently selected library items (in this case, several audio files) in the selitems variable and then changes the samplerate property of the first audio file in the array to "11 khz" : var selitems = fl.Getdocumentdom().Library.Ge...
Page 320
320 objects library.Itemexists() availability flash mx 2004. Usage library.Itemexists( namepath ) parameters namepath a string that specifies the name of the item. If the item is in a folder, specify its name and path using slash notation. Returns a boolean value: true if the specified item exists i...
Page 321
Library object 321 library.Movetofolder() availability flash mx 2004. Usage library.Movetofolder( folderpath [, itemtomove [, breplace ] ] ) parameters folderpath a string that specifies the path to the folder in the form "foldername" or "foldername/foldername" . To move an item to the top level, sp...
Page 322
322 objects parameters folderpath a string that specifies the name of the folder to be created. If it is specified as a path, and the path doesn’t exist, the path is created. This parameter is optional. Returns a boolean value: true if folder is created successfully; false otherwise. Description met...
Page 323
Library object 323 library.Selectall() availability flash mx 2004. Usage library.Selectall( [ bselectall ] ) parameters bselectall a boolean value that specifies whether to select or deselect all items in the library. Omit this parameter or use the default value of true to select all the items in th...
Page 324
324 objects parameters namepath a string that specifies the name of the item. If the item is in a folder, you can specify its name and path using slash notation. Breplacecurrentselection a boolean value that specifies whether to replace the current selection or add the item to the current selection....
Page 325
Library object 325 description method; deselects all the library items. Example the following examples deselect all the items in the library: fl.Getdocumentdom().Library.Selectnone(); fl.Getdocumentdom().Library.Selectall(false); library.Setitemproperty() availability flash mx 2004. Usage library.Se...
Page 326
326 objects library.Updateitem() availability flash mx 2004. Usage library.Updateitem( [ namepath ] ) parameters namepath a string that specifies the name of the item. If the item is in a folder, specify its name and path using slash notation. This is the same as right-clicking on an item and select...
Page 327
Math object 327 math object availability flash mx 2004. Description the math object is available as a read-only property of the flash object; see fl.Math . This object provides methods that perform common mathematical operations. Method summary for the math object the following methods are available...
Page 328
328 objects description method; performs a matrix concatenation and returns the result. Example the following example stores the currently selected object in the elt variable, multiplies the object matrix by the view matrix, and stores that value in the mat variable: var elt = fl.Getdocumentdom().Se...
Page 329
Math object 329 math.Pointdistance() availability flash mx 2004. Usage math.Pointdistance(pt1, pt2) parameters pt1 and pt2 specify the points between which distance is measured. Returns a floating-point value that represents the distance between the points. Description method; computes the distance ...
Page 330
330 objects matrix object availability flash mx 2004. Description the matrix object represents a transformation matrix. Property summary for the matrix object the following properties are available for the matrix object: matrix.A availability flash mx 2004. Usage matrix.A description property; a flo...
Page 331
Matrix object 331 example the a and d properties in a matrix represent scaling. In the following example, the values are set to 2 and 3, respectively, to scale the selected object to two times its width and three times its height: var mat = fl.Getdocumentdom().Selection[0].Matrix; mat.A = 2; mat.D =...
Page 332
332 objects example in the following example, you can set b and c to -1 and 0, respectively; these settings skew the object at a 45º vertical angle: var mat = fl.Getdocumentdom().Selection[0].Matrix; mat.B = -1; mat.C = 0; fl.Getdocumentdom().Selection[0].Matrix = mat; to skew the object back to its...
Page 333
Matrix object 333 matrix.Tx availability flash mx 2004. Usage matrix.Tx description property; a floating-point value that specifies the x-axis location of a symbol’s registration point or the center of a shape. It defines the x translation of the transformation. You can move an object by setting the...
Page 334
334 objects outputpanel object availability flash mx 2004. Description this object represents the output panel, which displays troubleshooting information such as syntax errors. To access this object, use fl.Outputpanel (or flash.Outputpanel ). See fl.Outputpanel . Method summary for the outputpanel...
Page 335
Outputpanel object 335 example the following example clears the current contents of the output panel: fl.Outputpanel.Clear(); outputpanel.Save() availability flash mx 2004; busesystemencoding parameter added in flash 8. Usage outputpanel.Save(fileuri [, bappendtofile [ , busesystemencoding ] ]) para...
Page 336
336 objects outputpanel.Trace() availability flash mx 2004. Usage outputpanel.Trace(message) parameters the message parameter is a string that contains the text to add to the output panel. Returns nothing. Description method; sends a text string to the output panel, terminated by a new line, and dis...
Page 337
Parameter object 337 parameter object availability flash mx 2004. Description the parameter object type is accessed from the screen.Parameters array (which corresponds to the screen property inspector in the flash authoring tool) or by the componentinstance.Parameters array (which corresponds to the...
Page 338
338 objects parameter.Category availability flash mx 2004. Usage parameter.Category description property; a string that specifies the category property for the screen parameter or componentinstance parameter. This property provides an alternative way of presenting a list of parameters. This function...
Page 339
Parameter object 339 description method; inserts an item in a list, object, or array. If a parameter is a list, object, or array, the value property is an array. Example the following example inserts the value of "new value" into the labelplacement parameter: // select an instance of a button compon...
Page 340
340 objects parameter.Name availability flash mx 2004. Usage parameter.Name description read-only property; a string that specifies the name of the parameter. Example the following example shows the name of the fifth parameter for the selected component: var parms = fl.Getdocumentdom().Selection[0]....
Page 341
Parameter object 341 example the following example removes the element at index 1 from the labelplacement parameter of a component: // select an instance of a button component on the stage. Var parms = fl.Getdocumentdom().Selection[0].Parameters; var values = parms[2].Value; fl.Trace("--original--")...
Page 342
342 objects description property; corresponds to the value field in the parameters tab of the component inspector, the parameters tab of the property inspector, or the screen property inspector. The type of the value property is determined by the valuetype property for the parameter (see parameter.V...
Page 343
Path object 343 path object availability flash mx 2004. Description the path object defines a sequence of line segments (straight, curved, or both), which you typically use when creating extensible tools. The following example shows an instance of a path object being returned from the flash object: ...
Page 344
344 objects path.Addcubiccurve() availability flash mx 2004. Usage path.Addcubiccurve(xanchor, yanchor, x2, y2, x3, y3, x4, y4) parameters xanchor a floating-point number that specifies the x position of the first control point. Yanchor a floating-point number that specifies the y position of the fi...
Page 345
Path object 345 parameters xanchor a floating-point value that specifies the x position of the first control point. Yanchor a floating-point value that specifies the y position of the first control point. X2 a floating-point value that specifies the x position of the second control point. Y2 a float...
Page 346
346 objects description method; adds a point to the path. Example the following example creates a new path, stores it in the mypath variable, and assigns the new point to the path: var mypath = fl.Drawinglayer.Newpath(); mypath.Addpoint(10, 100); path.Clear() availability flash mx 2004. Usage path.C...
Page 347
Path object 347 returns nothing. Description method; appends a point at the location of the first point of the path and extends the path to that point, which closes the path. If the path has no points, no points are added. Example the following example creates a closed path: var mypath = fl.Drawingl...
Page 348
348 objects path.Newcontour() availability flash mx 2004. Usage path.Newcontour() parameters none. Returns nothing. Description method; starts a new contour in the path. Example the following example creates a hollow square: var mypath = fl.Drawinglayer.Newpath(); mypath.Addpoint( 0, 0); mypath.Addp...
Page 349
Path object 349 path.Npts availability flash mx 2004. Usage path.Npts description read-only property; an integer representing the number of points in the path. A new path has 0 points. Example the following example uses the output panel to show the number of points in the path referenced by the mypa...
Page 350
350 objects project object availability flash 8. Description the project object represents a flash project (flp) file. You can use the following commands to return a project object: ■ to create a new project file, use fl.Createproject() . ■ to open an existing project file, use fl.Openproject() . ■ ...
Page 351
Project object 351 project.Addfile() availability flash 8. Usage project.Addfile( fileuri [ , autocreatefolder ] ) parameters fileuri a string specifying the file to be added to the project, expressed as a file:/// uri. Autocreatefolder an optional boolean value specifying if folders should be autom...
Page 352
352 objects example the following example illustrates several ways to use this command. In this case, the open project file is in the c:\projects directory, and the only files currently in the project have been added at the root level. // get the project object var myproject = fl.Getproject(); // th...
Page 353
Project object 353 returns a boolean value specifying whether the project can be published. Description method; determines whether the project can be published. A project can be published if it contains at least one fla file. Example the following example displays a message in the output panel if th...
Page 354
354 objects example the following example displays a message in the output panel if the project cannot be tested: if (!Fl.Getproject().Cantestproject()) { fl.Trace("project cannot be tested!"); } see also fl.Getproject() , project.Testproject() , projectitem.Cantest() project.Defaultitem availabilit...
Page 355
Project object 355 project.Findprojectitem() availability flash 8. Usage project.Findprojectitem( fileuri ) parameters fileuri a string specifying the file to search for in the project, expressed as a file:/// uri. Returns a projectitem object for the item if successful; otherwise, returns false . S...
Page 356
356 objects example the following example displays the names of all the items in the project in the output panel: for (i = 0; i fl.Trace(fl.Getproject().Items[i].Displayname); } see also fl.Getproject() , projectitem object project.Name availability flash 8. Usage project.Name description property; ...
Page 357
Project object 357 example the following example displays the path and name of the currently open project file in the output panel: fl.Trace("project is located at: " + fl.Getproject().Projecturi); see also fl.Getproject() , project.Name project.Publishproject() availability flash 8. Usage project.P...
Page 358
358 objects project.Testproject() availability flash 8. Usage project.Testproject() parameters none. Returns a boolean value indicating if the project was successfully tested. Description method; tests the project. A project must have a default document to be tested. Example the following example te...
Page 359
Projectitem object 359 projectitem object availability flash 8. Description the projectitem object represents an item (file on disk) that has been added to a project. This object is a property of the project object (see project.Items ). You can use the following commands to return a projectitem obje...
Page 360
360 objects projectitem.Canpublish() availability flash 8. Usage projectitem.Canpublish() parameters none. Returns a boolean value specifying whether a project item can be published. Description method; determines whether an item can be published. An item can be published only if it is a fla file. E...
Page 361
Projectitem object 361 returns a boolean value specifying whether a project item can be tested. Description method; determines whether an item can be tested. An item can be tested if it is a fla or html file. Example the following example displays a message in the output panel if the first item in t...
Page 362
362 objects projectitem.Ismissing availability flash 8. Usage projectitem.Ismissing description read-only property; a boolean value that specifies whether a file is missing from the disk (for example, if the item has been moved, deleted or renamed). Example the following example displays a message i...
Page 363
Projectitem object 363 example the following example displays the path and name of each item in the project in the output panel. Files = fl.Getproject().Items; for (i = 0; i fl.Trace(files[i].Itemuri); } see also fl.Getproject() , projectitem.Displayname , project.Items projectitem.Publish() availab...
Page 364
364 objects projectitem.Publishprofile availability flash 8. Usage projectitem.Publishprofile description property; a string that specifies the publish profile to use when publishing a project item (fla file). The publish profile must be an existing profile in the item, or a subsequent call to proje...
Page 365
Projectitem object 365 projectitem.Test() availability flash 8. Usage projectitem.Test() parameters none. Returns a boolean value that indicates whether the item was successfully tested or not. Descriptionn method; tests a project item. If the test operation fails because the item is not a fla or ht...
Page 366
366 objects screen object availability flash mx 2004. Description the screen object represents a single screen in a slide or form document. This object contains properties related to the slide or form. For access to the array of all screen objects in the document, use the following code: fl.Getdocum...
Page 367
Screen object 367 screen.Accname availability flash mx 2004. Usage screen.Accname description property; a string that is equivalent to the name field in the accessibility panel. Screen readers identify objects by reading the name aloud. Example the following example stores the value of the name of t...
Page 368
368 objects example the following example checks to see if the current document is a slide or form, and if it is, stores the array of child screens in the mychildren variable and displays their names in the output panel: var mychildren = new array(); if(fl.Getdocumentdom().Allowscreens) { var mypare...
Page 369
Screen object 369 screen.Forcesimple availability flash mx 2004. Usage screen.Forcesimple description property; a boolean value that enables or disables accessibility for the object’s children. This is equivalent to the inverse logic of the make child objects accessible setting in the accessibility ...
Page 370
370 objects example the following example checks to see if the first screen in the outline is hidden and changes the visibility of the screen accordingly. Then, a message in the output panel shows what the visibility of the screen was before the change: if (fl.Getdocumentdom().Screenoutline.Screens[...
Page 371
Screen object 371 screen.Name availability flash mx 2004. Usage screen.Name description read-only property; a string that represents the name of the screen. Example the following example checks to see if the current document allows screens (because it is a slide or form document). Then, it assigns t...
Page 372
372 objects example the following example first checks to see if the current document is a slide or form, and if it is, retrieves and shows the sequence of screens in the output panel: if(fl.Getdocumentdom().Allowscreens) { var mycurrent = fl.Getdocumentdom().Screenoutline.Rootscreen.Childscreens[0]...
Page 373
Screen object 373 screen.Parentscreen availability flash mx 2004. Usage screen.Parentscreen description read-only property; an object that represents the parent screen. If parentscreen is null , the screen is a top-level screen. Example the following example stores the values for the childscreens an...
Page 374
374 objects example the following example checks to see if the current document is a slide or form, and if it is, retrieves and shows the sequence of screens in the output panel: if(fl.Getdocumentdom().Allowscreens) { var mycurrent = fl.Getdocumentdom().Screenoutline.Rootscreen.Childscreens[1].Name;...
Page 375
Screen object 375 screen.Tabindex availability flash mx 2004. Usage screen.Tabindex description property; equivalent to the tab index field in the accessibility panel. This value lets you determine the order in which objects are accessed when the user presses the tab key. Example the following examp...
Page 376
376 objects screenoutline object availability flash mx 2004. Description the screenoutline object represents the group of screens in a slide or form document. The object is accessed by using fl.Getdocumentdom().Screenoutline. The screenoutline object exists only if the document is a slide or form do...
Page 377
Screenoutline object 377 property summary for the screenoutline object you can use the following properties with the screenoutline object: screenoutline.Copyscreenfromfile() availability flash mx 2004. Usage screenoutline.Copyscreenfromfile( fileuri [, screenname] ) parameters fileuri a string, expr...
Page 378
378 objects description method; inserts all the screens, or a named screen and its children, from a specified document under the currently selected screen. If more than one screen is selected, the screen(s) are inserted under the last selected screen, as its sibling. Example the following example co...
Page 379
Screenoutline object 379 returns nothing. Description method; deletes the currently selected screen(s), or a specified screen, and the children of the screen(s). Example the following example removes the screen named apple and all its children: fl.Getdocumentdom().Screenoutline.Deletescreen("apple")...
Page 380
380 objects screenoutline.Getselectedscreens() availability flash mx 2004. Usage screenoutline.Getselectedscreens() parameters none. Returns an array of selected screen objects (see screen object ). Description method; returns an array of screen objects that are currently selected in the screen outl...
Page 381
Screenoutline object 381 parameters name a string indicating the name of the new screen to insert. An empty name will insert a screen with a default screen name, such as slide n or form n (where n is the first available unique number). This parameter is optional. Referencescreen a string indicating ...
Page 382
382 objects parameters name a string indicating the name of the new screen to insert. If this parameter is omitted, the method inserts a screen with a default screen name, such as slide n or form n (where n is the first available unique number). This parameter is optional. Referencescreen a string i...
Page 383
Screenoutline object 383 parameters screentomove a string that is the screen name to move. Referencescreen a string that specifies the screen near which screentomove will be placed. Position a string that specifies where to move the screen in relation to referencescreen . Acceptable values are "befo...
Page 384
384 objects description method; changes the screen with a specified name to a new name. Example the following example changes the name of slide1 to intro: fl.Getdocumentdom().Screenoutline.Renamescreen("intro", "slide1"); screenoutline.Rootscreen availability flash mx 2004. Usage screenoutline.Roots...
Page 385
Screenoutline object 385 example the following example stores the array of screen objects in the myarray variable and then displays their names in the output panel: var myarray = new array(); if(fl.Getdocumentdom().Allowscreens) { for(var i in fl.Getdocumentdom().Screenoutline.Screens) { myarray.Pus...
Page 386
386 objects screenoutline.Setscreenproperty() availability flash mx 2004. Usage screenoutline.Setscreenproperty( property, value ) parameters property a string that specifies the property to set. Value the new value for the property. The type of value depends on the property being set. For a list of...
Page 387
Screenoutline object 387 screenoutline.Setselectedscreens() availability flash mx 2004. Usage screenoutline.Setselectedscreens ( selection [, breplacecurrentselection ] ) parameters selection an array of screen names to be selected in the screen outline. Breplacecurrentselection a boolean value that...
Page 388
388 objects shape object inheritance element object > shape object availability flash mx 2004. Description the shape object is a subclass of the element object. The shape object provides more precise control than the drawing apis when manipulating or creating geometry on the stage. This control is n...
Page 389
Shape object 389 shape.Beginedit() availability flash mx 2004. Usage shape.Beginedit() parameters none. Returns nothing. Description method; defines the start of an edit session. You must use this method before issuing any commands that change the shape object or any of its subordinate parts. Exampl...
Page 390
390 objects example the following example stores the first contour in the contours array in the c variable and then stores the halfedge object of that contour in the he variable: var c = fl.Getdocumentdom().Selection[0].Contours[0]; var he = c.Gethalfedge(); shape.Deleteedge() availability flash mx ...
Page 391
Shape object 391 description read-only property; an array of edge objects (see edge object ). Shape.Endedit() availability flash mx 2004. Usage shape.Endedit() parameters none. Returns nothing. Description method; defines the end of an edit session for the shape. All changes made to the shape object...
Page 392
392 objects example the following example stores the first selected item object in the sel variable and then uses the element.Elementtype and shape.Isdrawingobject properties to determine if the selected item is a drawing object. Var sel = fl.Getdocumentdom().Selection[0]; var shapedrawingobject = (...
Page 393
Shape object 393 shape.Vertices availability flash mx 2004. Usage shape.Vertices description read-only property; an array of vertex objects (see vertex object ). Example the following example stores the first selected item object in the someshape variable and then shows the number of vertices for th...
Page 394
394 objects sounditem object inheritance item object > sounditem object availability flash mx 2004. Description the sounditem object is a subclass of the item object. It represents a library item used to create a sound. See also frame.Soundlibraryitem and item object . Property summary for the sound...
Page 395
Sounditem object 395 description property; a string that specifies the bit rate of a sound in the library. This property is available only for the mp3 compression type. Acceptable values are "8 kbps" , "16 kbps" , "20 kbps" , "24 kbps" , "32 kbps" , "48 kbps" , "56 kbps" , "64 kbps" , "80 kbps" , "1...
Page 396
396 objects sounditem.Compressiontype availability flash mx 2004. Usage sounditem.Compressiontype description property; a string that specifies that compression type for a sound in the library. Acceptable values are "default" , "adpcm" , "mp3" , "raw" , and "speech" . Example the following example c...
Page 397
Sounditem object 397 example the following example converts an item in the library to mono, only if the item has mp3 or raw compression type: fl.Getdocumentdom().Library.Items[0].Convertstereotomono = true; see also sounditem.Compressiontype sounditem.Quality availability flash mx 2004. Usage soundi...
Page 398
398 objects description property; a string that specifies the sample rate for the audio clip. This property is available only for adpcm, raw, and speech compression types. Acceptable values are "5 khz" , "11 khz" , "22 khz" , and "44 khz" . Example the following example sets the sample rate of an it...
Page 399
Stroke object 399 stroke object availability flash mx 2004. Description the stroke object contains all the settings for a stroke, including the custom settings. This object represents the information contained in the property inspector. Using the stroke object together with the document.Setcustomstr...
Page 400
400 objects stroke.Breakatcorners availability flash mx 2004. Usage stroke.Breakatcorners description property; a boolean value. This property is the same as the sharp corners setting in the custom stroke style dialog box. Stroke.Jiggle a string that specifies the jiggle property of a hatched line. ...
Page 401
Stroke object 401 example the following example sets the breakatcorners property to true : var mystroke = fl.Getdocumentdom().Getcustomstroke(); mystroke.Breakatcorners = true; fl.Getdocumentdom().Setcustomstroke( mystroke ); stroke.Captype availability flash 8. Usage stroke.Captype description prop...
Page 402
402 objects example the following example sets the stroke color: var mystroke = fl.Getdocumentdom().Getcustomstroke(); mystroke.Color = "#000000"; fl.Getdocumentdom().Setcustomstroke( mystroke ); stroke.Curve availability flash mx 2004. Usage stroke.Curve description property; a string that specifie...
Page 403
Stroke object 403 description property; an integer that specifies the lengths of the solid parts of a dashed line. This property is available only if the stroke.Style property is set to "dashed" (see stroke.Style ). Example the following example sets the dash1 and dash2 properties for a stroke style...
Page 404
404 objects example the following example sets the density property to "sparse" for the stroke style of stipple : var mystroke = fl.Getdocumentdom().Getcustomstroke(); mystroke.Style = "stipple"; mystroke.Dotspace= 3; mystroke.Variation = "random sizes"; mystroke.Density = "sparse"; fl.Getdocumentdo...
Page 405
Stroke object 405 example the following example sets the dotspace property to 3 for a stroke style of dotted : var mystroke = fl.Getdocumentdom().Getcustomstroke(); mystroke.Style = "dotted"; mystroke.Dotspace= 3; fl.Getdocumentdom().Setcustomstroke( mystroke ); stroke.Hatchthickness availability fl...
Page 406
406 objects description property; a string that specifies the jiggle property of a hatched line. This property is available only if the stroke.Style property is set to "hatched" (see stroke.Style ). Acceptable values are "none" , "bounce" , "loose" , and "wild" . Example the following example sets t...
Page 407
Stroke object 407 description property; a string that specifies the length of a hatch line. This property is available only if the stroke.Style property is set to "hatched" (see stroke.Style ). Acceptable values are "equal" , "slight" , "variation" , "medium variation" , and "random" . Example the f...
Page 408
408 objects stroke.Pattern availability flash mx 2004. Usage stroke.Pattern description property; a string that specifies the pattern of a ragged line. This property is available only if the stroke.Style property is set to "ragged" (see stroke.Style ). Acceptable values are "solid" , "simple" , "ran...
Page 409
Stroke object 409 example the following example sets the rotate property to "free" for a style stroke of hatched : var mystroke = fl.Getdocumentdom().Getcustomstroke(); mystroke.Style = "hatched"; mystroke.Curve = "straight"; mystroke.Space = "close"; mystroke.Jiggle = "wild"; mystroke.Rotate = "fre...
Page 410
410 objects var fill = fl.Getdocumentdom().Getcustomfill(); fill.Lineargradient = true; fill.Colorarray = [ 00ff00, ff0000, fffff ]; var stroke = fl.Getdocumentdom().Getcustomstroke(); stroke.Shapefill = fill; fl.Getdocumentdom().Setcustomstroke(stroke); stroke.Space availability flash mx 2004. Usag...
Page 411
Stroke object 411 example the following example enables stroke hinting for the stroke: var mystroke = fl.Getdocumentdom().Getcustomstroke(); mystroke.Strokehinting = true; fl.Getdocumentdom().Setcustomstroke(mystroke); stroke.Style availability flash mx 2004. Usage stroke.Style description property;...
Page 412
412 objects usage stroke.Thickness description property; an integer that specifies the stroke size. Example the following example sets the thickness property of the stroke to a value of 2 : var mystroke = fl.Getdocumentdom().Getcustomstroke(); mystroke.Thickness = 2; fl.Getdocumentdom().Setcustomstr...
Page 413
Stroke object 413 description property; a string that specifies the wave height of a ragged line. This property is available only if the stroke.Style property is set to "ragged" (see stroke.Style ). Acceptable values are "flat" , "wavy" , "very wavy" , and "wild" . Example the following example sets...
Page 414
414 objects symbolinstance object inheritance element object > instance object > symbolinstance object availability flash mx 2004. Description symbolinstance is a subclass of the instance object and represents a symbol in a frame (see instance object ). Property summary for the symbolinstance object...
Page 415
Symbolinstance object 415 symbolinstance.Colorbluepercent an integer that is part of the color transformation for the instance; equivalent to using the color > advanced setting in the instance property inspector (the percentage controls on the left of the dialog box). Symbolinstance.Colorgreenamount...
Page 416
416 objects symbolinstance.Accname availability flash mx 2004. Usage symbolinstance.Accname description property; a string that is equivalent to the name field in the accessibility panel. Screen readers identify objects by reading the name aloud. This property is not available for graphic symbols. E...
Page 417
Symbolinstance object 417 symbolinstance.Actionscript availability flash mx 2004. Usage symbolinstance.Actionscript description property; a string that specifies the actions assigned to the symbol. This applies only to movie clip and button instances. For a graphic symbol instance, the value returns...
Page 418
418 objects symbolinstance.Buttontracking availability flash mx 2004. Usage symbolinstance.Buttontracking description property; a string that, for button symbols only, sets the same property as the pop-up menu for track as button or track as menu item in the property inspector. For other types of sy...
Page 419
Symbolinstance object 419 symbolinstance.Coloralphaamount availability flash mx 2004. Usage symbolinstance.Coloralphaamount description property; an integer that is part of the color transformation for the instance, specifying the advanced effect alpha settings. This property is equivalent to using ...
Page 420
420 objects symbolinstance.Colorblueamount availability flash mx 2004. Usage symbolinstance.Colorblueamount description property; an integer that is part of the color transformation for the instance. This property is equivalent to using the color > advanced setting in the instance property inspector...
Page 421
Symbolinstance object 421 description property; an integer that is part of the color transformation for the instance. This property is equivalent to using the color > advanced setting in the instance property inspector. Allowable values are from -255 to 255. Symbolinstance.Colorgreenpercent availabi...
Page 422
422 objects example the following example changes the colormode property of the first element in the first frame of the first layer in the timeline to "alpha" : fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Elements[0].Colormode = "alpha"; symbolinstance.Colorredamount availability flash mx ...
Page 423
Symbolinstance object 423 symbolinstance.Description availability flash mx 2004. Usage symbolinstance.Description description property; a string that is equivalent to the description field in the accessibility panel. The description is read by the screen reader. This property is not available for gr...
Page 424
424 objects example the following example traces the name of the filter at index 0. If it is a glow filter, its blurx property is set to 100 and the new value is written to the filters array. Var filtername = fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Elements[0].Filter s[0].Name; fl.Trac...
Page 425
Symbolinstance object 425 symbolinstance.Forcesimple availability flash mx 2004. Usage symbolinstance.Forcesimple description property; a boolean value that enables and disables the accessibility of the object’s children. This property is equivalent to the inverse logic of the make child objects acc...
Page 426
426 objects example the following example sets the first symbol in the first frame of the first layer in the timeline to single frame (display one specified frame of the graphic timeline), as long as that symbol is a graphic: fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Elements[0].Loop = '...
Page 427
Symbolinstance object 427 description property; a boolean value that enables or disables the accessibility of the object. This property is equivalent to the inverse logic of the make object accessible setting in the accessibility panel. For example, if silent is true , it is the same as the make obj...
Page 428
428 objects symbolinstance.Tabindex availability flash mx 2004. Usage symbolinstance.Tabindex description property; an integer that is equivalent to the tab index field in the accessibility panel. Creates a tab order in which objects are accessed when the user presses the tab key. This property is n...
Page 429
Symbolitem object 429 symbolitem object inheritance item object > symbolitem object availability flash mx 2004. Description the symbolitem object is a subclass of the item object . Method summary for the symbolitem object in addition to the item object methods, you can use the following methods with...
Page 430
430 objects symbolitem.Converttocompiledclip() availability flash mx 2004. Usage symbolitem.Converttocompiledclip() parameters none. Returns nothing. Description method; converts a symbol item in the library to a compiled movie clip. Example the following example converts an item in the library to a...
Page 432
432 objects symbolitem.Scalinggrid availability flash 8. Usage symbolitem.Scalinggrid description property; a boolean value that specifies whether 9-slice scaling is enabled for the item. Example the following example enables 9-slice scaling for an item in the library: fl.Getdocumentdom().Library.It...
Page 433
Symbolitem object 433 symbolitem.Sourceautoupdate availability flash mx 2004. Usage symbolitem.Sourceautoupdate description property; a boolean value that specifies whether the item is updated when the fla file is published. The default value is false . Used for shared library symbols. Example the f...
Page 434
434 objects symbolitem.Sourcelibraryname availability flash mx 2004. Usage symbolitem.Sourcelibraryname description property; a string that specifies the name of the item in the source file library. It is used for shared library symbols. Example the following example shows the value of the sourcelib...
Page 435
Symbolitem object 435 symbolitem.Timeline availability flash mx 2004. Usage symbolitem.Timeline description read-only property; a timeline object . Example the following example obtains and shows the number of layers that the selected movie clip in the library contains: var tl = fl.Getdocumentdom()....
Page 436
436 objects text object inheritance element object > text object availability flash mx 2004. Description the text object represents a single text item in a document. All properties of the text pertain to the entire text block. To set properties of a text run within the text field, see “property summ...
Page 437
Text object 437 property summary for the text object in addition to the element object properties, the following properties are available for the text object: property description text.Accname a string that is equivalent to the name field in the accessibility panel. Text.Antialiassharpness a float v...
Page 438
438 objects text.Antialiassharpness availability flash 8. Usage text.Antialiassharpness description property; a float value that specifies the anti-aliasing sharpness of the text. This property controls how crisply the text is drawn; higher values specify sharper (or crisper) text. A value of 0 spec...
Page 439
Text object 439 text.Antialiasthickness availability flash 8. Usage text.Antialiasthickness description property; a float value that specifies the anti-aliasing thickness of the text. This property controls how thickly the text is drawn, with higher values specifying thicker text. A value of 0 speci...
Page 440
440 objects text.Autoexpand availability flash mx 2004. Usage text.Autoexpand description property; a boolean value. For static text fields, a value of true causes the bounding width to expand to show all text. For dynamic or input text fields, a value of true causes the bounding width and height to...
Page 441
Text object 441 description property; a string that is equivalent to the description field in the accessibility panel. The description is read by the screen reader. Example the following example retrieves the description of the object: var thedescription = fl.Getdocumentdom().Gettimeline().Layers[0]...
Page 442
442 objects description property; a string that consists of delimited integers that correspond to the items that can be selected in the character options dialog box. This property works only with dynamic or input text; it is ignored if used with static text. Example the following example sets the em...
Page 443
Text object 443 example the following example shows how you can use the customthicknesssharpness value to specify the sharpness and thickness of the text: fl.Getdocumentdom().Setelementproperty("fontrenderingmode", "customthicknesssharpness"); fl.Getdocumentdom().Setelementproperty("antialiassharpne...
Page 444
444 objects description method; retrieves the attribute specified by the attrname parameter for the text identified by the optional startindex and endindex parameters. If the attribute is not consistent for the specified range, flash returns undefined . If you omit the optional parameters startindex...
Page 445
Text object 445 description method; retrieves the specified range of text. If you omit the optional parameters startindex and endindex , the whole text string is returned. If you specify only startindex , the method returns the string starting at the index location and ending at the end of the field...
Page 446
446 objects description property; a string that sets the line type. Acceptable values are "single line" , "multiline" , "multiline no wrap" , and "password" . This property works only with dynamic or input text and generates a warning if used with static text. The "password" value works only for inp...
Page 447
Text object 447 description property; a string that specifies the orientation of the text field. Acceptable values are "horizontal" , "vertical left to right" , and "vertical right to left" . This property works only with static text; it generates a warning if used with other text types. Example the...
Page 448
448 objects description property; a boolean value. If the value is true , the text can be scrolled. This property works only with dynamic or input text; it generates a warning if used with static text. Example the following example sets the scrollable property to false : fl.Getdocumentdom().Selectio...
Page 449
Text object 449 text.Selectionstart availability flash mx 2004. Usage text.Selectionstart description property; a zero-based integer that specifies the beginning of a text subselection. You can use this property with text.Selectionend to select a range of characters. Characters up to, but not includ...
Page 450
450 objects parameters attrname a string that specifies the name of the textattrs object property to change. Attrvalue the value for the textattrs object property. Startindex an integer that is the index (zero-based) of the first character in the array. This parameter is optional. Endindex an intege...
Page 451
Text object 451 text.Settextstring() availability flash mx 2004. Usage text.Settextstring(text [, startindex [, endindex]]) parameters text a string that consists of the characters to be inserted into this text object. Startindex an integer that specifies the index (zero-based) of the character in t...
Page 452
452 objects text.Shortcut availability flash mx 2004. Usage text.Shortcut description property; a string that is equivalent to the shortcut field in the accessibility panel. The shortcut is read by the screen reader. This property cannot be used with dynamic text. Example the following example gets ...
Page 453
Text object 453 example the following example determines if the object is accessible (a value of false means that it is accessible): var issilent = fl.Getdocumentdom().Gettimeline().Layers[0].Frames[0].Elements[0].Silent ; the following example sets the object to be accessible: fl.Getdocumentdom().G...
Page 454
454 objects example the following example stores the value of the textruns property in the mytextruns variable: var mytextruns = fl.Getdocumentdom().Selection[0].Textruns; text.Texttype availability flash mx 2004. Usage text.Texttype description property; a string that specifies the type of text fie...
Page 455
Text object 455 text.Variablename availability flash mx 2004. Usage text.Variablename description property; a string that contains the name of the variable associated with the text object. This property works only with dynamic or input text; it generates a warning if used with other text types..
Page 456
456 objects textattrs object availability flash mx 2004. Description the textattrs object contains all the properties of text that can be applied to a subselection. This object is a property of the textrun object ( textrun.Textattrs ). Property summary for the textattrs object the following properti...
Page 457
Textattrs object 457 textattrs.Aliastext availability flash mx 2004. Usage textattrs.Aliastext description property; a boolean value that specifies that flash should draw the text using a method optimized for increasing the legibility of small text. Example the following example sets the aliastext p...
Page 458
458 objects description property; a string that specifies paragraph justification. Acceptable values are "left" , "center" , "right" , and "justify" . Example the following example sets the paragraphs that contain characters between index 0 up to, but not including, index 3 to justify. This can affe...
Page 459
Textattrs object 459 description property; a boolean value. A value of true causes text to appear with the bold version of the font. Example the following example selects the first character of the selected text object and sets the bold property to true : fl.Getdocumentdom().Settextselection(0, 1); ...
Page 460
460 objects description property; an integer that represents the space between characters. Acceptable values are -60 through 60. This property applies only to static text; it generates a warning if used with other text types. Example the following example sets the character spacing of the selected t...
Page 461
Textattrs object 461 example the following example sets the color of the selected text field from the character at index 2 up to, but not including, the character at index 8 to red: fl.Getdocumentdom().Selection[0].Settextattr("fillcolor", 0xff0000, 2, 8); textattrs.Indent availability flash mx 2004...
Page 462
462 objects textattrs.Leftmargin availability flash mx 2004. Usage textattrs.Leftmargin description property; an integer that specifies the paragraph’s left margin. Acceptable values are 0 through 720. Example the following example sets the leftmargin property of the selected text field from the cha...
Page 463
Textattrs object 463 textattrs.Linespacing availability flash mx 2004. Usage textattrs.Linespacing description property; an integer that specifies the line spacing (leading) of the paragraph. Acceptable values are -360 through 720. Example the following example sets the selected text field’s linespa...
Page 464
464 objects textattrs.Rotation availability flash mx 2004. Usage textattrs.Rotation description property; a boolean value. A value of true causes flash to rotate the characters of the text 90º. The default value is false . This property applies only to static text with a vertical orientation; it gen...
Page 465
Textattrs object 465 textattrs.Target availability flash mx 2004. Usage textattrs.Target description property; a string that represents the target property of the text field. This property works only with static text. Example the following example gets the target property of the text field in the fi...
Page 466
466 objects textrun object availability flash mx 2004. Description the textrun object represents a run of characters that have attributes that match all of the properties in the textattrs object . This object is a property of the text object ( text.Textruns ). Property summary for the textrun object...
Page 467
Textrun object 467 textrun.Textattrs availability flash mx 2004. Usage textrun.Textattrs description property; the textattrs object containing the attributes of the run of text. Example the following example displays the properties of the first run of characters in the selected text field in the out...
Page 468
468 objects timeline object availability flash mx 2004. Description the timeline object represents the flash timeline, which can be accessed for the current document by using fl.Getdocumentdom().Gettimeline() . This method returns the timeline of the current scene or symbol that is being edited. Whe...
Page 469
Timeline object 469 timeline.Createmotiontween() sets the frame.Tweentype property to motion for each selected keyframe on the current layer, and converts each frame’s contents to a single symbol instance if necessary. Timeline.Cutframes() cuts a range of frames on the current layer from the timelin...
Page 470
470 objects property summary for the timeline object the following methods are available for the timeline object. Timeline.Addmotionguide() availability flash mx 2004. Usage timeline.Addmotionguide() parameters none. Timeline.Setselectedframes() selects a range of frames in the current layer or sets...
Page 471
Timeline object 471 returns an integer that represents the zero-based index of the newly added guide layer. If the current layer type is not of type “normal”, flash returns -1. Description method; adds a motion guide layer above the current layer and attaches the current layer to the newly added gui...
Page 472
472 objects example the following example adds a new layer to the timeline with a default name generated by flash: fl.Getdocumentdom().Gettimeline().Addnewlayer(); the following example adds a new folder layer on top of the current layer and names it "folder1" : fl.Getdocumentdom().Gettimeline().Add...
Page 473
Timeline object 473 timeline.Clearkeyframes() availability flash mx 2004. Usage timeline.Clearkeyframes([startframeindex [, endframeindex]]) parameters startframeindex a zero-based index that defines the beginning of the range of frames to clear. If you omit startframeindex , the method uses the cur...
Page 474
474 objects parameters startframeindex a zero-based index that specifies the starting frame to convert to keyframes. If you omit startframeindex , the method converts the currently selected frames. This parameter is optional. Endframeindex a zero-based index that specifies the frame at which the con...
Page 475
Timeline object 475 returns nothing. Description method; converts a range of frames to keyframes (or converts the selection if no frames are specified) on the current layer. Example the following example converts the selected frames to keyframes: fl.Getdocumentdom().Gettimeline().Converttokeyframes(...
Page 476
476 objects description method; copies a range of frames on the current layer to the clipboard. Example the following example copies the selected frames to the clipboard: fl.Getdocumentdom().Gettimeline().Copyframes(); the following example copies frame 2 up to, but not including, frame 10, to the c...
Page 477
Timeline object 477 example the following example converts the shape in the first frame up to, but not including, frame 10 to a graphic symbol instance and sets the frame.Tweentype to motion (remember that index values are different from frame number values): fl.Getdocumentdom().Gettimeline().Create...
Page 478
478 objects example the following example makes the top layer active: fl.Getdocumentdom().Gettimeline().Currentlayer = 0; the following example stores the index of the currently active layer in the curlayer variable: var curlayer = fl.Getdocumentdom().Gettimeline().Currentlayer; timeline.Cutframes()...
Page 479
Timeline object 479 example the following example cuts the selected frames from the timeline and saves them to the clipboard: fl.Getdocumentdom().Gettimeline().Cutframes(); the following example cuts frame 2 up to, but not including, frame 10 from the timeline and saves them to the clipboard (rememb...
Page 480
480 objects timeline.Expandfolder() availability flash mx 2004. Usage timeline.Expandfolder(bexpand [, brecursenestedparents [, index]]) parameters bexpand a boolean value that, if set to true , causes the method to expand the folder; false causes the method to collapse the folder. Brecursenestedpar...
Page 481
Timeline object 481 timeline.Findlayerindex() availability flash mx 2004. Usage timeline.Findlayerindex(name) parameters name a string that specifies the name of the layer to find. Returns an array of index values for the specified layer. If the specified layer is not found, flash returns undefined ...
Page 482
482 objects description read-only property; an integer that represents the number of frames in this timeline’s longest layer. Example the following example uses a countnum variable to store the number of frames in the current document’s longest layer: var countnum = fl.Getdocumentdom().Gettimeline()...
Page 483
Timeline object 483 example the following example retrieves the name of the first frame in the current document’s top layer and displays the name in the output panel: fl.Getdocumentdom().Gettimeline().Currentlayer = 0; fl.Getdocumentdom().Gettimeline().Setselectedframes(0, 0, true); var framename = ...
Page 484
484 objects returns an array containing 3n integers, where n is the number of selected regions. The first integer in each group is the layer index, the second integer is the start frame of the beginning of the selection, and the third integer specifies the ending frame of that selection range. The e...
Page 485
Timeline object 485 see also timeline.Setselectedlayers() timeline.Insertblankkeyframe() availability flash mx 2004. Usage timeline.Insertblankkeyframe([framenumindex]) parameters framenumindex a zero-based index that specifies the frame at which to insert the keyframe. If you omit framenumindex , t...
Page 486
486 objects timeline.Insertframes() availability flash mx 2004. Usage timeline.Insertframes([numframes [, balllayers [, framenumindex]]]) parameters numframes an integer that specifies the number of frames to insert. If you omit this parameter, the method inserts frames at the current selection in t...
Page 487
Timeline object 487 if the specified or selected frame is a regular frame, the frame is inserted at that frame. For example, if you have a span of 10 frames numbered 1-10 and you select frame 5 (or pass a value of 4 for frameindex ), this method adds a frame at frame 5, and the length of the frame s...
Page 488
488 objects description method; inserts a keyframe at the specified frame. If you omit the parameter, the method inserts a keyframe using the playhead or selection location. This method works the same as timeline.Insertblankkeyframe() except that the inserted keyframe contains the contents of the fr...
Page 489
Timeline object 489 description read-only property; an array of layer objects. Example the following example uses the currentlayers variable to store the array of layer objects in the current document: var currentlayers = fl.Getdocumentdom().Gettimeline().Layers; timeline.Name availability flash mx ...
Page 490
490 objects parameters startframeindex a zero-based index that specifies the beginning of a range of frames to paste. If you omit startframeindex , the method uses the current selection. This parameter is optional. Endframeindex a zero-based index that specifies the frame at which to stop pasting fr...
Page 491
Timeline object 491 parameters startframeindex a zero-based index that specifies the first frame at which to start removing frames. If you omit startframeindex , the method uses the current selection; if there is no selection, all frames at the current playhead on all layers are removed. This parame...
Page 492
492 objects parameters layertomove a zero-based index that specifies which layer to move. Layertoputitby a zero-based index that specifies which layer you want to move the layer next to. For example, if you specify 1 for layertomove and 0 for layertoputitby , the second layer is placed next to the f...
Page 493
Timeline object 493 returns nothing. Description method; reverses a range of frames. Example the following example reverses the positions of the currently selected frames: fl.Getdocumentdom().Gettimeline().Reverseframes(); the following example reverses frames from frame 10 up to, but not including,...
Page 494
494 objects timeline.Setframeproperty() availability flash mx 2004. Usage timeline.Setframeproperty(property, value [, startframeindex [, endframeindex]]) parameters property a string that specifies the name of the property to be modified. For a complete list of properties and values, see “property ...
Page 495
Timeline object 495 example the following example assigns the actionscript stop() command to the first frame of the top layer in the current document: fl.Getdocumentdom().Gettimeline().Currentlayer = 0; fl.Getdocumentdom().Gettimeline().Setselectedframes(0,0,true); fl.Getdocumentdom().Gettimeline()....
Page 496
496 objects example the following example makes the selected layer(s) invisible: fl.Getdocumentdom().Gettimeline().Setlayerproperty("visible", false); the following example sets the name of the selected layer(s) to "sellayer" : fl.Getdocumentdom().Gettimeline().Setlayerproperty("name", "sellayer"); ...
Page 497
Timeline object 497 the following example first stores the array of selected frames in the savedselectionlist variable, and then uses the array later in the code to reselect those frames after a command or user interaction has changed the selection: var savedselectionlist = fl.Getdocumentdom().Getti...
Page 498
498 objects example the following example selects the top layer: fl.Getdocumentdom().Gettimeline().Setselectedlayers(0); the following example adds the next layer to the selection: fl.Getdocumentdom().Gettimeline().Setselectedlayers(1, false); see also timeline.Getselectedlayers() timeline.Showlayer...
Page 499
Toolobj object 499 toolobj object availability flash mx 2004. Description a toolobj object represents an individual tool in the tools panel. To access a toolobj object, use properties of the tools object : either the tools.Toolobjs array or tools.Activetool . Method summary for the toolobj object th...
Page 500
500 objects property summary for the toolobj object the following property is available for the toolobj object: toolobj.Depth availability flash mx 2004. Usage toolobj.Depth description read-only property; an integer that specifies the depth of the tool in the pop-up menu in the tools panel. This pr...
Page 501
Toolobj object 501 parameters control a string that specifies the name of the control to enable or disable. Legal values depend on the property inspector invoked by this tool (see toolobj.Setpi() ). A shape property inspector has the following controls: a text property inspector has the following co...
Page 502
502 objects toolobj.Iconid availability flash mx 2004. Usage toolobj.Iconid description read-only property; an integer with a value of -1. This property is used only when you create extensible tools. An iconid value of -1 means that flash will not try find an icon for the tool. Instead, the script f...
Page 503
Toolobj object 503 toolobj.Seticon() availability flash mx 2004. Usage toolobj.Seticon( file ) parameters file a string that specifies the name of the png file to use as the icon. The png file must be placed in the same folder as the jsfl file. Returns nothing. Description method; identifies a png f...
Page 504
504 objects description method; sets the string that appears in the pop-up menu as the name for the tool. This method is used only when you create extensible tools. Example the following example specifies that the tool named thetool should display the name “polystar tool” in its pop-up menu. This co...
Page 505
Toolobj object 505 for example, the polystar.Xml file specifies three options associated with the polygon tool: variable="style" list="polygon,star" defaultvalue="0" type="strings" /> variable="nsides" min="3" max="32" defaultvalue="5" type="number" /> variable="pointparam" min="0" max="1" defaultva...
Page 506
506 objects description method; specifies which property inspector should be used when the tool is activated. This method is used only when you create extensible tools. Acceptable values are "shape" (the default), "text" , and "movie" . Example the following example specifies that the shape property...
Page 507
Toolobj object 507 toolobj.Settooltip() availability flash mx 2004. Usage toolobj.Settooltip( tooltip ) parameters tooltip a string that specifies the tooltip to use for the tool. Returns nothing. Description method; sets the tooltip that appears when the mouse is held over the tool icon. This metho...
Page 508
508 objects a text property inspector has the following controls: the movie property inspector has the following controls: bshow a boolean value that determines whether to show or hide the specified control ( true shows the control; false hides the control). Returns nothing. Description method; show...
Page 509
Toolobj object 509 toolobj.Showtransformhandles() availability flash mx 2004. Usage toolobj.Showtransformhandles( bshow ) parameters bshow a boolean value that determines whether to show or hide the free transform handles for the current tool ( true shows the handles; false hides them). Returns noth...
Page 510
510 objects tools object availability flash mx 2004. Description the tools object is accessible from the flash object ( fl.Tools ). The tools.Toolobjs property contains an array of toolobj objects, and the tools.Activetool property returns the toolobj object for the currently active tool. (see also ...
Page 511
Tools object 511 tools.Activetool availability flash mx 2004. Usage tools.Activetool description read-only property; returns the toolobj object for the currently active tool. Example the following example saves an object that represents the currently active tool in the thetool variable. Var thetool ...
Page 512
512 objects description read-only property; a boolean value that identifies if the alt key is being pressed. The value is true if the alt key is pressed, and false otherwise. Example the following example determines whether the alt key is being pressed. Var isaltdown = fl.Tools.Altisdown; tools.Cons...
Page 513
Tools object 513 tools.Ctlisdown availability flash mx 2004. Usage tools.Ctlisdown description read-only property; a boolean value that is true if the control key is pressed; false otherwise. Example the following example determines whether the control key is being pressed. Var isctrldown = fl.Tools...
Page 514
514 objects tools.Mouseisdown availability flash mx 2004. Usage tools.Mouseisdown description read-only property; a boolean value that is true if the left mouse button is currently down; false otherwise. Example the following example determines whether the left mouse button is pressed. Var ismousedo...
Page 515
Tools object 515 tools.Penloc availability flash mx 2004. Usage tools.Penloc description read-only property; a point that represents the current location of the mouse pointer. The tools.Penloc property comprises two properties, x and y , corresponding to the x,y location of the mouse pointer. Exampl...
Page 516
516 objects returns nothing. Description method; sets the pointer to a specified appearance. Example the following example sets the pointer to a black arrow. Fl.Tools.Setcursor(1); tools.Shiftisdown availability flash mx 2004. Usage tools.Shiftisdown description read-only property; a boolean value t...
Page 517
Tools object 517 returns a new point that may be adjusted or snapped to the nearest geometric object. Description method; takes a point as input and returns a new point that may be adjusted or snapped to the nearest geometric object. If snapping is disabled in the view menu in the flash user interfa...
Page 518
518 objects vertex object availability flash mx 2004. Description the vertex object is the part of the shape data structure that holds the coordinate data. Method summary for the vertex object you can use the following methods with the vertex object. Property summary for the vertex object the follow...
Page 519
Vertex object 519 description method; gets a halfedge object that shares this vertex. Example the following example shows how to get other half edges that share the same vertex. Var shape = fl.Getdocumentdom().Selection[0]; var hedge = shape.Edges[0].Gethalfedge(0); var thevertex = hedge.Getvertex()...
Page 520
520 objects vertex.X availability flash mx 2004. Usage vertex.X description read-only property; the x location of the vertex in pixels. Example the following example displays the location of the x and y values of the vertex in the output panel. Var shape = fl.Getdocumentdom().Selection[0]; var hedge...
Page 521
Xmlui object 521 xmlui object availability flash mx 2004. Description flash 8 supports custom dialog boxes written in a subset of the xml user interface language (xul). An xml user interface (xmlui) dialog box can be used by several flash features, such as commands and behaviors, to provide a user i...
Page 522
522 objects xmlui.Accept() availability flash mx 2004. Usage xmlui.Accept() parameters none. Returns nothing. Description method; closes the current xmlui dialog box with an accept state, which is equivalent to the user clicking the ok button. See also fl.Xmlui , document.Xmlpanel() , xmlui.Cancel()...
Page 523
Xmlui object 523 description method; closes the current xmlui dialog box with a cancel state, which is equivalent to the user clicking the cancel button. See also fl.Xmlui , document.Xmlpanel() , xmlui.Accept() xmlui.Get() availability flash mx 2004. Usage xmlui.Get( controlpropertyname ) parameters...
Page 524
524 objects parameters controlpropertyname a string that specifies the property whose control item element you want to retrieve. Returns an object that represents the current control item for the control specified by controlpropertyname . Description method; returns the label and value of the line s...
Page 525
Xmlui object 525 example the following example returns a value that indicates whether the control with the id attribute mylistbox is enabled: var isenabled = fl.Xmlui.Getenabled("mylistbox"); fl.Trace(isenabled); see also fl.Xmlui , document.Xmlpanel() , xmlui.Setenabled() xmlui.Getvisible() availab...
Page 526
526 objects xmlui.Set() availability flash mx 2004. Usage xmlui.Set( controlpropertyname, value ) parameters controlpropertyname a string that specifies the name of xmlui property to modify. Value a string that specifies the value to which you want to set the xmlui property. Returns nothing. Descrip...
Page 527
Xmlui object 527 returns nothing. Description method; sets the label and value of the currently selected line in the listbox or combobox control specified by controlpropertyname . Example the following example sets the label and value for the current item of the control property named "phonenumber" ...
Page 528
528 objects example the following example sets the label and value of items in the the control with the id attribute mycontrolid to the label , value pairs specified: var namearray = new array("january", "february", "march"); var montharray = new array(); for (i=0;i elem = new object(); elem.Label =...
Page 529
Xmlui object 529 xmlui.Setvisible() availability flash 8. Usage xmlui.Setvisible(controlid, visible) parameters controlid a string that specifies the id attribute of the control you want to show or hide. Visible a boolean value of true if you want to show the control; false if you want to hide it. R...
Page 530
530 objects videoitem object inheritance item object > videoitem object availability flash mx 2004. Description the videoitem object is a subclass of the item object . Property summary for the videoitem object in addition to the item object properties, you can use the following properties with the v...
Page 531
Videoitem object 531 example the following example displays the name and source file path of any items in the library that are of type "video" : for ( idx in fl.Getdocumentdom().Library.Items ) { if ( fl.Getdocumentdom().Library.Items[idx].Itemtype == "video" ) { var myitem = fl.Getdocumentdom().Lib...
Page 532
532 objects.
Page 533
533 3 chapter 3 c-level extensibility the c-level extensibility mechanism lets you implement macromedia flash extensibility files using a combination of javascript and custom c code. You define functions using c, bundle them in a dynamic linked library (dll) or a shared library, save the library in ...
Page 534
534 c-level extensibility integrating c functions the c-level extensibility mechanism lets you implement flash extensibility files using a combination of javascript and c code. The process for implementing this capability is summarized in the following steps: 1. Define functions using the c or c++ l...
Page 535
Integrating c functions 535 to get a copy of the mm_jsapi.H file, extract it from the sample zip or sit file (see “sample dll implementation” on page 540 ), or copy the following code into a file that you name mm_jsapi.H: #ifndef _mm_jsapi_h_ #define _mm_jsapi_h_ / **********************************...
Page 536
536 c-level extensibility (mmenv.Valuetostring ? (*(mmenv.Valuetostring))(c, v, l) : (unsigned short *)0) /* unsigned char *js_valuetobytes(jscontext *cx, jsval v, unsigned int *plength) */ #define js_valuetobytes(c, v, l) \ (mmenv.Valuetobytes ? (*(mmenv.Valuetobytes))(c, v, l) : (unsigned char *)0...
Page 537
Integrating c functions 537 (mmenv.Objecttype ? (*(mmenv.Objecttype))(o) : (unsigned short *)0) /* jsobject *js_newarrayobject(jscontext *cx, unsigned int length, jsval *v) */ #define js_newarrayobject(c, l, v) \ (mmenv.Newarrayobject ? (*(mmenv.Newarrayobject))(c, l, v) : (jsobject *)0) /* long js_...
Page 538
538 c-level extensibility unsigned short *(*valuetostring)(jscontext *cx, jsval v, unsigned int *plength); unsigned char *(*valuetobytes)(jscontext *cx, jsval v, unsigned int *plength); jsbool (*valuetointeger)(jscontext *cx, jsval v, long *lp); jsbool (*valuetodouble)(jscontext *cx, jsval v, double...
Page 539
Integrating c functions 539 /* definitions of global variables */ \ mm_environment mmenv; \ \ void \ mm_initwrapper(mm_environment *env, unsigned int envsize) \ { \ extern void mm_init(); \ \ char **envptr = (char **)env; \ char **mmptr = (char **)(&mmenv); \ char **envend = (char **)((char *)envptr...
Page 540
540 c-level extensibility sample dll implementation a sample dll implementation is located in zip and sit files in the extendingflash/ dllsamplecomputesum folder (see “sample implementations” on page 19 ). To see how the process works without actually building the dll, you can do the following: ■ st...
Page 541
Data types 541 after writing this code, build the dll file or shared library, and store it in the appropriate external libraries directory (see “integrating c functions” on page 534 ). Then create a jsfl file with the following code, and store it in the commands directory (see “saving jsfl files” on...
Page 542
542 c-level extensibility typedef enum { js_false = 0, js_true = 1 } jsbool a simple data type that stores a boolean value. The c-level api the c-level extensibility api consists of the jsbool (*jsnative) function signature and the following functions: ■ jsbool js_definefunction() ■ unsigned short *...
Page 543
The c-level api 543 typedef jsbool (*jsnative)(jscontext *cx, jsobject *obj, unsigned int argc, jsval *argv, jsval *rval) description method; describes c-level implementations of javascript functions in the following situations: ■ the cx pointer is a pointer to an opaque jscontext structure, which m...
Page 544
544 c-level extensibility arguments unsigned short *name , jsnative call , unsigned int nargs ■ the name argument is the name of the function as it is exposed to javascript. ■ the call argument is a pointer to a c-level function. The function must return a jsbool , which indicates success or failure...
Page 545
The c-level api 545 jsbool js_valuetointeger() usage jsbool js_valuetointeger(jscontext *cx, jsval v, long *lp); description method; extracts a function argument from a jsval structure, converts it to an integer (if possible), and passes the converted value back to the caller. Arguments jscontext *c...
Page 546
546 c-level extensibility jsbool js_valuetoboolean() usage jsbool js_valuetoboolean(jscontext *cx, jsval v, jsbool *bp); description method; extracts a function argument from a jsval structure, converts it to a boolean value (if possible), and passes the converted value back to the caller. Arguments...
Page 547
The c-level api 547 jsbool js_stringtovalue() usage jsbool js_stringtovalue(jscontext *cx, unsigned short *bytes, uint sz, jsval *vp); description method; stores a string return value in a jsval structure. It allocates a new javascript string object. Arguments jscontext *cx , unsigned short *bytes ,...
Page 548
548 c-level extensibility returns a boolean value: js_true indicates success; js_false indicates failure. Jsval js_booleantovalue() usage jsval js_booleantovalue(jsbool bv); description method; stores a boolean return value in a jsval structure. Arguments jsbool bv ■ the bv argument is a boolean val...
Page 549
The c-level api 549 jsval js_integertovalue() usage jsval js_integertovalue(long lv); description method; converts a long integer value to jsval structure. Arguments lv ■ the lv argument is the long integer value that you want to convert to a jsval structure. Returns a jsval structure that contains ...
Page 550
550 c-level extensibility unsigned short *js_objecttype() usage unsigned short *js_objecttype(jsobject *obj); description method; given an object reference, returns the class name of the object. For example, if the object is a dom object, the function returns " document ". If the object is a node in...
Page 551
The c-level api 551 arguments jscontext *cx , unsigned int length , jsval *v ■ the cx argument is the opaque jscontext pointer that passes to the javascript function. ■ the length argument is the number of elements that the array can hold. ■ the v argument is an optional pointer to the jsvals to be ...
Page 552
552 c-level extensibility jsbool js_getelement() usage jsbool js_getelement(jscontext *cx, jsobject *obj, jsint idx, jsval *vp) description method; reads a single element of an array object. Arguments jscontext *cx , jsobject *obj , unsigned int index , jsval *v ■ the cx argument is the opaque jscon...
Page 553
The c-level api 553 returns a boolean value: js_true indicates success; js_false indicates failure. Jsbool js_executescript() usage js_executescript (jscontext *cx, jsobject *obj, unsigned short *script, unsigned int sz, jsval *rval) description method; compiles and executes a javascript string. If ...
Page 554
554 c-level extensibility.