background image

344

Chapter 3:  Objects

timeline.reverseFrames()

Availability

Flash MX 2004.

Usage

timeline.reverseFrames([

startFrameIndex

 [, 

endFrameIndex

]])

Parameters

startFrameIndex

  A zero-based index that specifies the first frame at which to start reversing 

frames. If you omit 

startFrameIndex

, the method uses the current selection. This parameter is 

optional.

endFrameIndex

  A zero-based index that specifies the first frame at which to stop reversing 

frames; the range of frames goes up to, but does not include, 

endFrameIndex

. If you specify only 

startFrameIndex

endFrameIndex

 defaults to the value of 

startFrameIndex

. This parameter is 

optional.

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, Frame 15 
(remember that index values are different from frame number values):

fl.getDocumentDOM().getTimeline().reverseFrames(9, 14);

timeline.selectAllFrames()

Availability

Flash MX 2004.

Usage

timeline.selectAllFrames()

Parameters

None. 

Returns 

Nothing. 

Description

Method; selects all the frames in the current Timeline. 

Summary of Contents for FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY

Page 1: ...Flash JavaScript Dictionary ...

Page 2: ...this guide then you do so at your own risk Macromedia provides these links only as a convenience and the inclusion of the link does not imply that Macromedia endorses or accepts any responsibility for the content on those third party sites Speech compression and decompression technology licensed from Nellymoser Inc www nellymoser com Sorenson Spark video compression and decompression technology li...

Page 3: ...pInstance setBits 45 bitmapInstance vPixels 45 BitmapItem object 47 bitmapItem allowSmoothing 47 bitmapItem compressionType 48 bitmapItem quality 48 bitmapItem useImportedJPEGQuality 48 CompiledClipInstance object 50 compiledClipInstance accName 50 compiledClipInstance actionScript 51 compiledClipInstance description 51 compiledClipInstance forceSimple 52 compiledClipInstance shortcut 52 compiledC...

Page 4: ...document canRevert 75 document canTestMovie 75 document canTestScene 76 document clipCopy 76 document clipCut 77 document clipPaste 77 document close 78 document convertLinesToFills 78 document convertToSymbol 79 document currentPublishProfile 80 document currentTimeline 80 document deletePublishProfile 81 document deleteScene 81 document deleteSelection 82 document description 82 document distrib...

Page 5: ...name 103 document optimizeCurves 103 document path 104 document publish 104 document publishProfiles 105 document removeDataFromDocument 105 document removeDataFromSelection 106 document renamePublishProfile 106 document renameScene 107 document reorderScene 107 document resetTransformation 108 document revert 108 document rotateSelection 109 document save 109 document saveAndCompact 110 document ...

Page 6: ...estMovie 130 document testScene 130 document timelines 131 document traceBitmap 131 document transformSelection 132 document unGroup 132 document unlockAllElements 133 document viewMatrix 133 document width 134 document xmlPanel 134 drawingLayer object 135 drawingLayer beginDraw 135 drawingLayer beginFrame 136 drawingLayer cubicCurveTo 137 drawingLayer curveTo 137 drawingLayer drawPath 138 drawing...

Page 7: ...width 156 EmbeddedVideoInstance object 157 Fill object 158 fill color 158 fill colorArray 159 fill matrix 159 fill posArray 159 fill style 160 flash object 161 fl activeEffect 163 fl browseForFileURL 163 fl closeAll 164 fl closeDocument 164 fl componentsPanel 165 fl configDirectory 165 fl configURI 166 fl createDocument 166 fl createNewDocList 167 fl createNewDocListType 167 fl createNewTemplateLi...

Page 8: ... 186 frame elements 187 frame labelType 187 frame motionTweenOrientToPath 188 frame motionTweenRotate 188 frame motionTweenRotateTimes 189 frame motionTweenScale 189 frame motionTweenSnap 189 frame motionTweenSync 190 frame name 190 frame shapeTweenBlend 190 frame soundEffect 191 frame soundLibraryItem 191 frame soundLoop 191 frame soundLoopMode 192 frame soundName 192 frame soundSync 193 frame st...

Page 9: ...09 layer height 210 layer layerType 210 layer locked 210 layer name 211 layer outline 211 layer parentLayer 212 layer visible 212 library object 213 library addItemToDocument 214 library addNewItem 215 library deleteItem 215 library duplicateItem 216 library editItem 216 library expandFolder 217 library findItemIndex 218 library getItemProperty 218 library getItemType 219 library getSelectedItems ...

Page 10: ...istIndex 238 parameter name 239 parameter removeItem 239 parameter value 240 parameter valueType 241 parameter verbose 241 Path object 242 path addCubicCurve 242 path addCurve 243 path addPoint 244 path clear 244 path close 245 path makeShape 245 path newContour 246 path nPts 247 Screen object 248 screen accName 249 screen childScreens 249 screen description 250 screen forceSimple 250 screen hidde...

Page 11: ...reens 264 Shape object 266 shape beginEdit 266 shape contours 267 shape deleteEdge 267 shape edges 268 shape endEdit 268 shape isGroup 269 shape vertices 269 SoundItem object 270 soundItem bitRate 270 soundItem bits 271 soundItem compressionType 271 soundItem convertStereoToMono 272 soundItem quality 272 soundItem sampleRate 272 soundItem useImportedMP3Quality 273 Stroke object 274 stroke breakAtC...

Page 12: ...bolInstance forceSimple 291 symbolInstance loop 291 symbolInstance shortcut 292 symbolInstance silent 292 symbolInstance symbolType 293 symbolInstance tabIndex 293 SymbolItem object 294 symbolItem convertToCompiledClip 294 symbolItem exportSWC 295 symbolItem exportSWF 295 symbolItem sourceAutoUpdate 296 symbolItem sourceFilePath 296 symbolItem sourceLibraryName 297 symbolItem symbolType 297 symbol...

Page 13: ...TextString 317 text shortcut 318 text silent 319 text tabIndex 319 text textRuns 320 text textType 320 text useDeviceFonts 320 text variableName 321 TextRun object 322 textRun characters 322 textRun textAttrs 322 Timeline object 324 timeline addMotionGuide 326 timeline addNewLayer 326 timeline clearFrames 327 timeline clearKeyframes 328 timeline convertToBlankKeyframes 328 timeline convertToKeyfra...

Page 14: ...tSelectedLayers 347 timeline showLayerMasking 348 ToolObj object 349 toolObj enablePIControl 350 toolObj position 351 toolObj setIcon 351 toolObj setMenuString 352 toolObj setOptionsFile 352 toolObj setPI 353 toolObj setToolName 353 toolObj setToolTip 354 toolObj showPIControl 354 toolObj showTransformHandles 355 Tools object 356 tools activeTool 357 tools altIsDown 357 tools constrainPoint 357 to...

Page 15: ...neFunction 377 unsigned short JS_ValueToString 378 JSBool JS_ValueToInteger 378 JSBool JS_ValueToDouble 379 JSBool JS_ValueToBoolean 379 JSBool JS_ValueToObject 380 JSBool JS_StringToValue 380 JSBool JS_DoubleToValue 381 JSVal JS_BooleanToValue 381 JSVal JS_BytesToValue 381 JSVal JS_IntegerToValue 382 JSVal JS_ObjectToValue 382 unsigned short JS_ObjectType 382 JSObject JS_NewArrayObject 383 long J...

Page 16: ...16 Contents ...

Page 17: ...ipts to perform actions in the Macromedia Flash Player environment that is while a SWF file is playing The Flash JavaScript API JSAPI lets you write scripts to perform several actions in the Flash authoring environment that is while a user has the Flash program open You can write scripts that act like commands and scripts that add tools to the Tools panel These scripts can be used to help automate...

Page 18: ...guration Tools Windows 98 C Windows Application Data Macromedia Flash MX 2004 language Configuration Tools Mac OS X Hard Drive Users userName Library Application Support Macromedia Flash MX 2004 language Configuration Tools If a JSFL file has other files that go with it such as XML files they should be stored in the same directory as the JSFL file You can also create a JSFL file by selecting one o...

Page 19: ...sed to specify different options for the method The JavaScript interpreter in Flash is the Mozilla SpiderMonkey engine version 1 5 which is available on the web at http www mozilla org js spidermonkey SpiderMonkey is one of the two reference implementations of the JavaScript language developed by Mozilla org It is the same engine that is embedded in the Mozilla browser SpiderMonkey implements the ...

Page 20: ...ss componentsPanel object Use fl componentsPanel to access the componentsPanel object This object corresponds to the Components panel in the Flash authoring environment Document object Use fl documents to retrieve an array of all the open documents use fl documents index to access a particular document use fl getDocumentDOM to access the current document the one with focus drawingLayer object Use ...

Page 21: ...ubles the size of the current selection because no particular object is specified fl getDocumentDOM scaleSelection 2 2 In some cases you might want an action to specifically target the currently selected item in the Flash document To do this use the array that the Document selection property contains The first element in the array represents the currently selected item as shown in the following ex...

Page 22: ...Fill object 03 Stroke object 03 library object 04 Item object library items array 04 BitmapItem object subclass of Item object 04 folderItem object subclass of Item object 04 fontItem object subclass of Item object 04 SoundItem object subclass of Item object 04 SymbolItem object subclass of Item object 04 VideoItem object subclass of Item object 03 Timeline object document timelines array 04 Layer...

Page 23: ...de are doing Read this file to gain a better understanding of how the JSAPI can be used Flash MX 2004 includes an earlier version of the PolyStar jsfl script that must be removed in order to use the updated PolyStar jsfl file To remove the earlier version of the PolyStar jsfl that was installed with Flash MX 2004 1 Select Edit Customize Tools Panel Windows or Flash Customize Tools Panel Macintosh ...

Page 24: ... Edit Customize Tools Panel Windows or Flash Customize Tools Panel Macintosh You should see PolyStar tool in the available tools list 4 Click the Rectangle tool at the left side of the Customize Tools Panel dialog box The Rectangle Tool should appear in the Current Selection list at the right side of the dialog box 5 Select the PolyStar tool from the Available Tools list 6 Click Add 7 Click OK The...

Page 25: ...s that are available when creating extensible tools The following list shows the functions in alphabetical order activate configureEffect configureTool deactivate executeEffect keyDown keyUp mouseDoubleClick mouseDown mouseMove mouseUp notifySettingsChanged removeEffect setCursor ...

Page 26: ...te statements Parameters None Returns Nothing Description This function is called when the extensible tool becomes active that is when the tool is selected in the Tools panel Any setup the tool needs to do should be performed in this function Example function activate fl trace Tool is active ...

Page 27: ...gureEffect statements Parameters None Returns Nothing Description This function is called once at load time of Flash and is a good place for global initialization of your effect The per instance parameter data for an effect cannot be accessed here See also executeEffect removeEffect ...

Page 28: ...tool Example The following examples show two possible implementations of this function function configureTool theTool fl tools activeTool theTool setToolName myTool theTool setIcon myTool png theTool setMenuString My Tool s menu string theTool setToolTip my tool s tool tip theTool setOptionsFile mtTool xml function configureTool theTool fl tools activeTool theTool setToolName ellipse theTool setIc...

Page 29: ...nts Parameters None Returns Nothing Description This function is called when the tool becomes inactive that is when the active tool changes from this tool to another one Use this function to perform any cleanup the tool needs Example function deactivate fl trace Tool is no longer active ...

Page 30: ... function is called when the user first applies an effect or changes an effect s properties The code contained in this function is responsible for modifying the original object s to accomplish the desired effect It is also responsible for copying the original to another hidden layer if necessary for the removeEffect function See also configureEffect removeEffect ...

Page 31: ...atements Parameters None Returns Nothing Description This function is called when the tool is active and the user presses a key The script should call tools getKeyDown to determine which key was pressed Example function keyDown fl trace key fl tools getKeyDown was pressed ...

Page 32: ...ons keyUp Availability Flash MX 2004 Usage function keyUp statements Parameters None Returns Nothing Description This function is called when the tool is active and a key is released Example function keyUp fl trace Key is released ...

Page 33: ...ility Flash MX 2004 Usage function mouseDoubleClick statements Parameters None Returns Nothing Description This function is called when the mouse button is double clicked on the Stage Example function mouseDblClk fl trace Mouse was double clicked ...

Page 34: ...location of the mouse when the button is pressed It is passed to the function when the mouse button is pressed This parameter is optional Returns Nothing Description This function is called whenever the tool is active and the mouse button is pressed while the pointer is over the Stage Example function mouseDown fl trace Mouse button has been pressed ...

Page 35: ...which tracks the mouse location If the Stage is in edit or edit in place mode the point coordinates are relative to the object being edited Otherwise the point coordinates are relative to the Stage This parameter is optional Returns Nothing Description This function is called whenever the mouse moves over a specified point on the Stage The mouse button can be down or up Example function mouseMove ...

Page 36: ...vailability Flash MX 2004 Usage function mouseUp statements Parameters None Returns Nothing Description This function is called whenever the mouse button is released after being pressed on the Stage Example function mouseUp fl trace mouse is up ...

Page 37: ...ters None Returns Nothing Description This function is called whenever a 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 Example function notifySettingsChanged var theTool fl tools activeTool var newValue theTool myProp ...

Page 38: ...nges an effect s properties or uses the remove effect menu item The code contained in this function is responsible for returning the object s to their original state For example if the effect broke a text string apart the responsibility of the removeEffect method would be to remove the text string that was broken apart and replace it with the original string See also configureEffect executeEffect ...

Page 39: ...ing Description This function is called whenever the mouse moves to allow the script to set custom pointers The script should call tools setCursor to specify the pointer to use For a list that shows which pointers correspond to which integer values see tools setCursor Example function setCursor fl tools setCursor 1 ...

Page 40: ...40 Chapter 2 Top level functions ...

Page 41: ...ponents panel is a property of the flash object and can be accessed by fl componentsPanel Contour object A Contour object represents a closed path of half edges on the boundary of a shape Document object The Document object represents the Stage drawingLayer object The drawingLayer object is accessible from JavaScript as a child of the flash object Edge object The Edge object represents an edge of ...

Page 42: ...rray which corresponds to the component Property inspector in the authoring tool Path object The Path object defines a sequence of line segments straight curved or both which you typically use when creating extensible tools Screen object The Screen object represents a single screen in a slide or form document ScreenOutline object The ScreenOutline object represents the group of screens in a slide ...

Page 43: ...d for the current document by fl getDocumentDOM getTimeline ToolObj object A ToolObj object represents an individual tool in the Tools panel Tools object The Tools object is accessible from the Flash object fl tools Vertex object The Vertex object is the part of the shape data structure that holds the coordinate data VideoItem object The VideoItem object is a subclass of the Item object XMLUI obje...

Page 44: ...of the bitmap manipulating them and then returning them to Flash See also bitmapInstance setBits Example The following code creates a reference to the currently selected object tests whether the object is a bitmap and traces the height width and bit depth of the bitmap var isBitmap fl getDocumentDOM selection 0 instanceType if isBitmap bitmap var bits fl getDocumentDOM selection 0 getBits fl trace...

Page 45: ...ternal library You typically use it only when creating an extensible tool or effect Returns Nothing Description Method sets the bits of an existing bitmap element This lets you create bitmap effects by getting the bits out of the bitmap manipulating them and then returning the bitmap to Flash Example The following code tests whether the current selection is a bitmap and then reduces the height of ...

Page 46: ... following code gets the height of the bitmap in pixels get the number of pixels in the vertical dimension var bmObj fl getDocumentDOM selection 0 var isBitmap bmObj instanceType if isBitmap bitmap var numVerticalPixels bmObj vPixels ...

Page 47: ... a bitmap false otherwise 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 Property Description bitmapItem allowSmoothing Property a Boolean value Set to true to allow smoothing of a bitmap false otherwise bitmapIte...

Page 48: ... property of the first item in the library of the current document to photo fl getDocumentDOM library items 0 compressionType photo alert fl getDocumentDOM library items 0 compressionType bitmapItem quality Availability Flash MX 2004 Usage bitmapItem quality Description Property an integer that specifies the quality of the bitmap To use the default document quality specify 1 otherwise specify an i...

Page 49: ...e false otherwise Available only for JPEG compression Example The following code sets the useImportedJPEGQuality property of the first item in the library of the current document to true fl getDocumentDOM library items 0 useImportedJPEGQuality true alert fl getDocumentDOM library items 0 useImportedJPEGQuality ...

Page 50: ... compiledClipInstance accName Property a string that is equivalent to the Name field in the Accessibility panel compiledClipInstance actionScript Property a string that represents the ActionScript for this instance equivalent to symbolInstance actionScript compiledClipInstance description Property a string that is equivalent to the Description field in the Accessibility panel compiledClipInstance ...

Page 51: ... layers 0 frames 0 elements 0 actionScript on click trace button is clicked assign some ActionScript to the currently selected Button compiled clip instance fl getDocumentDOM selection 0 actionScript on click trace button is clicked compiledClipInstance description Availability Flash MX 2004 Usage compiledClipInstance description Description Property a string that is equivalent to the Description ...

Page 52: ...hildren of the object are accessible var areChildrenAccessible fl getDocumentDOM selection 0 forceSimple allow the children of the object to be accessible fl getDocumentDOM selection 0 forceSimple false 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 sh...

Page 53: ...essible var isSilent fl getDocumentDOM selection 0 silent set the object to be accessible fl getDocumentDOM selection 0 silent false 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 t...

Page 54: ...e following property componentInstance parameters Availability Flash MX 2004 Usage componentInstance parameters Description Read only property an array containing the ActionScript 2 0 properties that are accessible from the component Property inspector See Parameter object on page 237 Example The following example illustrates getting and setting the parameters property var parms fl getDocumentDOM ...

Page 55: ...point categoryName A string that specifies the name of the component category for example Data Components The valid category names are listed in the Components panel componentName A string that specifies the name of the component in the specified category for example WebServiceConnector The valid component names are listed in the Components panel Returns Nothing Description Adds the specified comp...

Page 56: ...Parameters None Returns A HalfEdge object 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 Property Description contour getHalfEdge Method returns a HalfEdge object on the contour of...

Page 57: ...t 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 for each contour in the Output panel var elt fl getDocumentDOM selection 0 elt beginEdit var contourArray elt contours ...

Page 58: ...1 if it is clockwise and 0 if it is a contour with no area 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 i contourArray length i var contour contourArray i fl trace Next Cont...

Page 59: ...gle fitting it into the specified bounds document addNewScene Adds a new scene Timeline object as the next scene after the currently selected scene and makes the new scene the currently selected scene document addNewText Inserts a new empty text field document align Aligns the selection document allowScreens Use this method before using the document screenOutline property document arrange Arranges...

Page 60: ...tePublishProfile Duplicates the currently active profile and gives the duplicate version focus document duplicateScene Makes a copy of the currently selected scene giving the new scene a unique name and making it the current scene document duplicateSelection Duplicates the selection on the Stage document editScene Makes the specified scene the currently selected scene for editing document enterEdi...

Page 61: ...elected this method moves all selected Bézier points on all selected paths by the specified amount document moveSelectionBy Moves selected objects by a specified distance document optimizeCurves Optimizes smoothing for the current selection allowing multiple passes if specified for optimal smoothing equivalent to selecting Modify Shape Optimize document publish Publishes the document according to ...

Page 62: ...erty inspector and any selected shapes document setElementProperty Sets the specified Element property on selected object s in the document document setElementTextAttr Sets the specified TextAttrs property of the selected text items to the specified value document setFillColor Changes the fill color of the selection to the specified color document setInstanceAlpha Sets the opacity of the instance ...

Page 63: ...on the document document testScene Executes a Test Scene operation on the current scene of the document document traceBitmap Performs a trace bitmap on the current selection equivalent to selecting Modify Bitmap Trace Bitmap document transformSelection Performs a general transformation on the current selection by applying the matrix specified in the arguments document unGroup Ungroups the current ...

Page 64: ...age in pixels document library Read only the library object for a document document livePreview A Boolean value that specifies if Live Preview is enabled document name Read only a string that represents the name of a document FLA file document path Read only a string that represents the path of the document document publishProfiles Read only an array of the publish profile names for the document d...

Page 65: ...doubleArray string and byteArray data the value to add Valid types depend on the type parameter Returns Nothing Description Method stores specified data with a document Data is written to the FLA file and is available to JavaScript when the file reopens See document getDataFromDocument and document removeDataFromDocument Example The following example adds an integer value of 12 to the current docu...

Page 66: ...d object fl getDocumentDOM addDataToSelection myData integer 12 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 object that specifies the item to add and the library fro...

Page 67: ...ty 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 y coordinates where the line ends Returns Nothing Description Method adds a new path between two points The method uses the document s current stroke attribut...

Page 68: ... drawn without a fill If bSurpressStroke is set to true the oval is drawn without a stroke If both bSuppressFill or bSuppressStroke are set to true the method will do nothing Example The following example adds a new oval within the specified coordinates flash getDocumentDOM addNewOval left 72 top 50 right 236 bottom 228 The following example draws an oval without fill flash getDocumentDOM addNewOv...

Page 69: ...ween 0 and 999 that specifies the roundness to use for the corners The value is specified as number of points The greater the value the greater the roundness bSuppressFill A Boolean value that if set to true causes the method to create the shape without a fill The default value is false This parameter is optional bSuppressStroke A Boolean value that if set to true causes the method to create the r...

Page 70: ...s the name of the scene If you do not specify a name a new scene name is generated Returns A Boolean value true if the scene is added successfully false otherwise Description Method adds a new scene Timeline object as the next scene after the currently selected scene and makes the new scene the currently selected scene If the specified scene name already exists the scene is not added and the metho...

Page 71: ...d then sets the text string to Hello World fl getDocumentDOM addNewText left 0 top 0 right 100 bottom 100 fl getDocumentDOM setTextString Hello World document align Availability Flash MX 2004 Usage document align alignmode bUseDocumentBounds Parameters alignmode A string that specifies how to align the selection Valid values for alignmode are left right top bottom vertical center and horizontal ce...

Page 72: ...If this method returns the value true you can safely access the screenOutline property Flash displays an error if you access the screenOutline property in a document without screens Example The following example determines whether screens methods can be used in the current document if fl getDocumentDOM allowScreens fl trace screen outline is available else fl trace whoops no screens document arran...

Page 73: ...cally label objects on the Stage with the text associated with them Example The following example gets the value of the autoLabel property and displays the result in the Output panel var isAutoLabel fl getDocumentDOM autoLabel fl trace isAutoLabel The following example sets the autoLabel property to true telling Flash to automatically label objects on the Stage fl getDocumentDOM autoLabel true doc...

Page 74: ...EditSymbol Parameters None Returns A Boolean value true if the Edit Symbols menu and functionality are available for use false otherwise 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 exa...

Page 75: ...lowing example checks whether the current document can revert to the previously saved version If so fl getDocumentDOM revert restores the previously saved version if fl getDocumentDOM canRevert fl getDocumentDOM revert 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 f...

Page 76: ...true if you can use the document testScene method successfully false otherwise Description Method determines whether you can use the document testScene method successfully See document canTestMovie and document testMovie Example The following example first tests whether fl getDocumentDOM testScene can be used successfully If so it calls the method if fl getDocumentDOM canTestScene fl getDocumentDO...

Page 77: ...t and writes it to the Clipboard Example The following example cuts the current selection from the document and writes it to the Clipboard fl getDocumentDOM clipCut document clipPaste Availability Flash MX 2004 Usage document clipPaste bInPlace Parameters bInPlace A Boolean value that when set to true causes the method to perform a paste in place operation The default value is false which causes t...

Page 78: ...ompt the user with a dialog box if there are unsaved changes in the document If bPromptToSaveChanges is set to false the user is not prompted to save any changed documents The default value is true This parameter is optional Returns Nothing Description Method closes the specified document Example The following example closes the current document and prompts the user with a dialog box to save chang...

Page 79: ...t Specifies the point that represents the 0 0 location for the symbol Acceptable values are top left top center top right center left center center right bottom left bottom center and bottom right Returns An object for the newly created symbol or null if it cannot create the symbol Description Method converts the selected Stage item s to a new symbol For information on defining linkage and shared ...

Page 80: ...currentTimeline Description Property an integer that specifies the index of the active Timeline You can set the active Timeline by changing the value of this property the effect is almost equivalent to calling document editScene The only difference is that you don t get an error message if the index of the Timeline is not valid the property is simply not set which causes silent failure See documen...

Page 81: ...wing example deletes the currently active profile if there is more than one and displays the index of the new currently active profile alert fl getDocumentDOM deletePublishProfile document deleteScene Availability Flash MX 2004 Usage document deleteScene Parameters None Returns A Boolean value true if the scene is successfully deleted false otherwise Description Method deletes the current scene Ti...

Page 82: ...isplays an error message if there is no selection Example The following example deletes the current selection in the document fl getDocumentDOM deleteSelection 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 followi...

Page 83: ...e selected object The default is false Returns Nothing Description Method distributes the selection See document setAlignToDocument and document getAlignToDocument Example The following example distributes the selected objects by the top edge fl getDocumentDOM distribute top edge The following example distributes the selected objects by top edge and expressly sets the bUseDcoumentBounds parameter ...

Page 84: ... Returns A Boolean value true if the document has persistent data false otherwise Description Method checks the document for persistent data with the specified name See document addDataToDocument document getDataFromDocument and document removeDataFromDocument Example The following example checks the document for persistent data with the name myData var hasData fl getDocumentDOM documentHasData my...

Page 85: ...up profile document duplicateScene Availability Flash MX 2004 Usage document duplicateScene Parameters None Returns A Boolean value true if the scene is duplicated successfully false otherwise Description Method makes a copy of the currently selected scene giving the new scene a unique name and making it the current scene Example The following example duplicates the second scene in the current doc...

Page 86: ...eturns Nothing 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 editScene 2 fl getDocumentDOM deleteScene document enterEditMode Availability Flash MX 2004 Usage document enterEd...

Page 87: ... Flash in edit in new window mode for the currently selected symbol fl getDocumentDOM enterEditMode newWindow document exitEditMode Availability Flash MX 2004 Usage document exitEditMode Parameters None Returns Nothing Description Method exits from symbol editing mode and returns focus to the next level up from the editing mode For example if you are editing a symbol inside another symbol this met...

Page 88: ... exportSWF fileURI bCurrentSettings Parameters fileURI A string expressed as a file URL that specifies the name of the exported file If fileURI is empty or not specified Flash displays the Export Movie dialog box This parameter is optional bCurrentSettings A Boolean value that when set to true causes Flash to use current SWF publish settings Otherwise Flash displays the Export Flash Player dialog ...

Page 89: ...orceSimple is true it is the same as the Make Child Object Accessible option being unchecked If forceSimple is false it is the same as the Make Child Object Accessible option being checked 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 force...

Page 90: ...ee document setAlignToDocument Example The following example retrieves the value of the To Stage button in the Align panel If the return value is true the To Stage button is active otherwise it is not var isAlignToDoc fl getDocumentDOM getAlignToDocument fl getDocumentDOM align left isAlignToDoc document getCustomFill Availability Flash MX 2004 Usage document getCustomFill objectToFill Parameters ...

Page 91: ...r swatch to a linear gradient var fill fl getDocumentDOM getCustomFill toolbar fill style linearGradient fill colorArray 0x00ff00 0xff0000 0x0000ff fill posArray 0 100 200 fl getDocumentDOM setCustomFill fill document getCustomStroke Availability Flash MX 2004 Usage document getCustomStroke locationOfStroke Parameters locationOfStroke A string that specifies the location of the stroke object The f...

Page 92: ...entDOM getCustomStroke toolbar stroke color FF0000 fl getDocumentDOM setCustomStroke stroke 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 depends on the type of data that wa...

Page 93: ... of valid values See document setElementProperty Example The following example gets the name of the Element property for the current selection elementName the instance name of the selected object var elementName fl getDocumentDOM getElementProperty name document getElementTextAttr Availability Flash MX 2004 Usage document getElementTextAttr attrName startIndex endIndex Parameters attrName A string...

Page 94: ...cted text objects Selected objects that are not text fields are ignored For a list of property names and expected values see Property summary for the TextAttrs object on page 299 See document setElementTextAttr Example The following example gets the size of the selected text fields fl getDocumentDOM getElementTextAttr size The following example gets the color of the character at index 3 in the sel...

Page 95: ...d text If the optional parameters are not passed the current text selection is used If text is not currently opened for editing the whole text string is returned If only startIndex is passed the string starting at that index and ending at the end of the field is returned If startIndex and endIndex are passed the string starting from startIndex up to but not including endIndex is returned See docum...

Page 96: ...s the number of frames in the longest layer var longestLayer fl getDocumentDOM getTimeline frameCount fl trace The longest layer has longestLayer frames The following example enters edit in place mode for the selected symbol on the Stage and inserts a frame on the symbol s Timeline fl getDocumentDOM enterEditMode inPlace fl getDocumentDOM getTimeline insertFrames The following example gets the Tim...

Page 97: ... transPoint y property gives the y coordinate of the transformation point var transPoint fl getDocumentDOM getTransformationPoint document group Availability Flash MX 2004 Usage document group Parameters None Returns Nothing Description Method converts the current selection to a group See document unGroup Example The following example converts the objects in the current selection to a group fl get...

Page 98: ...he profile cannot be imported Description Method imports a profile from a file Example The following example imports the profile contained in the profile xml file and displays its index in the profiles list alert fl getDocumentDOM importPublishProfile file C Documents and Settings username Desktop profile xml document importSWF Availability Flash MX 2004 Usage document importSWF fileURI Parameters...

Page 99: ...document is not fl documents 1 the following example gets the library for a non focused library or for a library you opened using File Open as external library var externalLib fl documents 1 library document livePreview Availability Flash MX 2004 Usage document livePreview Description Property a Boolean value that specifies if Live Preview is enabled If set to true components appear on the Stage a...

Page 100: ... the largest object The default is false This parameter is optional Returns Nothing Description Method makes the size of the selected objects the same See document setAlignToDocument and document getAlignToDocument Example The following example matches the width of the selected objects only fl getDocumentDOM match true false The following example matches the height only fl getDocumentDOM match fal...

Page 101: ...bShiftDown bShiftSelect 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 whether the Shift key was down when the event occurred true for pressed false for not pressed ...

Page 102: ...ier points 10 pixels to the right and 5 pixels down fl getDocumentDOM moveSelectedBezierPointsBy x 10 y 5 document moveSelectionBy Availability Flash MX 2004 Usage document moveSelectionBy distanceToMove Parameters distanceToMove A pair of floating point values that specify the x and y coordinate values by which the method moves the selection For example passing x 1 y 2 specifies a location one pi...

Page 103: ... documents array var fileName flash documents 0 name The following example displays the names of all the open documents in the Output panel var openDocs fl documents for var i 0 i opendocs length i fl trace i opendocs i name n document optimizeCurves Availability Flash MX 2004 Usage document optimizeCurves smoothing bUseMultiplePasses Parameters smoothing An integer in the range from 0 to 100 with...

Page 104: ...MX 2004 Usage document path Description Read only property a string that represents the path of the document If the document has never been saved this property is undefined Example The following example displays the path of the first document in the documents array in the Output panel var filePath flash documents 0 path fl trace filePath document publish Availability Flash MX 2004 Usage document p...

Page 105: ...OM publishProfiles for var i 0 i myPubProfiles length i fl trace myPubProfiles i document removeDataFromDocument Availability Flash MX 2004 Usage document removeDataFromDocument name Parameters name A string that specifies the name of the data to remove Returns Nothing Description Method removes persistent data with the specified name that has been attached to the document See document addDataToDo...

Page 106: ...persistent data named myData fl getDocumentDOM removeDataFromSelection myData 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 provided Returns A Boolean value true if the na...

Page 107: ...t scene to new name var success fl getDocumentDOM renameScene new name document reorderScene Availability Flash MX 2004 Usage document reorderScene sceneToMove sceneToPutItBefore Parameters sceneToMove An integer that specifies which scene to move with 0 zero being the first scene sceneToPutItBefore An integer that specifies the scene before which you want to move the scene specified by sceneToMov...

Page 108: ...nsformation matrix This method is equivalent to selecting Modify Transform Remove transform Example The following example resets the transformation matrix for the current selection fl getDocumentDOM resetTransformation document revert Availability Flash MX 2004 Usage document revert Parameters None Returns Nothing Description Method reverts the specified document to its previously saved version Th...

Page 109: ...hod uses the transformation point This parameter is optional Returns Nothing Description Method rotates the selection by a specified amount The effect is the same as using the Free Transform tool to rotate the object Example The following example rotates the selection by 45º around the transformation point flash getDocumentDOM rotateSelection 45 The following example rotates the selection by 45º a...

Page 110: ...bOkToSaveAs Parameters bOkToSaveAs An optional parameter that if true or omitted and the file was never saved the Save As dialog box appears If false and the file was never saved the file is not saved Returns A Boolean value true if the save and compact operation completes successfully false otherwise Description Method saves and compacts the file This method is equivalent to selecting File Save a...

Page 111: ...h of the current selection to double the original width and shrinks the height to half flash getDocumentDOM scaleSelection 2 0 0 5 The following example flips the selection vertically fl getDocumentDOM scaleSelection 1 1 The following example flips the selection horizontally fl getDocumentDOM scaleSelection 1 1 The following example scales the selection vertically by 1 9 from the top center fl get...

Page 112: ...he following example selects everything that is currently visible to the user fl getDocumentDOM selectAll document selection Availability Flash MX 2004 Usage document selection Description Property an array of the selected objects in the document If nothing is selected returns an array of length zero If no document is open returns null To add objects to the array you must first select them in one ...

Page 113: ...tDOM addNewRectangle left 0 top 0 right 99 bottom 99 0 fl getDocumentDOM addNewText left 1 top 117 3 right 9 2 bottom 134 6 fl getDocumentDOM setTextString Hello World fl getDocumentDOM setSelectionRect left 28 top 22 right 156 0 bottom 163 var theSelectionArray fl getDocumentDOM selection for var i 0 i theSelectionArray length i fl trace fl getDocumentDOM selection i theSelectionArray i The follo...

Page 114: ...lectionArray x theElems c increments counter variable x Now that we have assigned all the instances of myMovieClip to mySelectionArray we then set the document selection array equal to mySelectionArray This selects the objects on stage fl getDocumentDOM selection mySelectionArray document selectNone Availability Flash MX 2004 Usage document selectNone Parameters None Returns Nothing Description Me...

Page 115: ...cument getAlignToDocument Example The following example enables the To Stage button in the Align panel to align objects with the Stage fl getDocumentDOM setAlignToDocument true document setCustomFill Availability Flash MX 2004 Usage document setCustomFill fill Parameters fill Sets the Fill object Returns Nothing Description Method sets the fill settings for the toolbar Property inspector and any s...

Page 116: ...he stroke settings before drawing the object rather than drawing the object selecting it and changing the stroke settings It also lets a script change the toolbar and Property inspector stroke settings See document getCustomStroke Example The following example changes the stroke thickness setting in the toolbar Property inspector and any selected shapes var stroke fl getDocumentDOM getCustomStroke...

Page 117: ...ted values see Property summary for the TextAttrs object on page 299 startIndex An integer value that specifies the index of the first character that is affected This parameter is optional endIndex An integer value that specifies the index of the last character that is affected This parameter is optional Returns A Boolean value true if at least one text attribute property is changed false otherwis...

Page 118: ...ting the Fill color swatch in the user interface to no fill Returns Nothing Description Method changes the fill color of the selection to the specified color For information on changing the fill color in the toolbar and Property inspector see document setCustomFill Example The first three statements in the following example set the fill color using each of the different formats for specifying colo...

Page 119: ...ets the brightness for the instance Example The following example sets the brightness for the instance to a value of 50 fl getDocumentDOM setInstanceBrightness 50 document setInstanceTint Availability Flash MX 2004 Usage document setInstanceTint color strength Parameters color A color string in hexadecimal rrggbb format where r is red g is green and b is blue a hexidecimal color value such as 0xff...

Page 120: ... new location and size of the selection The parameter specifies location as left and top pixel locations and size as width and height See document setSelectionRect Returns Nothing Description Method moves and resizes the selection in a single operation Example The following example moves the current selection to 10 20 and resizes it to 100 200 var l 10 var t 20 fl getDocumentDOM setSelectionBounds...

Page 121: ...ection replaces the first one fl getDocumentDOM setSelectionRect left 1 top 1 right 200 bottom 200 fl getDocumentDOM setSelectionRect left 364 0 top 203 0 right 508 0 bottom 434 0 true In the following example the second selection is added to the first selection This is the same as the manual operation of holding down Shift and selecting a second object fl getDocumentDOM setSelectionRect left 1 to...

Page 122: ... in hexadecimal rrggbb format where r is red g is green and b is blue a hexidecimal color value such as 0xff0000 or an integer color value Returns Nothing Description Method changes the stroke color of the selection to the specified color For information on changing the stroke in the toolbar and Property inspector see document setCustomStroke Example The three statements in the following example s...

Page 123: ...ocument setStrokeStyle Availability Flash MX 2004 Usage document setStrokeStyle strokeType Parameters strokeType A string that specifies the stroke style for the current selection Valid values are hairline solid dashed dotted ragged stipple and hatched Returns Nothing Description Method changes the stroke style of the selection to the specified style For information on changing the stroke in the t...

Page 124: ...tangle but the text field is constrained to fit all the text Example The following example changes the size of the bounding text rectangle to the specified dimensions fl getDocumentDOM setTextRectangle left 0 top 0 right 50 bottom 200 document setTextSelection Availability Flash MX 2004 Usage document setTextSelection startIndex endIndex Parameters startIndex An integer that specifies the position...

Page 125: ...text object isn t currently being edited the whole text string is replaced If only startIndex is passed the string passed is inserted at this position If startIndex and endIndex are passed the string passed replaces the segment of text starting from startIndex up to but not including endIndex See document getTextString Example The following example replaces the current text selection with Hello Wo...

Page 126: ...Stage upper left corner Returns Nothing Description Method moves the transformation point of the current selection See document getTransformationPoint Example The following example sets the transformation point of the current selection to 100 200 fl getDocumentDOM setTransformationPoint x 100 y 200 document silent Availability Flash MX 2004 Usage document silent Description Property a Boolean valu...

Page 127: ...he edge where the transformation occurs if omitted skew occurs at the transformation point Valid values are top center right center bottom center and left center This parameter is optional Returns Nothing Description Method skews the selection by a specified amount The effect is the same as using the Free Transform tool to skew the object Example The following examples skew the selected object by ...

Page 128: ...cal bUseDocumentBounds A Boolean value that when set to true spaces the objects to the document bounds Otherwise the method uses the bounds of the selected objects The default is false This parameter is optional Returns Nothing Description Method spaces the objects in the selection evenly See document setAlignToDocument and document getAlignToDocument Example The following example spaces the objec...

Page 129: ...mentDOM straightenSelection 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 button movie clip video or bitmap This method displays an error message if no object is selec...

Page 130: ...ne Example The following example tests the movie for the current document fl getDocumentDOM testMovie document testScene Availability Flash MX 2004 Usage document testScene Parameters None Returns Nothing Description Method executes a Test Scene operation on the current scene of the document See document canTestScene and document testMovie Example The following example tests the current scene in t...

Page 131: ...traceBitmap threshold minimumArea curveFit cornerThreshold Parameters threshold An integer that controls the number of colors in your traced bitmap Valid values are integers between 0 and 500 minimumArea An integer that specifies the radius measured in pixels Valid values are integers between 1 and 1000 curveFit A string that specifies how smoothly outlines are drawn Valid values are pixels very t...

Page 132: ...number that specifies the 1 0 element of the transformation matrix d A floating point number that specifies the 1 1 element of the transformation matrix Returns Nothing Description Method performs a general transformation on the current selection by applying the matrix specified in the arguments For more information see the element matrix property Example The following example stretches the select...

Page 133: ...y a Matrix object The viewMatrix is used to transform from object space to document space when the document is in edit mode The mouse location as a tool receives it is relative to the object that is currently being edited For example if you create a symbol double click to edit it and draw with the polyStar tool the point 0 0 will be at the registration point of the symbol However the drawingLayer ...

Page 134: ...th expressed as a file URL to the XML file defining the controls in the panel The full path is required Returns An object that has properties defined for all controls defined in the XML file All properties are returned as strings The returned object will have one predefined property named dismiss that will have the string value accept or cancel Description Method posts a XMLUI dialog box See fl xm...

Page 135: ...g mode drawingLayer beginFrame Method erases what was previously drawn using the drawingLayer and prepares for more drawing commands drawingLayer cubicCurveTo Method draws a cubic curve from the current pen location using the parameters as the coordinates of the cubic segment drawingLayer curveTo Method draws a quadratic curve segment starting at the current drawing position and ending at a specif...

Page 136: ...is used for temporary drawing while the mouse button is pressed You typically use this method only when creating extensible tools Example The following example puts Flash in drawing mode fl drawingLayer beginDraw drawingLayer beginFrame Availability Flash MX 2004 Usage drawingLayer beginFrame Parameters None Returns Nothing Description Method erases what was previously drawn using the drawingLayer...

Page 137: ...y position of the end control point Returns Nothing Description Method draws a cubic curve from the current pen location using the parameters as the coordinates of the cubic segment You typically use this method only when creating extensible tools Example The following example draws a cubic curve using the specified control points fl drawingLayer cubicCurveTo 0 0 1 1 2 0 drawingLayer curveTo Avail...

Page 138: ...path Parameters path A Path object to draw Returns Nothing 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 endDraw Availability Flash MX 2004 Usage drawingLayer endDraw Parameters No...

Page 139: ...wn in this group of drawing commands You typically use this method only when creating extensible tools drawingLayer lineTo Availability Flash MX 2004 Usage drawingLayer lineTo x y Parameters x A floating point value that is the x coordinate of the end point of the line to draw y A floating point value that is the y coordinate of the end point of the line to draw Returns Nothing Description Method ...

Page 140: ...ription Method sets the current drawing position You typically use this method only when creating extensible tools Example The following example sets the current drawing position at the point 10 15 fl drawingLayer moveTo 10 15 drawingLayer newPath Availability Flash MX 2004 Usage drawingLayer newPath Parameters None Returns A Path object Description Method returns a new Path object You typically u...

Page 141: ...tly drawn data Applies only to persistent data To use this method the parameter passed to drawingLayer beginDraw must be set to true You typically use this method only when creating extensible tools Example The following example draws a red line on the Stage fl drawingLayer beginDraw true fl drawingLayer beginFrame fl drawingLayer setColor ff0000 fl drawingLayer moveTo 0 0 fl drawingLayer lineTo 1...

Page 142: ...int If the edge isLine property is true the middle control point is set to the midpoint of the segment joining the beginning and ending control points Returns The specified control point Description Method gets a point object set to the location of the specified control point of the edge Method Description edge getControl Method gets a point object set to the location of the specified control poin...

Page 143: ...e Returns A HalfEdge object Description Method returns a HalfEdge object Example The following example stores the half edges of the specified edge in the hEdge0 and hEdge0 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 2004 Usage edge id Description Read only property an integer that...

Page 144: ...ge setControl index x y Parameters index specifies which control point to set Use values 0 1 or 2 to specify the beginning middle and end control points respectively x A floating point value that specifies the horizontal location of the control point If the Stage is in Edit or Edit in place mode the point coordinate is relative to the edited object Otherwise the point coordinate is relative to the...

Page 145: ...pecifies 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 which for a line is exactly in the center If the edge represents a curve 0 5 represents the parametric middle of the curve Returns Nothing Description Method splits the edge into two pieces You must call shape beginEdit before using this method Exa...

Page 146: ...alues effect effectName Availability Flash MX 2004 Usage effect effectName 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 Property Description effect effectName Read only a string that appears in th...

Page 147: ...name of the current effect in the efGroupName variable var efGroupName fl activeEffect groupName effect sourceFile Availability Flash MX 2004 Usage effect sourceFile Description Read only property a string that specifies the name of JSFL source file for the specified effect This string is used to bind an XML parameter file to its JSFL effect implementation You must include this XML parameter in th...

Page 148: ...rent effect in the efType variable var efType fl activeEffect symbolType effect useXMLToUI Availability Flash MX 2004 Usage effect useXMLToUI Description Property a Boolean value that lets you override the default behavior of using XMLUI to construct a dialog box that consists of one or more controls The default value is true If set to false the standard XMLUI dialog box will not be posted and you...

Page 149: ...ied name that has been attached to the object element setPersistentData Stores data with an element Property Description element depth Read only an integer that has a value greater than 0 for the depth of the object in the view element elementType Read only a string that represents the type of the specified element element height A float value that specifies the height of the element in pixels ele...

Page 150: ...ntType 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 extensible tool Example The following example stores the type of the first element in the eType variable In a new file place a movie c...

Page 151: ... see element setPersistentData Only symbols and bitmaps support persistent data Example The following example sets and gets data for the specified element shows its value in the Output panel and then removes the data at least one symbol or bitmap is selected in the first layer first frame var elt fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 elt setPersistentData myData integer 12 if ...

Page 152: ...ext field scales the text Example The following example sets the height of the specified element to 100 fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 height 100 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 elem...

Page 153: ...t in the first frame top layer similar to Modify Arrange Lock fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 locked true 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 Example The following example m...

Page 154: ...cumentDOM getTimeline layers 0 frames 0 elements 0 name clip_mc See the element elementType example element removePersistentData Availability Flash MX 2004 Usage element removePersistentData name Parameters name A string that specifies the name of the data to remove Returns Nothing Description Method removes any persistent data with the specified name that has been attached to the object Only symb...

Page 155: ...reopened Only symbols and bitmaps support persistent data Example See element getPersistentData element top Availability Flash MX 2004 Usage element top 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...

Page 156: ...h of the element in pixels Note Do not use this property to resize a text field Instead select the text field and use document setTextRectangle Using this property with a text field scales the text Example The following example sets the width of the specified element to 100 fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 width 100 ...

Page 157: ... Inheritance Element object Instance object EmbeddedVideoInstance object Availability Flash MX 2004 Description The EmbeddedVideoInstance object is a subclass of Instance object There are no unique methods or properties of EmbeddedVideoInstance CHAPTER 3 Objects ...

Page 158: ...r an integer containing the color value Example The following example sets the fill color of the current selection var fill fl getDocumentDOM getCustomFill fill color FFFFFF fl getDocumentDOM setCustomFill fill Property Description fill color A color string in hexadecimal format such as rrggbb or an integer containing the color value fill colorArray An array of colors in gradient fill matrix A Mat...

Page 159: ...Array 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 posArray Availability Flash MX 2004 Usage fill posArray 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 f...

Page 160: ...Fill If an object has no fill this property has a value of noFill If this value is linearGradient or radialGradient the properties fill colorArray and fill posArray are also available Example The following example specifies the colors to use in a linear gradient for the current selection var fill fl getDocumentDOM getCustomFill fill style linearGradient fill colorArray 0x00ff00 0xff0000 0x0000ff f...

Page 161: ...ied name fl getDocumentDOM Retrieves the DOM Document object of the currently active document fl mapPlayerURL Maps an escaped Unicode URL to a UTF 8 or MBCS URL 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 authoring tool for editing fl openScript Opens a script JSFL AS ASC or other ...

Page 162: ...sent the file extensions of the types of documents that can be created fl createNewTemplateList Read only an array of strings that represent the various types of templates that can be created fl documents Read only an array of Document objects see Document object that represent the documents FLA files that are currently open for editing fl drawingLayer Read only the drawingLayer object that an ext...

Page 163: ...ues open and select open the system File Open dialog box Each value is provided for compatibility with Dreamweaver The value save opens a system File Save dialog box title A string that specifies the title for the File Open or File Save dialog box If this parameter is omitted a default value is used This parameter is optional previewArea An optional parameter that is ignored by Flash and Fireworks...

Page 164: ...bility Flash MX 2004 Usage fl closeDocument documentObject bPromptToSaveChanges 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 the user is not prompted if the document cont...

Page 165: ...sage fl componentsPanel Description Read only property a componentsPanel object which represents the Components panel Example The following example stores a componentsPanel object in the comPanel variable var comPanel fl componentsPanel fl configDirectory Availability Flash MX 2004 Usage fl configDirectory Description Read only property a string that specifies the full path for the local user s Co...

Page 166: ...ommands Test jsfl fl createDocument Availability Flash MX 2004 Usage fl createDocument docType Parameters docType A string that specifies the type of document to create Valid values are timeline presentation and application The default value is timeline This parameter is optional Returns If successful returns the Document object for the newly created document If an error occurs the value is undefi...

Page 167: ...ce fl createNewDocList i fl createNewDocListType Availability Flash MX 2004 Usage fl createNewDocListType Description Read only property an array of strings that represent the file extensions of the types of documents that can be created The entries in the array correspond directly by index to the entries in the fl createNewDocList array Example The following example displays the extensions of the...

Page 168: ... Read only property an array of Document objects that represent the documents FLA files that are currently open for editing Example The following example stores an array of open documents in the docs variable var docs fl documents The following example displays the names of currently open documents in the Output panel for doc in fl documents fl trace fl documents doc name fl drawingLayer Availabil...

Page 169: ...nableUpdates 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 executing effects Immediate updates are normally suppressed so the user does not see intermediate steps that can be visually distracting a...

Page 170: ... C example fla alert fl fileExists file C example jsfl alert fl fileExists fl findDocumentIndex Availability Flash MX 2004 Usage fl findDocumentIndex name Parameters name The document name for which you want to find the index The document must be open Returns An integer that is the index of the document Description Method finds the index of an open document with the specified name Example The foll...

Page 171: ... active document in the Output panel var currentDoc fl getDocumentDOM fl trace currentDoc name fl mapPlayerURL Availability Flash MX 2004 Usage fl mapPlayerURL URI returnMBCS Parameters URI A string that contains the escaped Unicode URL to map returnMBCS A Boolean value that you must set to true if you want an escaped MBCS path returned Otherwise the method returns UTF 8 The default value is false...

Page 172: ...ar mat fl getDocumentDOM selection 0 matrix for var prop in mat fl trace mat prop mat prop var invMat fl Math invertMatrix mat for var prop in invMat fl trace invMat prop invMat prop fl mruRecentFileList Availability Flash MX 2004 Usage fl mruRecentFileList Description Read only property an array of the complete filenames in the Most Recently Used MRU list that the authoring tool manages Example T...

Page 173: ...ListType i fl openDocument Availability Flash MX 2004 Usage fl openDocument fileURI Parameters fileURI A string that specifies the name of the file to be opened expressed as a URI file URI Returns If successful returns the Document object for the newly opened document If the file is not found or is not a valid FLA file an error is reported and the script is cancelled Description Method opens a Fla...

Page 174: ...ct fileURI Parameters fileURI A string that specifies the path of the Flash project file to open expressed as a URI file URI Returns Nothing Description Method opens a Flash Project FLP file in the authoring tool for editing Example The following example opens a project file named myProjectFile flp that is stored in the root directory of the C drive fl openProject file c myProjectFile flp fl openS...

Page 175: ...ameters bPromptIfNeeded A Boolean value that is true default if you want the user to be prompted to save any modified documents Set this parameter to false if you do not want the user to be prompted to save modified documents In the latter case any modifications in open documents will be discarded and the application will exit immediately Although it is useful for batch processing use this method ...

Page 176: ...d it provides a mechanism to improve the effects without relaunching the application This method works best if used in a command placed in the Commands folder Example The following example is a one line script that you can place in the Commands folder When you need to reload effects go to the Commands menu and execute the script fl reloadEffects fl reloadTools Availability Flash MX 2004 Usage fl r...

Page 177: ...the specified FLA document to its last saved version Unlike the File Revert menu option this method does not display a warning window that asks the user to confirm the operation See also document revert and document canRevert 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 ...

Page 178: ...ws function testFunct num minNum fl trace in testFunct 1st arg num 2nd arg minNum for i 0 i 2 i fl trace in for loop i i fl trace end of for loop end of testScript jsfl If you issue the following command fl runScript file C testScript jsfl testFunct 10 1 The following information appears in the Output panel in for loop i 0 in for loop i 1 end of for loop in testFunct 1st arg 10 2nd arg 1 You can a...

Page 179: ...If the fileURI parameter is null or omitted the document is saved with its current name If the document is not yet saved Flash displays the Save As dialog box This parameter is optional Returns A Boolean value true if the save operation completes successfully false otherwise Description Method saves the specified document as a FLA document See also fl saveDocumentAs fl saveAll document save and do...

Page 180: ...DocumentAs fl documents 0 fl setActiveWindow Availability Flash MX 2004 Usage fl setActiveWindow document bActivateFrame Parameters document A Document object that specifies the document to select as the active window bActivateFrame An optional parameter that is present for consistency with the Dreamweaver API As in Fireworks it is optional and it is ignored Returns Nothing Description Method sets...

Page 181: ...hat appears in the Output panel Returns Nothing Description Method sends a text string to the Output panel This method works in the same way as outputPanel trace and the trace statement in ActionScript Example The following example displays text in the Output panel fl trace hello World var myPet cat fl trace I have a myPet fl version Availability Flash MX 2004 Usage fl version Description Read onl...

Page 182: ...utput panel alert fl version e g WIN 7 0 0 380 fl xmlui Availability Flash MX 2004 Usage fl xmlui Description Read only property an XMLUI object This property lets you get and set XMLUI properties in a XMLUI dialog box and lets you accept or cancel the dialog box programmatically Example See XMLUI object ...

Page 183: ...lderItem 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 CHAPTER 3 Objects ...

Page 184: ...s 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 CHAPTER 3 Objects ...

Page 185: ...es Property an integer that specifies the number of times the tweened element rotates between the starting keyframe and the next keyframe frame motionTweenScale 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 scale false frame motionTweenSnap Property a Boolean...

Page 186: ...ys frame soundLoopMode Property a string that specifies whether a sound that is attached directly to a frame frame soundLibraryItem should play a specific number of times or loop indefinitely frame soundName Property a string that specifies the name of a sound that is attached directly to a frame frame soundLibraryItem as stored in the library frame soundSync Property a string that specifies the s...

Page 187: ...ment If each shape is grouped so there are multiple groups on the Stage Flash sees them as separate elements In other words Flash treats raw ungrouped shapes as a single element regardless of how many separate shapes are on the Stage If a frame contains three raw ungrouped shapes for example then elements length in that frame returns a value of 1 Select each shape individually and group it to work...

Page 188: ... maintain its angle with respect to each point on the path true or whether it does not rotate false If you want to specify a value for this property you should set frame motionTweenRotate to none 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 ...

Page 189: ...te counter clockwise fl getDocumentDOM getTimeline layers 0 frames 0 motionTweenRotateTimes 3 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 scale false frame motionTwee...

Page 190: ... name Description Property a string that specifies the name of the frame Example The following example sets the name of the first frame top layer to First Frame and then stores the name value in the frameLabel variable fl getDocumentDOM getTimeline layers 0 frames 0 name First Frame var frameLabel fl getDocumentDOM getTimeline layers 0 frames 0 name frame shapeTweenBlend Availability Flash MX 2004...

Page 191: ...st frame should fade in fl getDocumentDOM getTimeline layers 0 frames 0 soundEffect fade in frame soundLibraryItem Availability Flash MX 2004 Usage frame soundLibraryItem 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 which must be a sound object to the s...

Page 192: ...ly Valid values are repeat and loop To specify the number of times the sound should play set a value for frame soundLoop 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 soundName Descriptio...

Page 193: ...tartFrame 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 the six frames from Frame 5 to Frame 10 Therefore the value of stFrame at any frame between Frame 5 and Frame 10 is 4 remember that index values are different from frame number...

Page 194: ...lability Flash MX 2004 Usage frame tweenType Description Property a string that specifies the type of tween valid values are motion shape or none The value none removes the motion tween Use the timeline createMotionTween method to create a tween If you specify motion the object in the frame must be a symbol text field or grouped object It will be tweened from its location in the current keyframe t...

Page 195: ...ing methods are available for the halfEdge object Property summary for the HalfEdge object The following properties are available for the halfEdge object halfEdge getEdge Availability Flash MX 2004 Usage halfEdge getEdge Parameters None Returns An Edge object Method Description halfEdge getEdge Gets the Edge object for the halfEdge object halfEdge getNext Gets the next half edge on the current con...

Page 196: ...dge getNext Parameters None Returns A halfEdge object Description Method gets the next half edge on the current contour Note Although half edges have a direction and a sequence order edges do not 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...

Page 197: ...04 Usage halfEdge getPrev Parameters None Returns A halfEdge object Description Method gets the preceding halfEdge object on the current contour Note Although half edges have a direction and a sequence order edges do not 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 edges 0 g...

Page 198: ...ntDOM selection 0 var edge shape edges 0 var hEdge edge getHalfEdge 0 var vertex hEdge getVertex 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 selection 0 alert shape cont...

Page 199: ...compiled clip Example The following example shows that the instance type of a movie clip is symbol select a movie clip then run this script var type fl getDocumentDOM selection 0 instanceType fl trace This instance type is type instance libraryItem Availability Flash MX 2004 Usage instance libraryItem Description Property a library item used to instantiate this instance You can change this propert...

Page 200: ...200 Chapter 3 Objects Example The following example changes the selected symbol to refer to the first item in the library fl getDocumentDOM selection 0 libraryItem fl getDocumentDOM library items 0 ...

Page 201: ...e type of element item linkageClassName Property a string that specifies the ActionScript 2 0 class that will be associated with the symbol item linkageExportForAS Property a Boolean value If true the item is exported for ActionScript item linkageExportForRS Property a Boolean value If true the item is exported for runtime sharing item linkageExportInFirstFrame Property a Boolean value If true the...

Page 202: ...is integer the value of data must be an integer and so on Returns Nothing Description Method adds specified data to a library item Example The following example adds data named myData with an integer value of 12 to the first item in the library fl getDocumentDOM library items 0 addData myData integer 12 item getData Availability Flash MX 2004 Usage item getData name Parameters name A string that s...

Page 203: ...od determines whether the library item has the named data 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 itemType Description Read only property a string that specifies the type of elemen...

Page 204: ...ted 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 Description Property a Boolean value If true the item is exported for ActionScript You can also set the item linkageExportForRS and item linkageExportInFirstFrame properties to true The item linkageImportForRS ...

Page 205: ...t appear on the Stage it isn t exported This property can be set to true only when item linkageExportForAS and or item linkageExportForRS are set to true Example The following example specifies that the specified library item is exported in the first frame fl getDocumentDOM library items 0 linkageExportInFirstFrame true item linkageIdentifier Availability Flash MX 2004 Usage item linkageIdentifier...

Page 206: ...rary item fl getDocumentDOM library items 0 linkageImportForRS true 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 Must be set when item linkageExportForRS or item linkageImportForRS is set to true You can specify a web URL or a file name in platform dependent format tha...

Page 207: ...e of the specified library item in the Output panel fl trace fl getDocumentDOM library items 0 name item removeData Availability Flash MX 2004 Usage item removeData name Parameters name Specifies 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 data named myData from the...

Page 208: ...cifies the color assigned to outline the layer layer frameCount Read only an integer that specifies the number of frames in the layer layer frames Read only an array of Frame objects layer height Property an integer that specifies the percentage layer height equivalent to the Layer height value in the Layer Properties dialog box layer layerType Property a string that specifies the current use of t...

Page 209: ...r Example The following example stores the number of frames in the first layer in the fcNum variable var fcNum fl getDocumentDOM getTimeline layers 0 frameCount 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...

Page 210: ...ocumentDOM getTimeline layers 0 height The following example sets the height of the first layer to 300 percent fl getDocumentDOM getTimeline layers 0 height 300 layer layerType Availability Flash MX 2004 Usage layer layerType Description Property a string that specifies the current use of the layer equivalent to the Type setting in the Layer Properties dialog box Acceptable values are normal guide...

Page 211: ...ility Flash MX 2004 Usage layer name Description Property a string that specifies the name of the layer Example The following example sets the name of the first layer in the current document to foreground fl getDocumentDOM getTimeline layers 0 name foreground layer outline Availability Flash MX 2004 Usage layer outline Description Property a Boolean value that specifies the status of outlines for ...

Page 212: ...mple uses two layers at the same level on the same Timeline The first layer layers 0 is converted into a folder and then set as the parent folder of the second layer layers 1 This action moves the second layer inside the first layer var parLayer fl getDocumentDOM getTimeline layers 0 parLayer layerType folder fl getDocumentDOM getTimeline layers 1 parentLayer parLayer layer visible Availability Fl...

Page 213: ...itItem Method opens the currently selected or specified item in Edit mode library expandFolder Method expands or collapses the currently selected or specified folder in the library library findItemIndex Method returns the library item s index value zero based library getItemProperty Method gets the property for the selected item library getItemType Method gets the type of object currently selected...

Page 214: ...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 adds the item Symbol1 located in folder1 of the library to the Stage at the 550 485 position fl getDocumentDOM library addItemToDocument x 550 0 y ...

Page 215: ...escription Method creates a new item of the specified type in the Library panel and sets the new item to the currently selected item Example The following example creates a new button item named start in a new folder named folderTwo fl getDocumentDOM library addNewItem button folderTwo start library deleteItem Availability Flash MX 2004 Usage library deleteItem namePath Parameters namePath A strin...

Page 216: ...t specifies the name of the item to duplicate If the item is in a folder you can specify its name and path using slash notation This parameter is optional 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...

Page 217: ...er 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 if true all the folders within the specified folder are expanded or collapsed based on the value of bExpand The default value is false This parameter is optional namePath A string that specifies the name and o...

Page 218: ... item square which is in the test folder in the variable sqIndex and then displays the index value in a dialog box var sqIndex fl getDocumentDOM library findItemIndex test square alert sqIndex library getItemProperty Availability Flash MX 2004 Usage library getItemProperty property Parameters property A string For a list of values that you can use as a property parameter see the Property summary f...

Page 219: ...font sound bitmap and compiled clip Description Method gets the type of object currently selected or specified by a library path Example The following example shows a dialog box that contains the item type of Symbol_1 located in the Folder_1 Folder_2 folder alert fl getDocumentDOM library getItemType Folder_1 Folder_2 Symbol_1 library getSelectedItems Availability Flash MX 2004 Parameters None Ret...

Page 220: ...a Shockwave SWF file into the library as a compiled clip Unlike File Import SWF this method lets you embed a compiled SWF file inside the library There is no corresponding UI functionality and this method must be used with an external library or DLL see Chapter 4 C Level Extensibility on page 369 Example The following example adds the SWF file with the linkageName value of MyMovie to the library a...

Page 221: ...vailability 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 specify an empty string for folderPath itemToMove A string that specifies the name of the item to move If itemToMove is not specified the currently selected items mov...

Page 222: ...ies 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 Method creates a new folder with the specified name or a default name untitled folder if no folderName parameter is provided in the currently selected folder Example...

Page 223: ...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 the library false deselects all library items This parameter is optional Returns Nothing Description Method selects or deselects all items in the library Example The following examples select all the items in the library fl getDocumen...

Page 224: ...pecified item exists false otherwise Description Method selects a specified library item Example The following example changes the current selection in the library to symbol 1 inside untitled folder 1 fl getDocumentDOM library selectItem untitled Folder_1 Symbol_1 The following example extends what is currently selected in the library to include symbol 1 inside untitled folder 1 fl getDocumentDOM ...

Page 225: ...rty Returns Nothing Description Method sets the property for all selected library items ignoring folders Example The following example assigns the value button to the symbolType property for the selected library item or items In this case the item must be a SymbolItem object symbolType is a valid property for SymbolItem objects fl getDocumentDOM library setItemProperty symbolType button library up...

Page 226: ...updated the item successfully false otherwise Description Method updates the specified item Example The following example displays a dialog box that shows whether the currently selected item is updated true or not false alert fl getDocumentDOM library updateItem ...

Page 227: ...Inheritance Element object Instance object LinkedVideoInstance object Availability Flash MX 2004 Description The LinkedVideoInstance object is a subclass of the Instance object There are no unique methods or properties of LinkedVideoInstance CHAPTER 3 Objects ...

Page 228: ... Each parameter must be an object with fields a b c d tx and ty Returns A concatenated object matrix 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 selection 0 var mat fl...

Page 229: ...e mat variable and stores the inverse of the matrix in the inv variable var elt fl getDocumentDOM selection 0 var mat elt matrix var inv fl Math invertMatrix mat 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 Des...

Page 230: ...times its width and three times its height var mat fl getDocumentDOM selection 0 matrix mat a 2 mat d 3 fl getDocumentDOM selection 0 matrix mat Property Description matrix a Property a floating point value that specifies the 0 0 element in the transformation matrix matrix b Property a floating point value that specifies the 0 1 element in the matrix matrix c Property a floating point value that s...

Page 231: ...of a shape it causes Flash to move the shape s right edge along the vertical axis The matrix b and matrix c properties in a matrix represent skewing 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 objec...

Page 232: ...ption 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 matrix tx and matrix ty properties Example In the following example setting tx and ty to 0 moves the registration point of the object to point 0 0 in the document var mat fl getDoc...

Page 233: ... value that specifies the y axis location of a symbol s registration point or the center of a shape It defines the y translation of the transformation You can move an object by setting the matrix tx and matrix ty properties Example See the matrix tx example ...

Page 234: ...urns Nothing Description Method clears the contents of the Output panel You can use this method in a batch processing application to clear a list of errors or to save them incrementally by using this method with outputPanel save Example The following example clears the current contents of the Output panel fl outputPanel clear Method Description outputPanel clear Method clears the contents of the O...

Page 235: ... can also specify that the contents be appended to the contents of a local file rather than being overwritten If the URI is invalid or unspecified an error is reported This method is useful for batch processing For example you can create a JSFL file that compiles several components Any compile errors appear in the Output panel and you can use this method to save the resulting errors to a text file...

Page 236: ...e Output panel terminated by a new line This method shows the Output panel if it is not already visible The outputPanel trace method duplicates the functionality of fl trace Example The following example writes hello world to the Output panel fl outputPanel trace hello world ...

Page 237: ... array parameter removeItem Method removes an element of the list object or array type of a screen or component parameter Property Description parameter category Property string that specifies the category property for the screen parameter or componentInstance parameter parameter listIndex Property an integer that specifies the value of the selected list item parameter name Read only a string that...

Page 238: ...nserted at the end of the array name A string that specifies the name of the item to insert This is a required parameter for object parameters value A string that specifies the value of the item to insert type A string that specifies the type of item to insert Returns Nothing Description Method if a parameter is a list object or array the value property is an array Use this method to insert a valu...

Page 239: ...x 1 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 parameters fl trace name parms 4 name The following example shows the name of the fifth parameter for the specified s...

Page 240: ...s 2 removeItem 1 var newValues parms 2 value fl trace After Removing Item for var prop in newValues fl trace labelPlacement value newValues prop value The following example removes the element at index 1 from the autoKeyNav parameter of a screen open a presentation document var parms fl getDocumentDOM screenOutline screens 1 parameters var values parms 0 value fl trace Original for var prop in val...

Page 241: ...cription Read only property a string that indicates the type of the screen or component parameter The type can be one of the following values Default Array Object List String Number Boolean Font Name Color Collection Web Service URL or Web Service Operation parameter verbose Availability Flash MX 2004 Usage parameter verbose Description Read only property specifies whether the parameter appears in...

Page 242: ...ubicCurve xAnchor yAnchor x2 y2 x3 y3 x4 y4 Parameters xAnchor A floating point number that specifies the x position of the first control point Method Description path addCubicCurve Method appends a cubic Bézier curve segment to the path path addCurve Method appends a quadratic Bézier segment to the path path addPoint Method adds a point to the path path clear Method removes all points from the pa...

Page 243: ...e path Example The following example creates a new path stores it in the myPath variable and assigns the curve to the path var myPath fl drawingLayer newPath myPath addCubicCurve 0 0 10 20 20 20 30 0 path addCurve Availability Flash MX 2004 Usage path addCurve xAnchor yAnchor x2 y2 x3 y3 Parameters xAnchor A floating point value that specifies the x position of the first control point yAnchor A fl...

Page 244: ...int value that specifies the x position of the point y A floating point value that specifies the y position of the point Returns Nothing 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 Usa...

Page 245: ...f the path has no points no points are added Example The following example creates a closed path var myPath fl drawingLayer newPath myPath close path makeShape Availability Flash MX 2004 Usage path makeShape bSupressFill bSupressStroke Parameters bSuppressFill A Boolean value that if set to true suppresses the fill that would be applied to the shape The default value is false This parameter is opt...

Page 246: ...reates a shape with the current fill and no stroke var myPath fl drawingLayer newPath myPath makeShape false true 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 addPoint 0 30 myPath ...

Page 247: ...umber 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 myPath variable var myPath fl drawingLayer newPath var numOfPoints myPath nPts fl trace Number of points in the path numOfPoints displays Number of points in the path 0 ...

Page 248: ... value that enables and disables accessibility for the object s children screen hidden Property a Boolean value that specifies whether a screen is visible screen instanceName Read only a string that represents the instance name used to access the object from ActionScript screen name Read only a string that represents the name of the screen screen nextScreen Read only an object that represents the ...

Page 249: ... screen childScreens Availability Flash MX 2004 Usage screen childScreens Description Read only property the array of child screens for this screen The array is empty if there are no child screens 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 pan...

Page 250: ...04 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 panel That is if forceSimple is true it is the same as the Make Child Object Accessible option being deselected If forceSimple is false it is the same as the Make C...

Page 251: ... hidden property set to false else fl getDocumentDOM screenOutline setScreenProperty hidden true fl trace fl getDocumentDOM screenOutline screens 0 name had its hidden property set to true screen instanceName Availability Flash MX 2004 Usage screen instanceName Description Read only property a string that represents the instance name used to access the object from ActionScript Example The followin...

Page 252: ... screen is myName screen nextScreen Availability Flash MX 2004 Usage screen nextScreen Description Read only property an object that represents the next peer screen in the parent s childScreen array That is screen NextScreen is found by moving down an array of child screens to the next screen in the array See screen prevScreen If there isn t a peer screen the value is null Example The following ex...

Page 253: ...me value 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 and parentScreen properties in variables and then shows those values and their parent child relationship in the Outpu...

Page 254: ... nam e fl trace The previous screen to myCurrent is myNext screen silent Availability Flash MX 2004 Usage screen silent Description Property a Boolean value that specifies whether the object is accessible This is equivalent to the inverse logic of the Make Object Accessible setting in the Accessibility panel That is if silent is true it is the same as having the Make Object Accessible option desel...

Page 255: ...tDOM screenOutline screens 1 tabIndex 1 screen timeline Availability Flash MX 2004 Usage screen timeline Description Read only property the Timeline object for the screen Example The following example gets the screenOutline property of the current slide document assigns the array of timeline properties for the first screen to myArray and displays those properties in the Output panel myArray new Ar...

Page 256: ...ent under the currently selected screen screenOutline deleteScreen Method deletes the currently selected screen s or a specified screen and the children of the screen s screenOutline duplicateScreen Method duplicates the currently selected screen s or a specified screen screenOutline getSelectedScreens Method returns an array of Screen objects that are currently selected in the screen outline scre...

Page 257: ...ts 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 copies the slide1 screen from the myTarget fla file on the Desktop into the current document substitute your user name for userName fl getDocument...

Page 258: ...ace myScreen name screenOutline deleteScreen Availability Flash MX 2004 Usage screenOutline deleteScreen screenName Parameters screenName A string that specifies the name of the screen to be deleted If you don t pass a value for screenName the currently selected screen s and their children are deleted This parameter is optional Returns Nothing Description Method deletes the currently selected scre...

Page 259: ...reen_copy Screen_copy2 and so on If you duplicate multiple screens the duplicates are placed directly below the selected screen that is lowest in the screen outline hierarchy Example The following example duplicates a screen named apple fl getDocumentDOM screenOutline duplicateScreen apple screenOutline getSelectedScreens Availability Flash MX 2004 Usage screenOutline getSelectedScreens Parameters...

Page 260: ...g that specifies the name of the screen type to attach to the new nested screen The screen type and classname will be set for this screen If this parameter is not specified the type is inherited from the parent screen Acceptable values are Form and Slide Returns A Screen object Description Method inserts a nested screen of a specific type into a particular location in the screen outline Example Th...

Page 261: ...example inserts a form named slide2 after the screen named slide1 fl getDocumentDOM screenOutline insertScreen slide2 slide1 Form The following example inserts a slide named slide4 after the screen slide3 fl getDocumentDOM screenOutline insertScreen slide4 slide3 Slide screenOutline moveScreen Availability Flash MX 2004 Usage screenOutline moveScreen screenToMove referenceScreen position Parameter...

Page 262: ...eter is optional bDisplayError A Boolean value that if set to true shows an error message if an error occurs for example if a screen with the same name as the value passed to newScreenName already exists The default value is false Returns A Boolean value true if the renaming is successful false otherwise Description Method changes the screen with a specified name to a new name Example The followin...

Page 263: ...d 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 push fl getDocumentDOM screenOutline screens i name fl trace The screens array contains objects whose names are myArray screenOutline setCurrentScreen Availability Flash MX 2004 Usage screenOutline setCurrentScreen name Parameters name...

Page 264: ...s Nothing Description Method sets the specified property with the specified value for the selected screens Example The following example changes the visibility of the currently selected screens from hidden to visible fl getDocumentDOM screenOutline setScreenProperty hidden false screenOutline setSelectedScreens Availability Flash MX 2004 Usage screenOutline setSelectedScreens selection bReplaceCur...

Page 265: ...reen with the last index value of the selection array is focused on the Stage Example The following example deselects any currently selected screens and then selects screens slide1 slide2 slide3 and slide4 in the screen outline myArray new Array slide1 slide2 slide3 slide4 fl getDocumentDOM screenOutline setSelectedScreens myArray true ...

Page 266: ...ement object methods you can use the following methods with the Shape object Property summary for the Shape object In addition to the Element object properties the following properties are available for the Shape object shape beginEdit Availability Flash MX 2004 Usage shape beginEdit Parameters None Method Description shape beginEdit Method defines the start of an edit session shape deleteEdge Met...

Page 267: ...tours Availability Flash MX 2004 Usage shape contours Description Read only property an array of Contour objects for the shape see Contour object 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 Ava...

Page 268: ...rray 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 or any of its subordinate parts will be applied to the shape You must use this method after issuing any commands that change the Shape object or any of its subordina...

Page 269: ...em is a group var sel fl getDocumentDOM selection 0 var theShapeIsReallyAGroup sel elementType shape sel isGroup 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 that object ...

Page 270: ...ression type soundItem bits A string that specifies the bits value for a sound in the library that has ADPCM compression Acceptable values are 2 bit 3 bit 4 bit and 5 bit when the type of compression is ADPCM soundItem compressionType A string that specifies that compression type for a sound in the library Acceptable values are Default ADPCM MP3 Raw and Speech soundItem convertStereoToMono A Boole...

Page 271: ...e alert fl getDocumentDOM library items 0 bitRate soundItem bits Availability Flash MX 2004 Usage soundItem bits Description Property a string that specifies the bits value for a sound in the library that has ADPCM compression Acceptable values are 2 bit 3 bit 4 bit and 5 bit Example The following example displays the bits value in the Output panel if the currently selected item in the library has...

Page 272: ...gnored and forced to true 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 soundItem quality Availability Flash MX 2004 Usage soundItem quality Description Property a string that specifies the playback quality of a sound in the library This property is available only for...

Page 273: ...tting checked Example The following example sets the sample rate of an item in the library to 5 kHz if the item has ADPCM Raw or Speech compression type fl getDocumentDOM library items 0 sampleRate 5 kHz soundItem useImportedMP3Quality Availability Flash MX 2004 Usage soundItem useImportedMP3Quality Description Property a Boolean value If true all other properties are ignored and the imported MP3 ...

Page 274: ...A color string in hexadecimal rrggbb format or an integer containing the value stroke curve A string that specifies type of hatching for the stroke stroke dash1 An integer that specifies the lengths of the solid part of a dashed line stroke dash2 An integer that specifies the lengths of the blank part of a dashed line stroke density A string that specifies the density of a stippled line stroke dot...

Page 275: ...e myStroke stroke color Availability Flash MX 2004 Usage stroke color Description Property a color string in hexadecimal rrggbb format or an integer containing the value This property represents the stroke color Example The following example sets the stroke color var myStroke fl getDocumentDOM getCustomStroke myStroke color 000000 fl getDocumentDOM setCustomStroke myStroke stroke curve Availabilit...

Page 276: ...Stroke jiggle wild myStroke rotate free myStroke length slight myStroke hatchThickness thin fl getDocumentDOM setCustomStroke myStroke stroke dash1 Availability Flash MX 2004 Usage stroke dash1 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 Example The following example set...

Page 277: ...y 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 getDocumentDOM setCustomStroke myStroke stroke dotSize Availability Flash MX 2004 Usage stroke dotSize Description Property a string that specifies the dot size of a stippled line This property is a...

Page 278: ... dotSpace 3 fl getDocumentDOM setCustomStroke myStroke stroke hatchThickness Availability Flash MX 2004 Usage stroke hatchThickness Description Property a string that specifies the thickness of a hatch line This property is available only if the stroke style property is set to hatched Acceptable values are hairline thin medium and thick Example The following example sets the hatchThickness propert...

Page 279: ...te free myStroke length slight myStroke hatchThickness thin fl getDocumentDOM setCustomStroke myStroke stroke length Availability Flash MX 2004 Usage stroke length 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 Acceptable values are equal slight variation medium variation and random Example The ...

Page 280: ...e style ragged myStroke pattern random fl getDocumentDOM setCustomStroke myStroke stroke rotate Availability Flash MX 2004 Usage stroke rotate Description Property a string that specifies the rotation of a hatch line This property is available only if the stroke style property is set to hatched Acceptable values are none slight medium and free Example The following example sets the rotate property...

Page 281: ...etCustomStroke myStroke stroke style Availability Flash MX 2004 Usage stroke style Description Property a string that describes the stroke style Acceptable values are noStroke solid dashed dotted ragged stipple and hatched Some of these values require additional properties of the stroke object to be set as described in the following list If value is solid or noStroke there are no other properties ...

Page 282: ...ke myStroke thickness 2 fl getDocumentDOM setCustomStroke myStroke stroke variation Availability Flash MX 2004 Usage stroke variation Description Property a string that specifies the variation of a stippled line This property is available only if the stroke style property is set to stipple Acceptable values are one size small variation varied sizes and random sizes Example The following example se...

Page 283: ...attern random myStroke waveHeight flat myStroke waveLength short fl getDocumentDOM setCustomStroke myStroke stroke waveLength Availability Flash MX 2004 Usage stroke waveLength Description Property a string that specifies the wave length of a ragged line This property is available only if the stroke style property is set to ragged Acceptable values are very short short medium and long Example The ...

Page 284: ...tor and adjusting the controls on the right of the dialog box symbolInstance colorAlphaPercent An integer that specifies 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 colorBlueAmount An integer that is part of the color transformation for the in...

Page 285: ...Accessibility panel symbolInstance firstFrame A zero based integer that specifies the first frame to appear in the Timeline of the graphic symbolInstance forceSimple A Boolean value that enables and disables the accessibility of the object s children equivalent to the inverse logic of the Make Child Objects Accessible setting in the Accessibility panel symbolInstance loop A string that for graphic...

Page 286: ...llowing example assigns an onClipEvent action to the first item in the first frame of the first layer in the Timeline fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 actionScript onClipEvent enterFrame trace movie clip enterFrame symbolInstance buttonTracking Availability Flash MX 2004 Usage symbolInstance buttonTracking Description Property a string that for button symbols only sets th...

Page 287: ...g example subtracts 100 from the alpha setting of the selected symbol instance fl getDocumentDOM selection 0 colorAlphaAmount 100 symbolInstance colorAlphaPercent Availability Flash MX 2004 Usage symbolInstance colorAlphaPercent Description Property an integer that specifies part of the color transformation for the instance This property is equivalent to using the Color Advanced setting in the Ins...

Page 288: ... inspector the percentage controls on the left of the dialog box This value sets the blue values to a specified percentage Allowable values are from 100 to 100 Example The following example sets the colorBluePercent of the selected symbol instance to 80 fl getDocumentDOM selection 0 colorBluePercent 80 symbolInstance colorGreenAmount Availability Flash MX 2004 Usage symbolInstance colorGreenAmount...

Page 289: ...the color mode as identified in the symbol Property inspector Color pop up menu Acceptable values are none brightness tint alpha and advanced 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 Availabi...

Page 290: ...dPercent 10 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 graphic symbols Example The following example stores the value for the Accessibility panel description of the object in ...

Page 291: ...bles and disables the accessibility of the object s children This property is equivalent to the inverse logic of the Make Child Objects Accessible setting in the Accessibility panel For example if forceSimple is true it is the same as the Make Child Object Accessible option being unchecked If forceSimple is false it is the same as the Make Child Object Accessible option being checked This property...

Page 292: ...associated with the symbol This property is equivalent to the Shortcut field in the Accessibility panel This key is read by the screen readers This property is not available for graphic symbols Example The following example stores the value for the shortcut key of the object in the theShortcut variable var theShortcut fl getDocumentDOM selection 0 shortcut The following example sets the shortcut k...

Page 293: ...ptable values are button movie clip and graphic Example The following example sets the first symbol in the first frame of the first layer in the Timeline of the current document to behave as a graphic symbol fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 symbolType graphic symbolInstance tabIndex Availability Flash MX 2004 Usage symbolInstance tabIndex Description Property an integer t...

Page 294: ...dClip Method Description symbolItem convertToCompiledClip Method converts a symbol item in the library to a compiled movie clip symbolItem exportSWC Method exports the symbol to a SWC file symbolItem exportSWF Method exports the symbol item to a SWF file specified by a URI Property Description symbolItem sourceAutoUpdate Property a Boolean value If true the item is updated when the FLA is publishe...

Page 295: ...RI Parameters The outputURI parameter is a string that specifies the URI for the SWC file to which the method will export the symbol The URI must reference a local file Flash does not create a folder if the specified path does not exist Returns Nothing Description Method exports the symbol to a SWC file Example The following example exports an item in the library to the SWC file named my swc in th...

Page 296: ...y Flash MX 2004 Usage symbolItem sourceAutoUpdate Description Property a Boolean value If true the item is updated when the FLA is published The default value is false Used for Shared Library symbols Example The following example sets the sourceAutoUpdate property for a library item fl getDocumentDOM library items 0 sourceAutoUpdate true symbolItem sourceFilePath Availability Flash MX 2004 Usage s...

Page 297: ...yName symbolItem symbolType Availability Flash MX 2004 Usage symbolItem symbolType Description Property a string that specifies the type of symbol Acceptable values are movie clip button and graphic Example The following example shows the current value of the symbolType property changes it to button and shows it again alert fl getDocumentDOM library items 0 symbolType fl getDocumentDOM library ite...

Page 298: ... 3 Objects Example The following example obtains and shows the number of layers that the selected movie clip in the library contains var tl fl getDocumentDOM library getSelectedItems 0 timeline alert tl layerCount ...

Page 299: ...rty a string that determines the baseline for the text textAttrs characterSpacing Property an integer that represents the space between characters textAttrs face Property a string that represents the name of the font such as Arial textAttrs fillColor Property a string that specifies the fill color textAttrs indent Property an integer that specifies paragraph indentation textAttrs italic Property a...

Page 300: ...extAttrs alignment 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 affect characters outside the specified range if they are in the same paragraph fl getDocumentDOM setTextSelection 0 3...

Page 301: ...lowing example selects the first character of the selected text object and sets the bold property to true fl getDocumentDOM setTextSelection 0 1 fl getDocumentDOM setElementTextAttr bold true textAttrs characterPosition Availability Flash MX 2004 Usage textAttrs characterPosition Description Property a string that determines the baseline for the text Acceptable values are normal subscript and supe...

Page 302: ...0 textAttrs face Availability Flash MX 2004 Usage textAttrs face Description Property a string that represents the name of the font such as Arial Example The following example sets the font of the selected text field from the character at index 2 up to but not including the character at index 8 to Arial fl getDocumentDOM selection 0 setTextAttr face Arial 2 8 textAttrs fillColor Availability Flash...

Page 303: ...s the indentation of the selected text field from the character at index 2 up to but not including the character at index 8 to 100 This can affect characters outside the specified range if they are in the same paragraph fl getDocumentDOM selection 0 setTextAttr indent 100 2 8 textAttrs italic Availability Flash MX 2004 Usage textAttrs italic Description Property a Boolean value A value of true cau...

Page 304: ...teger 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 lineSpacing property to 100 fl getDocumentDOM selection 0 setTextAttr lineSpacing 100 textAttrs rightMargin Availability Flash MX 2004 Usage textAttrs rightMargin Description Property an integer that specifies the paragraph s right margin...

Page 305: ... of the selected text field to true fl getDocumentDOM setElementTextAttr rotation true textAttrs size Availability Flash MX 2004 Usage textAttrs size Description Property an integer that specifies the size of the font Example The following example retrieves the size of the character at index 2 and shows the result in the Output panel fl outputPanel trace fl getDocumentDOM selection 0 getTextAttr s...

Page 306: ...cumentDOM getTimeline layers 0 frames 0 ele ments 0 getTextAttr target textAttrs url Availability Flash MX 2004 Usage textAttrs url Description Property a string that represents the URL property of the text field This property works only with static text Example The following example sets the URL of the selected text field to http www macromedia com fl getDocumentDOM setElementTextAttr url http ww...

Page 307: ...r the Text object In addition to the Element object properties the following properties are available for the Text object Method Description text getTextAttr Method retrieves the specified attribute for the text identified by the optional startIndex and endIndex parameters text getTextString Method retrieves the specified range of text text setTextAttr Method sets the specified attribute associate...

Page 308: ...ollable Property a Boolean value that controls whether the text can true or cannot false be scrolled text selectable Property a Boolean value that controls whether the text can true or cannot false be selected Input text is always selectable text selectionEnd Property a zero based integer that specifies the offset of the end of a text subselection text selectionStart Property a zero based integer ...

Page 309: ...d 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 expand to show all text Example The following example sets the autoExpand property to a value of true fl getDocumentDOM selection 0 autoExpand true text border Availability Flash M...

Page 310: ...cription of the object fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 description Enter your name here text embeddedCharacters Availability Flash MX 2004 Usage text embeddedCharacters Description Property a string that specifies characters to embed This is equivalent to entering text in the Character Options dialog box This property works only with dynamic or input text it generates a ...

Page 311: ...operty summary for the TextAttrs object startIndex An integer that is the index of first character This parameter is optional endIndex An integer that specifies the end of the range of text which starts with startIndex and goes up to but does including endIndex This parameter is optional Returns The value of the attribute specified in the attrName parameter Description Method retrieves the attribu...

Page 312: ...f text which starts from startIndex and goes up to but not including endIndex This parameter is optional Returns A string of the text in the specified range 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 ...

Page 313: ...s 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 input text Example The following example sets the lineType property to the value multiline no wrap fl getDocumentDOM selection 0 lineType multiline no wrap text maxCharacters Availability Flash MX 2004 Usag...

Page 314: ...s a warning if used with other text types Example The following example sets the orientation property to vertical right to left fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 orientation vertical right to left text renderAsHTML Availability Flash MX 2004 Usage text renderAsHTML Description Property a Boolean value If the value is true Flash draws the text as HTML and interprets embedde...

Page 315: ... selectable Availability Flash MX 2004 Usage text selectable Description Property a Boolean value If the value is true the text can be selected Input text is always selectable It generates a warning when set to false and used with input text Example The following example sets the selectable property to true fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 selectable true text selectionEn...

Page 316: ...t 5 The following example selects the characters Barbara from a text field that contains the text My name is Barbara and formats them as bold and green fl getDocumentDOM selection 0 selectionStart 11 fl getDocumentDOM selection 0 selectionEnd 18 var s fl getDocumentDOM selection 0 selectionStart var e fl getDocumentDOM selection 0 selectionEnd fl getDocumentDOM setElementTextAttr bold true s e fl ...

Page 317: ... startIndex and goes up to but not including the character located at endIndex Example The following example sets the selected text field to italic fl getDocumentDOM selection 0 setTextAttr italic true The following example sets the size of the third character to 10 fl getDocumentDOM selection 0 setTextAttr size 10 2 The following example sets the color to red for the third through the eighth char...

Page 318: ...ext field is now 0123abc4567890 The following example replaces the text from the third through the eighth character of the selected text string with the string abcdefghij Characters between startIndex and endIndex are overwritten Characters beginning with endIndex follow the inserted string fl getDocumentDOM selection 0 setTextString 01234567890 fl getDocumentDOM selection 0 setTextString abcdefgh...

Page 319: ... getDocumentDOM getTimeline layers 0 frames 0 elements 0 silent The following example sets the object to be accessible fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 silent false text tabIndex Availability Flash MX 2004 Usage text tabIndex Description Property an integer that is equivalent to the Tab Index field in the Accessibility panel This value lets you determine the order in whic...

Page 320: ... string that specifies the type of text field Acceptable values are static dynamic and input Example The following example sets the textType property to input fl getDocumentDOM selection 0 textType input text useDeviceFonts Availability Flash MX 2004 Usage text useDeviceFonts Description Property a Boolean value A value of true causes Flash to draw text using device fonts This property works only ...

Page 321: ...ty 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 322: ...h MX 2004 Usage textRun characters Description Property the text contained in the TextRun object Example The following example displays the characters that make up the first run of characters in the selected text field in the Output panel fl trace fl getDocumentDOM selection 0 textRuns 0 characters textRun textAttrs Availability Flash MX 2004 Usage textRun textAttrs Description Property the TextAt...

Page 323: ...g example displays the properties of the first run of characters in the selected text field in the Output panel var curTextAttrs fl getDocumentDOM selection 0 textRuns 0 textAttrs for var prop in curTextAttrs fl trace prop curTextAttrs prop ...

Page 324: ...t layer to the newly added guide layer timeline addNewLayer Adds a new layer to the document and makes it the current layer timeline clearFrames Deletes all the contents from a frame or range of frames on the current layer timeline clearKeyframes Converts a keyframe to a regular frame and deletes its contents on the current layer timeline convertToBlankKeyframes Converts frames to blank keyframes ...

Page 325: ... from the Clipboard into the specified frames timeline removeFrames Deletes the frame timeline reorderLayer Moves the first specified layer before or after the second specified layer timeline reverseFrames Reverses a range of frames timeline selectAllFrames Selects all the frames in the current Timeline timeline setFrameProperty Sets the property of the Frame object for the selected frames timelin...

Page 326: ...mal It has no effect on a layer whose type is Folder Mask Masked Guide or Guided Example The following example adds a motion guide layer above the current layer and converts the current layer to Guided fl getDocumentDOM getTimeline addMotionGuide timeline addNewLayer Availability Flash MX 2004 Usage timeline addNewLayer name layerType bAddAbove timeline frameCount Read only an integer that represe...

Page 327: ...lowing 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 addNewLayer Folder1 folder true timeline clearFrames Availability Flash MX 2004 Usage timeline clearFrames startFrameIndex endFrameIndex Parameter...

Page 328: ...ero based index that defines the end of the range of frames to clear The range goes up to but does not include endFrameIndex If you specify only startFrameIndex endFrameIndex defaults to the value of startFrameIndex This parameter is optional Returns Nothing Description Method converts a keyframe to a regular frame and deletes its contents on the current layer Example The following example clears ...

Page 329: ...m frame number values fl getDocumentDOM getTimeline convertToBlankKeyframes 1 9 The following example converts Frame 5 to a blank keyframe fl getDocumentDOM getTimeline convertToBlankKeyframes 4 timeline convertToKeyframes Availability Flash MX 2004 Usage timeline convertToKeyframes startFrameIndex endFrameIndex Parameters startFrameIndex A zero based index that specifies the first frame to conver...

Page 330: ... 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 copying The range of frames to copy goes up to but does not include endFrameIndex If you specify only startFrameIndex endFrameIndex defaults to the value of startFrameIndex This parameter is optional Returns Nothing Description Met...

Page 331: ...erty to motion for each selected keyframe on the current layer and converts each frame s contents to a single symbol instance if necessary This property is the equivalent to the Create Motion Tween menu item in the Flash authoring tool 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 mo...

Page 332: ...e layer in the curLayer variable var curLayer fl getDocumentDOM getTimeline currentLayer timeline cutFrames Availability Flash MX 2004 Usage timeline cutFrames startFrameIndex endFrameIndex Parameters startFrameIndex A zero based index that specifies the beginning of a range of frames to cut If you omit startFrameIndex the method uses the current selection This parameter is optional endFrameIndex ...

Page 333: ...lity Flash MX 2004 Usage timeline deleteLayer index Parameters index A zero based index that specifies the layer to be deleted If there is only one layer in the Timeline this method has no effect This parameter is optional Returns Nothing Description Method deletes a layer If the layer is a folder all layers within the folder are deleted If you do not specify the layer index Flash deletes the curr...

Page 334: ...ion Method expands or collapses the specified folder or folders If you do not specify a layer this method operates on the current layer Example The following examples use this folder structure Folder 1 layer 7 Folder 2 Layer 5 The following example expands Folder 1 only fl getDocumentDOM getTimeline currentLayer 1 fl getDocumentDOM getTimeline expandFolder true The following example expands Folder...

Page 335: ... layerIndex fl getDocumentDOM getTimeline findLayerIndex Layer 1 fl getDocumentDOM getTimeline setSelectedLayers layerIndex 0 true timeline frameCount Availability Flash MX 2004 Usage timeline frameCount 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...

Page 336: ...in the Output panel fl getDocumentDOM getTimeline currentLayer 0 fl getDocumentDOM getTimeline setSelectedFrames 0 0 true var frameName fl getDocumentDOM getTimeline getFrameProperty name fl trace frameName timeline getLayerProperty Availability Flash MX 2004 Usage timeline getLayerProperty property Parameters property A string that specifies the name of the property whose value you want to retrie...

Page 337: ...yer the following example displays 0 5 10 0 20 25 in the Output panel var timeline fl getDocumentDOM getTimeline timeline setSelectedFrames 5 10 timeline setSelectedFrames 20 25 false var theSelectedFrames timeline getSelectedFrames fl trace theSelectedFrames timeline getSelectedLayers Availability Flash MX 2004 Parameters None Returns An array of the zero based index values of the selected layers...

Page 338: ...already a keyframe no keyframe is inserted but the playhead moves to Frame 6 Returns Nothing Description Method inserts a blank keyframe at the specified frame index if the index is not specified the method inserts the blank keyframe by using the playhead selection See also timeline insertKeyframe Example The following example inserts a blank keyframe at Frame 20 remember that index values are dif...

Page 339: ...ied and bAllLayers is true inserts the specified number of frames at the current frame on all layers If all three parameters are specified inserts the specified number of frames at the specified index frameIndex the value passed for bAllLayers determines if the frames are added only to the current layer or to all layers If the specified or selected frame is a regular frame the frame is inserted at...

Page 340: ... 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 frame it converted that is it s not blank Example The following example inserts a keyframe at the playhead or selected location fl ...

Page 341: ...ocument var currentLayers fl getDocumentDOM getTimeline layers timeline name Availability Flash MX 2004 Usage timeline name Description Property a string that specifies the name of the current Timeline This name is the name of the current scene screen slide or form or symbol that is being edited Example The following example retrieves the first scene name var sceneName fl getDocumentDOM timelines ...

Page 342: ...rames on the Clipboard at Frame 2 up to but not including Frame 10 remember that index values are different from frame number values fl getDocumentDOM getTimeline pasteFrames 1 9 The following example pastes the frames on the Clipboard starting at Frame 5 fl getDocumentDOM getTimeline pasteFrames 4 timeline removeFrames Availability Flash MX 2004 Usage timeline removeFrames startFrameIndex endFram...

Page 343: ...o 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 first layer bAddBefore Specifies whether to move the layer before or after layerToPutItBy If you specify false the layer is moved after layerToPut...

Page 344: ...Index If you specify only startFrameIndex endFrameIndex defaults to the value of startFrameIndex This parameter is optional 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 Frame 15...

Page 345: ...dify If you omit startFrameIndex the method uses the current selection This parameter is optional endFrameIndex A zero based index that specifies the first frame at which to stop The range of frames goes up to but does not include endFrameIndex If you specify startFrameIndex but omit endFrameIndex endFrameIndex defaults to the value of startFrameIndex This parameter is optional Returns Nothing Des...

Page 346: ...s Nothing Description Method sets the specified property on all the selected layers to a specified value 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 timeline setSelectedFrames Availab...

Page 347: ...cted 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 getTimeline getSelectedFrames do something that changes the selection fl getDocumentDOM getTimeline setSelectedFrames savedSelectionList The following example selects the top layer Fr...

Page 348: ...ng Availability Flash MX 2004 Usage timeline showLayerMasking layer Parameters layer A zero based index of a mask or masked layer to show masking during authoring This parameter is optional Returns Nothing Description Method shows the layer masking during authoring by locking the mask and masked layers This method uses the current layer if no layer is specified If you use this method on a layer th...

Page 349: ...lObj setMenuString Sets the string that appears in the pop up menu as the name for the tool toolObj setOptionsFile Associates an XML file located in the Configuration Tools folder with the tool to appear in a modal panel that is invoked by an Options button in the Property inspector toolObj setPI Sets a particular Property inspector to be used when the tool is activated toolObj setToolName Assigns...

Page 350: ...the following controls A movie Property inspector has the following controls bEnable A Boolean value that determines whether to enable true or disable false the control Returns Nothing Description Method enables or disables the specified control in a PI Used only when creating extensible tools stroke fill type font pointsize color bold italic direction alignLeft alignCenter alignRight alignJustify...

Page 351: ...l s JavaScript file will show that tool s position in the Tools panel as an integer in the Output panel myToolPos fl tools activeTool position fl trace myToolPos 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 Configuration Tools folder Returns Nothing Descri...

Page 352: ...etMenuString Arrow Style 1 toolObj setOptionsFile Availability Flash MX 2004 Usage toolObj setOptionsFile xmlFile Parameters xmlFile A string that specifies the name of the XML file that has the description of the tool s options Returns Nothing Description Method associates an XML file located in the Configuration Tools folder with the tool to appear in a modal panel that is invoked by an Options ...

Page 353: ...Property inspector should be used when the tool is activated fl tools activeTool setPI text toolObj setToolName Availability Flash MX 2004 Usage toolObj setToolName name Parameters name A string that specifies the name of the tool Returns Nothing Description Method assigns a name to the tool for the configuration of the Tools panel The name is used only by the XML layout file that Flash reads to c...

Page 354: ...activeTool setToolTip Arrow Style 1 Tool toolObj showPIControl Availability Flash MX 2004 Usage toolObj showPIControl control bShow Parameters control A string that specifies the name of the control to show or hide Valid 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 355: ... for that tool fl tools activeTool showPIControl fill false 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 Nothing Description Method called in the configureTool method of an extens...

Page 356: ...ly pressed key tools setCursor Sets the pointer to a specified appearance tools snapPoint Takes a point as input and returns a new point that may be adjusted or snapped to the nearest geometric object Property Description tools activeTool Read only returns the ToolObj object for the currently active tool tools altIsDown Read only a Boolean value that identifies if the Alt key is being pressed tool...

Page 357: ...e that identifies if the Alt key is being pressed The value is true if the Alt key is pressed and false otherwise tools constrainPoint Availability Flash MX 2004 Usage tools constrainPoint pt1 pt2 Parameters pt1 and pt2 specify the starting click point and the drag to point Description Method takes two points and returns a new adjusted or constrained point If the Shift key is pressed then the retu...

Page 358: ...y Flash MX 2004 Usage tools getKeyDown Parameters None Returns The integer value of the key Description Method returns the most recently pressed key tools mouseIsDown Availability Flash MX 2004 Usage tools mouseIsDown Description Read only property a Boolean value that identifies if a mouse button is currently pressed The value is true if the left mouse button is currently down and false if the mo...

Page 359: ... that represents the current location of the mouse penLoc has two properties x and y corresponding to the x y location of the mouse on the current document tools setCursor Availability Flash MX 2004 Usage tools setCursor cursor Parameters cursor An integer that defines the pointer appearance as described in the following list 0 Plus cursor 1 black arrow 2 white arrow 3 four way arrow 4 two way hor...

Page 360: ...ools snapPoint Availability Flash MX 2004 Usage tools snapPoint pt Parameters pt specifies the location of the point for which you want to return a snap point 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 turned off in the View menu in the Flash user interface the point returned is the original point...

Page 361: ...r the Vertex object vertex getHalfEdge Availability Flash MX 2004 Usage vertex getHalfEdge Parameters None Returns A HalfEdge object Description Method gets a HalfEdge object that shares this vertex vertex setLocation Availability Flash MX 2004 Method Description vertex getHalfEdge Gets a HalfEdge object that shares this vertex vertex setLocation Sets the location of the vertex Property Descriptio...

Page 362: ...example sets the vertex to the origin point var shape fl getDocumentDOM selection 0 var hEdge shape edges 0 getHalfEdge 0 var vertex hEdge getVertex move the vertex to the origin vertex setLocation 0 0 0 0 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...

Page 363: ...Vertex object 363 vertex y Availability Flash MX 2004 Usage vertex y Description Read only property the y location of the vertex in pixels Example See vertex x ...

Page 364: ...VideoItem object Inheritance Item object VideoItem object Availability Flash MX 2004 Description The VideoItem object is a subclass of the Item object There are no unique methods or properties of VideoItem CHAPTER 3 Objects ...

Page 365: ...ialog box and accept or cancel out of one The XMLUI methods can be used in callbacks such as oncommand handlers in buttons Method summary for the XMLUI object The following methods are available for the XMLUI object xmlui accept Availability Flash MX 2004 Usage xmlui accept Parameters None Returns Nothing Method Description xmlui accept Method makes the current XMLUI dialog box exit with an accept...

Page 366: ...el state which is equivalent to the user clicking the Cancel button xmlui get Availability Flash MX 2004 Usage xmlui get name Parameters name A string that specifies the name of the XMLUI property to retrieve Returns A string value for the specified property In cases where you might expect a Boolean value of true or false it returns the string true or false Description Method retrieves the value o...

Page 367: ...at 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 Description Method modifies the value of the specified property of the current XMLUI dialog box ...

Page 368: ...368 Chapter 3 Objects ...

Page 369: ...m the Dreamweaver API in the following ways This API does not contain all the commands in the Dreamweaver API All declarations of type wchar_t and char in the Dreamweaver API are implemented as unsigned short declarations in this API to support Unicode when strings are passed The JSVal JS_BytesToValue function in this API is not part of the Dreamweaver API The location where DLL or shared library ...

Page 370: ...n returns to package the return value To accomplish these tasks the interpreter defines several data types and exposes an API Definitions for the data types and functions that are listed in this section appear in the mm_jsapi h file For your library to work properly you must include the mm_jsapi h file at the top of each file in your library with the following line include mm_jsapi h Including the...

Page 371: ...r c v l JS_FALSE JSBool JS_ValueToDouble JSContext cx jsval v double dp define JS_ValueToDouble c v d mmEnv valueToDouble mmEnv valueToDouble c v d JS_FALSE JSBool JS_ValueToBoolean JSContext cx jsval v JSBool bp define JS_ValueToBoolean c v b mmEnv valueToBoolean mmEnv valueToBoolean c v b JS_FALSE JSBool JS_ValueToObject JSContext cx jsval v JSObject op define JS_ValueToObject c v o mmEnv valueT...

Page 372: ...nv getArrayLength c o 1 JSBool JS_GetElement JSContext cx JSObject obj jsint idx jsval vp define JS_GetElement c o i v mmEnv getElement mmEnv getElement c o i v JS_FALSE JSBool JS_SetElement JSContext cx JSObject obj jsint idx jsval vp define JS_SetElement c o i v mmEnv setElement mmEnv setElement c o i v JS_FALSE JSBool JS_ExecuteScript JSContext cx JSObject obj unsigned short script unsigned int...

Page 373: ... JSObject obj JSBool getElement JSContext cx JSObject obj unsigned int idx jsval vp JSBool setElement JSContext cx JSObject obj unsigned int idx jsval vp JSBool executeScript JSContext cx JSObject obj unsigned short script unsigned int sz unsigned short file unsigned int lineNum jsval rval JSBool reportError JSContext cx unsigned short error unsigned int sz MM_Environment extern MM_Environment mmE...

Page 374: ...ctually building the DLL you can do the following Store the Sample jsfl file in the Commands directory see Overview of the Macromedia Flash JavaScript API on page 17 Store the Sample dll file in the External Libraries directory see How integrating C functions works on page 369 In the Flash authoring environment select Commands Sample The trace statement in the JSFL file sends the results of the fu...

Page 375: ...de and store it in the Commands directory see Overview of the Macromedia Flash JavaScript API on page 17 JSFL file to run C function defined above var a 5 var b 10 var sum Sample computeSum a b fl trace The sum of a and b is sum To run the function defined in the DLL select Commands Sample in the Flash authoring environment Data types The JavaScript interpreter defines the following data types JSC...

Page 376: ...le 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 JS_ValueToString JSBool JS_ValueToInteger JSBool JS_ValueToDouble JSBool JS_ValueToBoolean JSBool JS_ValueToObject JSBool JS_StringToValue JSBool JS_DoubleToValue JSVal JS_BooleanToValue JSVal J...

Page 377: ..._FALSE otherwise If the function returns JS_FALSE the current script stops executing and an error message appears JSBool JS_DefineFunction Usage JSBool JS_DefineFunction unsigned short name JSNative call unsigned int nargs Description Method registers a C level function with the JavaScript interpreter in Flash After the JS_DefineFunction function registers the C level function that you specify in ...

Page 378: ... to be extracted The pLength argument is a pointer to an unsigned integer This function sets plength equal to the length of the string in bytes Returns A pointer that points to a null terminated string if successful or to a null value on failure The calling routine must not free this string when it finishes JSBool JS_ValueToInteger Usage JSBool JS_ValueToInteger JSContext cx jsval v long lp Descri...

Page 379: ... converted value in dp Returns A Boolean value JS_TRUE indicates success JS_FALSE indicates failure 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 JSContext cx jsval v JSBool bp The cx a...

Page 380: ...cates failure 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 size_t sz jsval vp The cx argument is the opaque JSContext pointer that passes to the JavaScript function The bytes argument...

Page 381: ...es 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 value JS_TRUE indicates success JS_FALSE indicates failure Returns A JSVal structure that contains the Boolean value that passes to the function as an argument JSVal JS_BytesToVal...

Page 382: ...Usage jsval JS_ObjectToValue JSObject obj Description Method stores an object return value in a JSVal Use JS_ NewArrayObject to create an array object use JS_SetElement to define its contents Arguments JSObject obj The obj argument is a pointer to the JSObject object that you want to convert to a JSVal structure Returns A JSVal structure that contains the object that you passed to the function as ...

Page 383: ...aScript 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 stored in the array If the return value is not null v is an array that contains length elements If the return value is null the initial content of the array object is undefined and can be set using the JS_SetElement function Returns A pointer to a new arr...

Page 384: ...val structure in the array should be copied Returns A Boolean value JS_TRUE indicates success JS_FALSE indicates failure JSBool JS_SetElement Usage JSBool JS_SetElement JSContext cx JSObject obj jsint idx jsval vp Description Method writes a single element of an array object Arguments JSContext cx JSObject obj unsigned int index jsval v The cx argument is the opaque JSContext pointer that passes t...

Page 385: ...er to the object in whose context the script executes While the script is running the this keyword is equal to this object Usually this is the JSObject pointer that passes to the JavaScript function The script argument is a string that contains JavaScript code If the string size is not specified see the sz argument the string must be null terminated The sz argument is the size of the string in byt...

Page 386: ...386 Chapter 4 C Level Extensibility ...

Reviews: