background image

23

1

CHAPTER 1

Top-Level Functions and 
Methods

This chapter describes the top-level functions and methods that are available when you use 
the Macromedia Flash JavaScript application programming interface (JavaScript API). For 
information about where to store JavaScript API files, see 

“Saving JSFL files” on page 7

.

The following lists summarize the areas in the authoring environment that relate to each 
function or method. Following the lists, the functions and methods are listed in alphabetical 
order.

Global methods

The following methods can be called from any JavaScript API script:

alert()
confirm()
prompt()

Timeline effects

The following functions are specific to timeline effects:

configureEffect()
executeEffect()
removeEffect()

Содержание FLASH 8-EXTENDING FLASH

Страница 1: ...Extending Flash...

Страница 2: ...2 Opera Software ASA and its suppliers All rights reserved Macromedia Flash 8 video is powered by On2 TrueMotion video technology 1992 2005 On2 Technologies Inc All Rights Reserved http www on2 com Vi...

Страница 3: ...Item object 46 CompiledClipInstance object 49 ComponentInstance object 54 componentsPanel object 55 Contour object 57 Document object 61 drawingLayer object 177 Edge object 185 Effect object 190 Eleme...

Страница 4: ...bject 388 SoundItem object 394 Stroke object 399 SymbolInstance object 414 SymbolItem object 429 Text object 436 TextAttrs object 456 TextRun object 466 Timeline object 468 ToolObj object 499 Tools ob...

Страница 5: ...also assumes that you are familiar with JavaScript or ActionScript syntax and with basic programming concepts such as functions parameters and data types This chapter contains the following sections...

Страница 6: ...aScript language developed by Mozilla org It is the same engine that is embedded in the Mozilla browser SpiderMonkey implements the core JavaScript language as defined in the ECMAScript ECMA 262 editi...

Страница 7: ...e Configuration To determine the location of the Configuration folder use fl configDirectory or fl configURI Within the Configuration folder the following folders can contain scripts that you can acce...

Страница 8: ...he Tools folder in the following location Windows 2000 or Windows XP boot drive Documents and Settings user Local Settings Application Data Macromedia Flash 8 language Configuration Tools Mac OS X Mac...

Страница 9: ...l implemented in a JSFL file to the Tools panel 1 Copy the JSFL file for the tool and any other associated files to the Tools folder see Saving JSFL files on page 7 2 Select Edit Customize Tools Panel...

Страница 10: ...le jsfl end tell Then to invoke the script you would use this command osascript myScript What s new in the JavaScript API In Flash 8 several new top level functions and objects have been added In addi...

Страница 11: ...roperties are new in Flash 8 componentsPanel reload document addFilter document changeFilterOrder document crop document deleteEnvelope document disableAllFilters document disableFilter document disab...

Страница 12: ...Selection fl createProject fl objectDrawingMode fl getAppMemoryInfo fl getProject fl objectDrawingMode fl showIdleMessage frame getCustomEase frame hasCustomEase frame setCustomEase frame useSingleEas...

Страница 13: ...etEnabled xmlui setVisible Other changes The following items have new parameters additional acceptable values for existing parameters or other implementation changes in Flash 8 document setSelectionBo...

Страница 14: ...ocument 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...

Страница 15: ...ent See fl findDocumentIndex To access the document that is currently focused use the statement flash getDocumentDOM or fl getDocumentDOM See fl getDocumentDOM The latter is the syntax used in most of...

Страница 16: ...OM getTimeline layers 0 frames 0 elements 0 if element element width element width 2 element height element height 2 You can also do something such as loop through all the elements on the Stage and in...

Страница 17: ...wing outline 01 Top Level Functions and Methods 01 FLfile object 01 flash object fl 02 componentsPanel object 02 Document object fl documents array 03 Filter object 03 Matrix object 03 Fill object 03...

Страница 18: ...t 07 TextRun object text textRuns array 08 TextAttrs object textRun textAttrs array 06 Shape object subclass of Element object 07 Contour object shape contours array 08 HalfEdge object 09 Vertex objec...

Страница 19: ...the default setting the samples are placed in the following location In Windows boot drive Program Files Macromedia Flash 8 Samples and Tutorials Samples ExtendingFlash On the Macintosh Macintosh HD A...

Страница 20: ...ltersGetSet to run the script Sample PolyStar tool A sample JavaScript API script named PolyStar jsfl is located in the ExtendingFlash PolyStar folder see Sample implementations on page 19 The PolySta...

Страница 21: ...that you will install later When you restart Flash the PolyStar tool no longer appears in the Customize Tools Panel dialog box To install the updated PolyStar example files 1 If Flash is running exit...

Страница 22: ...the TraceBitmap swf file to the Configuration WindowSWF folder see Saving JSFL files on page 7 3 Start Flash 4 Create or open a Flash document FLA file and import a bitmap or JPEG image into the file...

Страница 23: ...vaScript API files see Saving JSFL files on page 7 The following lists summarize the areas in the authoring environment that relate to each function or method Following the lists the functions and met...

Страница 24: ...Up mouseDoubleClick mouseDown mouseMove mouseUp notifySettingsChanged setCursor activate Availability Flash MX 2004 Usage function activate statements Parameters None Returns Nothing Description Funct...

Страница 25: ...ool alert Availability Flash MX 2004 Usage alert alertText Parameters alertText A string that specifies the message you want to display in the Alert dialog box Returns Nothing Description Method displ...

Страница 26: ...g Description Function called once when Flash loads place any global initialization statements for your effect inside this function The per instance parameter data for an effect cannot be accessed her...

Страница 27: ...string theTool setToolTip my tool s tool tip theTool setOptionsFile mtTool xml function configureTool theTool fl tools activeTool theTool setToolName ellipse theTool setIcon Ellipse png theTool setMe...

Страница 28: ...ction deactivate statements Parameters None Returns Nothing Description Function called when the extensible tool becomes inactive that is when the active tool changes from this tool to another one Use...

Страница 29: ...ffect or changes an effect s properties The code contained in this function modifies the original object s to create the desired effect It is also responsible for copying the original to a hidden laye...

Страница 30: ...The following example displays information about which key was pressed when the extensible tool is active and the user presses a key function keyDown fl trace key fl tools getKeyDown was pressed See a...

Страница 31: ...Availability Flash MX 2004 Usage function mouseDoubleClick statements Parameters None Returns Nothing Description Function called when the extensible tool is active and the mouse button is double clic...

Страница 32: ...Function called when the extensible tool is active and the mouse button is pressed while the pointer is over the Stage Example The following examples show how this function can be used when the extens...

Страница 33: ...point coordinates are relative to the Stage This parameter is optional Returns Nothing Description Function called whenever the extensible tool is active and the mouse moves over a specified point on...

Страница 34: ...xtensible tool is active and the mouse button is released after being pressed on the Stage Example The following example displays a message in the Output panel when the extensible tool is active and t...

Страница 35: ...its options in the Property inspector function notifySettingsChanged var theTool fl tools activeTool var newValue theTool myProp prompt Availability Flash MX 2004 Usage prompt promptMsg text Paramete...

Страница 36: ...ailability Flash MX 2004 Usage function removeEffect statements Parameters None Returns Nothing Description Function called when the user changes an effect s properties or uses the Remove Effect menu...

Страница 37: ...ion Function called when the extensible tool is active and the mouse moves to allow the script to set custom pointers The script should call tools setCursor to specify the pointer to use For a list th...

Страница 38: ...38 Top Level Functions and Methods...

Страница 39: ...is a subclass of the SymbolInstance object and represents a component in a frame componentsPanel object The componentsPanel object which represents the Components panel is a property of the flash obj...

Страница 40: ...y property of the flash object see fl Math Matrix object The Matrix object represents a transformation matrix outputPanel object The outputPanel object represents the Output panel which displays troub...

Страница 41: ...tAttrs object contains all the properties of text that can be applied to a subselection This object is a subclass of the Text object TextRun object The TextRun object represents a run of characters th...

Страница 42: ...ct In addition to the Instance object properties you can use the following properties with the BitmapInstance object bitmapInstance getBits Availability Flash MX 2004 Usage bitmapInstance getBits Meth...

Страница 43: ...ts you create bitmap effects by getting the bits out of the bitmap manipulating them and then returning them to Flash See also bitmapInstance setBits Example The following code creates a reference to...

Страница 44: ...ght width depth bits and cTab properties The height width and depth properties are integers The bits property is a byte array The cTab property is required only for bitmaps with a bit depth of 8 or le...

Страница 45: ...its See also bitmapInstance getBits bitmapInstance vPixels Availability Flash MX 2004 Usage bitmapInstance vPixels Description Read only property an integer that represents the height of the bitmap th...

Страница 46: ...oothing Availability Flash MX 2004 Usage bitmapItem allowSmoothing Description Property a Boolean value that specifies whether to allow smoothing of a bitmap true or not false Property Description bit...

Страница 47: ...onds to JPEG with a quality from 0 to 100 if bitmapItem useImportedJPEGQuality is true photo corresponds to JPEG using the default document quality value The value lossless corresponds to GIF or PNG f...

Страница 48: ...Flash MX 2004 Usage bitmapItem useImportedJPEGQuality Description Property a Boolean value that specifies whether to use the default imported JPEG quality true or not false Available only for JPEG com...

Страница 49: ...the Accessibility panel compiledClipInstance actionScript A string that represents the ActionScript for this instance equivalent to symbolInstance actionScript compiledClipInstance description A stri...

Страница 50: ...entDOM selection 0 accName Home Button compiledClipInstance actionScript Availability Flash MX 2004 Usage compiledClipInstance actionScript Description Property a string that represents the ActionScri...

Страница 51: ...stance forceSimple Availability Flash MX 2004 Usage compiledClipInstance forceSimple Description Property a Boolean value that enables and disables the children of the object to be accessible This is...

Страница 52: ...the object fl getDocumentDOM selection 0 shortcut Ctrl I compiledClipInstance silent Availability Flash MX 2004 Usage compiledClipInstance silent Description Property a Boolean value that enables or d...

Страница 53: ...o the Tab Index field in the Accessibility panel Creates a tab order in which objects are accessed when the user presses the Tab key Example The following example illustrates getting and setting the t...

Страница 54: ...has the following property componentInstance parameters Availability Flash MX 2004 Usage componentInstance parameters Description Read only property an array of ActionScript 2 0 properties that are ac...

Страница 55: ...le x 0 y 100 that specifies the location at which to add the component Specify position relative to the center point of the component not the component s registration point categoryName A string that...

Страница 56: ...dItemToDocument x 0 y 100 Data WebServiceConnector fl componentsPanel addItemToDocument x 0 y 200 User Interface Button componentsPanel reload Availability Flash 8 Usage componentsPanel reload Paramet...

Страница 57: ...You can use the following properties with the Contour object contour getHalfEdge Availability Flash MX 2004 Usage contour getHalfEdge Parameters None Returns A HalfEdge object Property Description con...

Страница 58: ...n the Output panel with a shape selected 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...

Страница 59: ...t 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 Contour interior c...

Страница 60: ...lue 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...

Страница 61: ...ent addNewLine Adds a new path between two points document addNewOval Adds a new oval in the specified bounding rectangle document addNewPublishProfile Adds a new publish profile and makes it the curr...

Страница 62: ...nesToFills Converts lines to fills on the selected objects document convertToSymbol Converts the selected Stage item s to a new symbol document crop Uses top selected drawing object to crop all select...

Страница 63: ...ode Switches the authoring tool into the editing mode specified by the parameter document exitEditMode Exits from symbol editing mode and returns focus to the next level up from the editing mode docum...

Страница 64: ...nto the document document importSWF Imports a SWF file into the document document intersect Creates an intersection drawing object from all selected drawing objects document match Makes the size of th...

Страница 65: ...tion matrix equivalent to selecting Modify Transform Remove transform document revert Reverts the specified document to its previously saved version equivalent to selecting File Revert document rotate...

Страница 66: ...cts document setInstanceAlpha Sets the opacity of the instance document setInstanceBrightness Sets the brightness for the instance document setInstanceTint Sets the tint for the instance document setM...

Страница 67: ...in the Tools panel document swapElement Swaps the current selection with the specified one document swapStrokeAndFill Swaps the Stroke and Fill colors document testMovie Executes a Test Movie operati...

Страница 68: ...cument forceSimple A Boolean value that specifies whether the children of the specified object are accessible document frameRate A float value that specifies the number of frames displayed per second...

Страница 69: ...cumentDOM accName Main Movie The following example gets the accessibility name of the document fl trace fl getDocumentDOM accName document addDataToDocument Availability Flash MX 2004 Usage document a...

Страница 70: ...alue of 12 to the current document fl getDocumentDOM addDataToDocument myData integer 12 The following example returns the value of the data named myData and displays the result in the Output panel fl...

Страница 71: ...e Parameters filterName A string specifying the filter to be added to the Filter list and enabled for the selected object s Acceptable values are adjustColorFilter bevelFilter blurFilter dropShadowFil...

Страница 72: ...adds the first item from the library to the first document at the specified location for the selected symbol bitmap or video var item fl documents 0 library items 0 fl documents 0 addItem x 0 y 0 item...

Страница 73: ...othing Description Method adds a new path between two points The method uses the document s current stroke attributes and adds the path on the current frame and current layer This method works in the...

Страница 74: ...ration as the oval tool The method uses the document s current default stroke and fill attributes and adds the oval on the current frame and layer If bSuppressFill is set to true the oval is drawn wit...

Страница 75: ...hod adds a new publish profile and makes it the current one Example The following example adds a new publish profile with a default name and then displays the name of the profile in the Output panel f...

Страница 76: ...ctangle would display the following values in the Property inspector X 10 Y 10 W 40 H 90 roundness An integer value from 0 to 999 that specifies the roundness to use for the corners The value is speci...

Страница 77: ...e with no rounding on the corners and without a stroke it is 200 pixels in width and 100 in height flash getDocumentDOM addNewRectangle left 20 top 20 right 220 bottom 120 0 false true document addNew...

Страница 78: ...bility Flash MX 2004 Usage document addNewText boundingRectangle Parameters boundingRectangle Specifies the size and location of the text field for information on the format of boundingRectangle see d...

Страница 79: ...document Otherwise the method uses the bounds of the selected objects The default is false This parameter is optional Returns Nothing Description Method aligns the selection Example The following exa...

Страница 80: ...reens methods can be used in the current document if fl getDocumentDOM allowScreens fl trace screen outline is available else fl trace whoops no screens See also document screenOutline document arrang...

Страница 81: ...lowing 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 auto...

Страница 82: ...s None Returns Nothing Description Method performs a break apart operation on the current selection Example The following example breaks apart the current selection fl getDocumentDOM breakApart docume...

Страница 83: ...tSymbol returns fl getDocumentDOM canEditSymbol document canRevert Availability Flash MX 2004 Usage document canRevert Parameters None Returns A Boolean value true if you can use the document revert o...

Страница 84: ...Description Method determines whether you can use the document testMovie method successfully Example The following example tests whether fl getDocumentDOM testMovie can be used If so it calls the meth...

Страница 85: ...ge document changeFilterOrder oldIndex newIndex Parameters oldIndex An integer that represents the current zero based index position of the filter you want to reposition in the Filters list newIndex A...

Страница 86: ...nd position in the Filter list to the first position fl getDocumentDOM changeFilterOrder 1 0 See also document addFilter document disableFilter document enableFilter document getFilters document remov...

Страница 87: ...ment 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...

Страница 88: ...ue that when set to true causes the method to prompt 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 an...

Страница 89: ...name registrationPoint Parameters type A string that specifies the type of symbol to create Acceptable values are movie clip button and graphic name A string that specifies the name for the new symbo...

Страница 90: ...btnSymbolName bottom right newClipWithDefaultName fl getDocumentDOM convertToSymbol movie clip top left document crop Availability Flash 8 Usage document crop Parameters None Returns A Boolean value...

Страница 91: ...ublish profile to Default fl getDocumentDOM currentPublishProfile Default document currentTimeline Availability Flash MX 2004 Usage document currentTimeline Description Property an integer that specif...

Страница 92: ...cument getTimeline document deleteEnvelope Availability Flash 8 Usage document deleteEnvelope Parameters None Returns A Boolean value true if successful false otherwise Description Method deletes the...

Страница 93: ...d deletes the currently active profile if there is more than one There must be at least one profile left Example The following example deletes the currently active profile if there is more than one an...

Страница 94: ...re 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 var success fl getDocumentDO...

Страница 95: ...ader Example The following example sets the description of the document fl getDocumentDOM description This is the main movie The following example gets the description of the document and displays it...

Страница 96: ...lterIndex Parameters filterIndex An integer representing the zero based index of the filter in the Filter list Returns Nothing Description Method disables the specified filter in the Filters list Exam...

Страница 97: ...les all filters except the one at the specified position in the Filters list Example The following example disables all filters except the second filter in the list index value of 1 fl getDocumentDom...

Страница 98: ...Method distributes the selection Example The following example distributes the selected objects by the top edge fl getDocumentDOM distribute top edge The following example distributes the selected ob...

Страница 99: ...ntHasData Availability Flash MX 2004 Usage document documentHasData name Parameters name A string that specifies the name of the data to check Returns A Boolean value true if the document has persiste...

Страница 100: ...plicated Description Method duplicates the currently active profile and gives the duplicate version focus Example The following example duplicates the currently active profile and displays the index o...

Страница 101: ...sh MX 2004 Usage document duplicateSelection Parameters None Returns Nothing Description Method duplicates the selection on the Stage Example The following example duplicates the current selection whi...

Страница 102: ...deleteScene document enableAllFilters Availability Flash 8 Usage document enableAllFilters Parameters None Returns Nothing Description Method enables all the filters on the Filters list for the selec...

Страница 103: ...le enables the second filter of the selected object s fl getDocumentDOM enableFilter 1 See also document addFilter document changeFilterOrder document disableFilter document enableAllFilters document...

Страница 104: ...d symbol fl getDocumentDOM enterEditMode inPlace The following example puts Flash in edit in new window mode for the currently selected symbol fl getDocumentDOM enterEditMode newWindow See also docume...

Страница 105: ...isplay the Export PNG dialog box false This parameter is optional The default value is false bCurrentFrame A Boolean value that specifies whether to export only the current frame true or to export all...

Страница 106: ...Settings username Desktop on the C drive fl getDocumentDOM exportPublishProfile file C Documents and Settings username Desktop profile xml document exportSWF Availability Flash MX 2004 Usage document...

Страница 107: ...mentDOM exportSWF true The following example displays the Export Movie dialog box and then exports the document based on the specified settings fl getDocumentDOM exportSWF document forceSimple Availab...

Страница 108: ...4 Usage document frameRate Description Property a float value that specifies the number of frames displayed per second when the SWF file plays the default is 12 Setting this property is the same as se...

Страница 109: ...Doc See also document setAlignToDocument document getBlendMode Availability Flash 8 Usage document getBlendMode Parameters None Returns A string that specifies the blend mode for the selected object s...

Страница 110: ...ccessful otherwise it returns undefined Description Method retrieves the fill object of the selected shape or if specified of the Tools panel and Property inspector Example The following example gets...

Страница 111: ...ect specified by the locationOfStroke parameter if successful otherwise it returns undefined Description Returns the stroke object of the selected shape or if specified of the Tools panel and Property...

Страница 112: ...lowing example adds an integer value of 12 to the current document and uses this method to display the value in the Output panel fl getDocumentDOM addDataToDocument myData integer 12 fl trace fl getDo...

Страница 113: ...he current selection elementName the instance name of the selected object var elementName fl getDocumentDOM getElementProperty name See also document setElementProperty document getElementTextAttr Ava...

Страница 114: ...rned reflects the entire range of characters from startIndex up to but not including endIndex Description Method gets a specific TextAttrs property of the selected text objects Selected objects that a...

Страница 115: ...rOrder document setFilters Filter object document getMetadata Availability Flash 8 Usage document getMetadata Parameters None Returns A string containing the XML metadata associated with the document...

Страница 116: ...rectangle encompassing the entire selection is returned The rectangle is based on the document space or when in edit mode the registration point of the symbol being edited Example The following exampl...

Страница 117: ...ng 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 If there are several text fields selected...

Страница 118: ...e 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 Timeline o...

Страница 119: ...nt var transPoint fl getDocumentDOM getTransformationPoint See also document setTransformationPoint document group Availability Flash MX 2004 Usage document group Parameters None Returns Nothing Descr...

Страница 120: ...ifies whether to import the file only into the document s library true or to also place a copy on the Stage false The default value is false Returns A Boolean value that indicates whether the file was...

Страница 121: ...t Returns 1 if the 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 inde...

Страница 122: ...f See also document importFile document intersect Availability Flash 8 Usage document intersect Parameters None Returns A Boolean value true if successful false otherwise Description Method creates an...

Страница 123: ...r 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 livePrevie...

Страница 124: ...o match the size of the objects to the bounds of the document Otherwise the method uses the bounds of the largest object The default is false This parameter is optional Returns Nothing Description Met...

Страница 125: ...e for pressed false for not pressed bShiftSel A Boolean value that specifies the state of the application preference Shift select true for on false for off Returns Nothing Description Method performs...

Страница 126: ...rue for on false for off Returns Nothing Description Method performs a double mouse click from the arrow tool Example The following example performs a double mouse click at the specified location fl g...

Страница 127: ...ion For example passing x 1 y 2 specifies a location one pixel to the right and two pixels down from the current location Returns Nothing Description Method moves selected objects by a specified dista...

Страница 128: ...r 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 Param...

Страница 129: ...entDOM optimizeCurves 50 true document path Availability Flash MX 2004 Usage document path Description Read only property a string that represents the path of the document in a platform specific forma...

Страница 130: ...Availability Flash MX 2004 Usage document publishProfiles Description Read only property an array of the publish profile names for the document Example The following example displays the names of the...

Страница 131: ...document deleteEnvelope document intersect document union shape isDrawingObject document removeDataFromDocument Availability Flash MX 2004 Usage document removeDataFromDocument name Parameters name A...

Страница 132: ...ves persistent data with the specified name that has been attached to the selection Example The following example removes from the selection the persistent data named myData fl getDocumentDOM removeDa...

Страница 133: ...Filter filterIndex Parameters filterIndex An integer specifying the zero based index of the filter to remove from the selected object s Returns Nothing Description Method removes the specified filter...

Страница 134: ...the name is changed successfully false otherwise Description Method renames the current profile Example The following example renames the current profile to a default name and displays it alert fl ge...

Страница 135: ...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 sceneToMove Spe...

Страница 136: ...tion Method resets the transformation matrix This method is equivalent to selecting Modify Transform Remove transform Example The following example resets the transformation matrix for the current sel...

Страница 137: ...tionPoint A string that specifies which side of the bounding box to rotate Acceptable values are top right top left bottom right bottom left top center right center bottom center and left center If un...

Страница 138: ...his method is equivalent to selecting File Save Example The following example saves the current document in its default location fl getDocumentDOM save See also document saveAndCompact fl saveAll fl s...

Страница 139: ...ocumentAs fl saveDocument fl saveAll document scaleSelection Availability Flash MX 2004 Usage document scaleSelection xScale yScale whichCorner Parameters xScale A floating point value that specifies...

Страница 140: ...OM scaleSelection 1 1 The following example scales the selection vertically by 1 9 from the top center fl getDocumentDOM scaleSelection 1 1 90 top center document screenOutline Availability Flash MX 2...

Страница 141: ...ontrol A Windows or Command A Macintosh or selecting Edit Select All Example The following example selects everything that is currently visible to the user fl getDocumentDOM selectAll See also documen...

Страница 142: ...on Frame 11 to the current selection remember that index values are different from frame number values fl getDocumentDOM getTimeline currentFrame 10 fl getDocumentDOM selection fl getDocumentDOM getTi...

Страница 143: ...layers for var i 0 i theLayers length i Gets the array of elements in Frame 1 and assigns it to the array theElems var theElems theLayers i frames 0 elements Begin loop through the elements on a layer...

Страница 144: ...ocument setAlignToDocument Availability Flash MX 2004 Usage document setAlignToDocument bToStage Parameters bToStage A Boolean value that if set to true aligns objects to the Stage If set to false it...

Страница 145: ...ters mode A string that represents the desired blend mode for the selected objects Acceptable values are normal layer multiply screen overlay hardlight lighten darken difference add subtract invert al...

Страница 146: ...ject rather than drawing the object selecting it and changing the fill settings It also lets a script change the Tools panel and Property inspector fill settings Example The following example changes...

Страница 147: ...r and any selected shapes var stroke fl getDocumentDOM getCustomStroke stroke thickness 2 fl getDocumentDOM setCustomStroke stroke See also document getCustomStroke document setElementProperty Availab...

Страница 148: ...s 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 Retu...

Страница 149: ...BB An integer that represents the decimal equivalent of a hexadecimal number If set to null no fill color is set which is the same as setting the Fill color swatch in the user interface to no fill Ret...

Страница 150: ...ilter property Acceptable values depend on the property and the filter being set Returns Nothing Description Method sets a specified filter property for the currently selected object s that support th...

Страница 151: ...desired changes to the filters Example The following example gets the filters on the selected object and sets the blurX property for all Blur filters to 50 var myFilters fl getDocumentDOM getFilters...

Страница 152: ...tint to a value of 50 fl getDocumentDOM setInstanceAlpha 50 document setInstanceBrightness Availability Flash MX 2004 Usage document setInstanceBrightness brightness Parameters brightness An integer t...

Страница 153: ...ing the Color Tint value for a symbol in the Property Inspector strength An integer between 0 and 100 that specifies the opacity of the tint Returns Nothing Description Method sets the tint for the in...

Страница 154: ...products xmp Example The following examples show several different legal ways to represent the same data In all of these cases but the second one if the data were sent to Document setMetadata it would...

Страница 155: ...2T10 29 07 00 xmp CreateDate xmp CreatorTool Flash Authoring WIN 8 0 0 215 xmp CreatorTool rdf Description This is after the second rdf Description tag rdf RDF In the third example metadata is in attr...

Страница 156: ...veSelection it is valid only for this method and doesn t affect the Contact Sensitive selection mode for the document see fl contactSensitiveSelection Example The following example moves the current s...

Страница 157: ...u pass a value for bContactSensitiveSelection it is valid only for this method and doesn t affect the Contact Sensitive selection mode for the document see fl contactSensitiveSelection Example In the...

Страница 158: ...he selection strokeType A string that specifies the new type of stroke for the selection Acceptable values are hairline solid dashed dotted ragged stipple and hatched Returns Nothing Description Metho...

Страница 159: ...troke in the Tools panel and Property inspector see document setCustomStroke Example The three statements in the following example set the stroke color using each of the different formats for specifyi...

Страница 160: ...lash MX 2004 Usage document setStrokeStyle strokeType Parameters strokeType A string that specifies the stroke style for the current selection Acceptable values are hairline solid dashed dotted ragged...

Страница 161: ...c the method takes into account only the width value passed in boundingRectangle the height is automatically computed to fit all the text If the text is vertical and therefore static the method takes...

Страница 162: ...selection of the currently selected text field to the values specified by the startIndex and endIndex values Text editing is activated if it isn t already Example The following example selects the te...

Страница 163: ...etDocumentDOM setTextString Hello World The following example inserts hello at position 6 of the current text selection var pass fl getDocumentDOM setTextString hello 6 The following example inserts H...

Страница 164: ...Example The following example sets the transformation point of the current selection to 100 200 fl getDocumentDOM setTransformationPoint x 100 y 200 See also document getTransformationPoint document s...

Страница 165: ...number that specifies the amount of y by which to skew measured in degrees whichEdge A string that specifies the edge where the transformation occurs if omitted skew occurs at the transformation poin...

Страница 166: ...rve of the current selection fl getDocumentDOM smoothSelection document space Availability Flash MX 2004 Usage document space direction bUseDocumentBounds Parameters direction A string that specifies...

Страница 167: ...izontally relative to each other with bUseDcoumentBounds expressly set to false fl getDocumentDOM space horizontal false See also document getAlignToDocument document setAlignToDocument document strai...

Страница 168: ...lection must contain a graphic button movie clip video or bitmap This method displays an error message if no object is selected or the given object could not be found Example The following example swa...

Страница 169: ...Flash MX 2004 Usage document testMovie Parameters None Returns Nothing Description Method executes a Test Movie operation on the document Example The following example tests the movie for the current...

Страница 170: ...document timelines Availability Flash MX 2004 Usage document timelines Description Read only property an array of Timeline objects see Timeline object Example The following example gets the array of c...

Страница 171: ...outlines are drawn Acceptable values are pixels very tight tight normal smooth and very smooth cornerThreshold A string that is similar to curveFit but it pertains to the corners of the bitmap image...

Страница 172: ...ion 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 examp...

Страница 173: ...bines all selected shapes into a drawing object Example The following example combines all selected shapes into a drawing object fl getDocumentDOM union See also document crop document deleteEnvelope...

Страница 174: ...e The mouse location as a tool receives it is relative to the object that is currently being edited See Matrix object For example if you create a symbol double click to edit it and draw with the PolyS...

Страница 175: ...ment height document xmlPanel Availability Flash MX 2004 Usage document xmlPanel fileURI Parameters fileURI A string expressed as a file URI that specifies the path to the XML file defining the contro...

Страница 176: ...lPanel fl configURI Commands Test xml for var prop in obj fl trace property prop obj prop document zoomFactor Availability Flash 8 Usage document zoomFactor Description Property specifies the zoom per...

Страница 177: ...er beginFrame Erases what was previously drawn using the drawingLayer and prepares for more drawing commands drawingLayer cubicCurveTo Draws a cubic curve from the current pen location using the param...

Страница 178: ...hen users draw a rectangle they can preview the outline of the shape while dragging the mouse If you want that preview shape to remain after the user releases the mouse button set persistentDraw to tr...

Страница 179: ...Ctl xEnd yEnd Parameters x1Ctl A floating point value that is the x location of the first control point y1Ctl A floating point value that is the y location of the first control point x2Ctl A floating...

Страница 180: ...yEnd A floating point value that is the y position of the end control point Returns Nothing Description Method draws a quadratic curve segment starting at the current drawing position and ending at a...

Страница 181: ...Path gamePath drawingLayer endDraw Availability Flash MX 2004 Usage drawingLayer endDraw Parameters None Returns Nothing Description Method exits drawing mode Drawing mode is used when you want to tem...

Страница 182: ...ing 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...

Страница 183: ...that specifies the y coordinate of the position at which to start drawing Returns Nothing Description Method sets the current drawing position You typically use this method only when creating extensi...

Страница 184: ...mber in the format 0xRRGGBB An integer that represents the decimal equivalent of a hexadecimal number Returns Nothing Description Method sets the color of subsequently drawn data Applies only to persi...

Страница 185: ...dge getControl Availability Flash MX 2004 Usage edge getControl i Method Description edge getControl Gets a point object set to the location of the specified control point of the edge edge getHalfEdge...

Страница 186: ...cription Method gets a point object set to the location of the specified control point of the edge Example The following example stores the first control point of the specified shape in the pt variabl...

Страница 187: ...only property an integer that represents a unique identifier for the edge Example The following example stores a unique identifier for the specified edge in the my_shape_id variable var shape fl getDo...

Страница 188: ...oint 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 Stage y A floating point value that specifies...

Страница 189: ...alue 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...

Страница 190: ...boxes which is controlled by the type of effect you are creating You can specify labels that will appear with the control in addition to default values effect effectName Availability Flash MX 2004 Usa...

Страница 191: ...or effects If this value is an empty string the effect appears ungrouped at the top level of the Context menu The group name and effect name are specified in the XML file for the effect Example The fo...

Страница 192: ...s created the default value is graphic Example The following example stores the symbol type for the current effect in the efType variable var efType fl activeEffect symbolType effect useXMLToUI Availa...

Страница 193: ...ment hasPersistentData Determines whether the specified data has been attached to the specified element element removePersistentData Removes any persistent data with the specified name that has been a...

Страница 194: ...script fl trace Depth of selected object fl getDocumentDOM selection 0 depth See the example for element elementType element locked A Boolean value true if the element is locked false otherwise elemen...

Страница 195: ...layer and then run this line of script var eType fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 elemen tType eType instance The following example displays several properties for all the el...

Страница 196: ...in the first layer first frame var elt fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 elt setPersistentData myData integer 12 if elt hasPersistentData myData fl trace myData elt getPersist...

Страница 197: ...getTimeline layers 0 frames 0 elements 0 height 100 element layer Availability Flash 8 Usage element layer Description Read only property represents the Layer object on which the element is located Ex...

Страница 198: ...lue of this property changes when an element is moved Select an element on the Stage and then run this script var sel fl getDocumentDOM selection 0 fl trace Left before sel left fl getDocumentDOM move...

Страница 199: ...mple moves the specified element by 10 pixels in x and 20 pixels in y var mat fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 matrix mat tx 10 mat ty 20 fl getDocumentDOM getTimeline layers...

Страница 200: ...sage 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 tha...

Страница 201: ...e values are integer integerArray double doubleArray string and byteArray value Specifies the value to associate with the object The data type of value depends on the value of the type parameter The s...

Страница 202: ...tage and then run this script var sel fl getDocumentDOM selection 0 fl trace Top before sel top fl getDocumentDOM moveSelectionBy x 0 y 100 fl trace Top after sel top See the element elementType examp...

Страница 203: ...r fill colorArray An array of colors in gradient fill focalPoint An integer that specifies the gradient focal point horizontal offset from the transformation point fill linearRGB A Boolean value that...

Страница 204: ...getDocumentDOM getCustomFill fill color FFFFFF fl getDocumentDOM setCustomFill fill fill colorArray Availability Flash MX 2004 Usage fill colorArray Description Property an array of colors in the grad...

Страница 205: ...e following example sets the focal point of a radial gradient to 10 pixels to the right of the shape s center var fill fl getDocumentDOM getCustomFill fill focalPoint 10 fl getDocumentDOM setCustomFil...

Страница 206: ...tion Property a string that specifies the behavior of a gradient s overflow Acceptable values are extend repeat and reflect the strings are not case sensitive The default value is extend Example The f...

Страница 207: ...0 200 fl getDocumentDOM setCustomFill fill fill style Availability Flash MX 2004 Usage fill style Description Property a string that specifies the fill style Acceptable values are solid linearGradient...

Страница 208: ...that specifies the amount to blur in the x direction in pixels filter blurY A float value that specifies the amount to blur in the y direction filter brightness A float value that specifies the brigh...

Страница 209: ...0 i myFilters length i if myFilters i name bevelFilter myFilters i angle 120 fl getDocumentDOM setFilters myFilters See also document setFilterProperty filter knockout A Boolean value that specifies...

Страница 210: ...e to 20 for the Blur filters on the selected object s var myFilters fl getDocumentDOM getFilters for i 0 i myFilters length i if myFilters i name blurFilter myFilters i blurX 30 myFilters i blurY 20 f...

Страница 211: ...n 100 and 100 This property is defined for Filter objects with a value of adjustColorFilter for the filter name property Example The following example sets the brightness to 30 5 for the Adjust Color...

Страница 212: ...example sets the color to ff00003e for the Drop Shadow filters on the selected object s var myFilters fl getDocumentDOM getFilters for i 0 i myFilters length i if myFilters i name dropShadowFilter my...

Страница 213: ...e that specifies the distance between the filter s effect and an object in pixels Acceptable values are from 255 to 255 This property is defined for Filter objects with a value of bevelFilter dropShad...

Страница 214: ...d object s var myFilters fl getDocumentDOM getFilters for i 0 i myFilters length i if myFilters i name dropShadowFilter myFilters i hideObject true fl getDocumentDOM setFilters myFilters filter highli...

Страница 215: ...ability Flash 8 Usage filter hue Description Property a float value that specifies the hue of the filter Acceptable values are between 180 and 180 This property is defined for Filter objects with a va...

Страница 216: ...low filters on the selected object s var myFilters fl getDocumentDOM getFilters for i 0 i myFilters length i if myFilters i name glowFilter myFilters i inner true fl getDocumentDOM setFilters myFilter...

Страница 217: ...only property a string that specifies the type of filter The value of this property determines which other properties of the Filter object are available The value is one of the following adjustColorF...

Страница 218: ...The following example sets the blur quality to medium for the Glow filters on the selected object s var myFilters fl getDocumentDOM getFilters for i 0 i myFilters length i if myFilters i name glowFilt...

Страница 219: ...fl getDocumentDOM setFilters myFilters See also document setFilterProperty filter shadowColor Availability Flash 8 Usage filter shadowColor Description Property the color of the shadow in one of the f...

Страница 220: ...cription Property an integer that specifies the percentage strength of the filter Acceptable values are between 0 and 25 500 This property is defined for Filter objects with a value of bevelFilter dro...

Страница 221: ...ilter objects with a value of bevelFilter gradientGlowFilter or gradientBevelFilter for the filter name property Example The following example sets the type to full for all Bevel filters on the select...

Страница 222: ...d document fl closeProject Closes the Flash Project FLP file that is currently open fl createDocument Opens a new document and selects it fl createProject Creates a Flash Project FLP file with the spe...

Страница 223: ...Script Executes a JavaScript file fl saveAll Saves all open documents displaying the Save As dialog box for any documents that were not previously saved fl saveDocument Saves the specified document as...

Страница 224: ...object that an extensible tool should use when the user wants to temporarily draw while dragging fl effects Read only an array of Effect objects see Effect object based on XML parameter file fl Math R...

Страница 225: ...ewArea Parameters browseType A string that specifies the type of file browse operation Acceptable values are open select or save The values open and select open the system File Open dialog box Each va...

Страница 226: ...bility Flash 8 Usage fl browseForFolderURL description Parameters description An optional string that specifies the description of the Browse For Folder dialog box If this parameter is omitted nothing...

Страница 227: ...l Availability Flash MX 2004 Usage fl closeAll Parameters None Returns Nothing Description Method closes all open documents displaying the Save As dialog box for any documents that were not previously...

Страница 228: ...yes or no dialog box The default value is true This parameter is optional Returns A Boolean value true if successful false otherwise Description Method closes the specified document See also fl close...

Страница 229: ...ilability Flash MX 2004 Usage fl componentsPanel Description Read only property a componentsPanel object which represents the Components panel Example The following example stores a componentsPanel ob...

Страница 230: ...See also fl configDirectory Example The following example runs a specified script Using fl configURI lets you specify the location of the script without knowing which platform the script is running o...

Страница 231: ...ocument to create Acceptable values are timeline presentation and application The default value is timeline This parameter is optional Returns The Document object for the newly created document if the...

Страница 232: ...e choice 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...

Страница 233: ...ateNewTemplateList length i fl trace type fl createNewTemplateList i fl createProject Availability Flash 8 Usage fl createProject fileURI name Parameters fileURI A string expressed as a file URI that...

Страница 234: ...myProject fl createProject file C Projects MasterProject_2005 flp Master Project See also fl getProject fl openProject Project object fl documents Availability Flash MX 2004 Usage fl documents Descrip...

Страница 235: ...MX 2004 Usage fl effects Description Read only property an array of Effect objects see Effect object based on XML parameter file These are not effects but a description of effects The array length co...

Страница 236: ...ppear to take longer than necessary This method is purely for debugging purposes and should not be used in effects that are deployed in the field After the effect completes the internal state is reset...

Страница 237: ...pen Returns An array of integers that represent the position of the document name in the fl documents array Description Method returns an array of integers that represent the position of the document...

Страница 238: ...returns an integer that represents the number of bytes being used in a specified area of Flash exe memory Use the following table to determine which value you want to pass as memType Example The follo...

Страница 239: ...a document does not currently have focus for example if a JSFL file has focus retrieves the DOM of the most recently active document Example The following example displays the name of the current or...

Страница 240: ...ped 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 This parameter is op...

Страница 241: ...at 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...

Страница 242: ...ile in the Output panel fl trace Number of recently opened files fl mruRecentFileListType length for i 0 i fl mruRecentFileListType length i fl trace type fl mruRecentFileListType i fl objectDrawingMo...

Страница 243: ...effect is the same as selecting File Open and then selecting a file If the specified file is already open the window that contains the document comes to the front The window that contains the specifie...

Страница 244: ...openProject file c myProjectFile flp See also fl closeProject fl createProject fl getProject Project object fl openScript Availability Flash MX 2004 Usage fl openScript fileURI Parameters fileURI A s...

Страница 245: ...t 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 cas...

Страница 246: ...reloads all effects descriptors defined in the user s Configuration Effects folder This permits you to rapidly change the scripts during development and it provides a mechanism to improve the effects...

Страница 247: ...run the script from the Commands menu fl reloadTools fl revertDocument Availability Flash MX 2004 Usage fl revertDocument documentObject Parameters documentObject A Document object If documentObject r...

Страница 248: ...optional parameter that specifies one or more arguments to be passed to funcname Returns The function s result as a string if funcName is specified otherwise nothing Description Method executes a Java...

Страница 249: ...nScript file C testScript jsfl which produces the following in the Output panel in for loop i 0 in for loop i 1 end of for loop fl saveAll Availability Flash MX 2004 Usage fl saveAll Parameters None R...

Страница 250: ...value true if the save operation completes successfully false otherwise Description Method saves the specified document as a FLA document Example The following example saves the current document and t...

Страница 251: ...he following example prompts the user to save the specified document and then displays an alert message that indicates whether the document was saved alert fl saveDocumentAs fl documents 1 See also do...

Страница 252: ...ailability Flash 8 Usage fl showIdleMessage show Parameters show A Boolean value specifying whether to enable or disable the warning about a script running too long Returns Nothing Description Method...

Страница 253: ...age Parameters message A string that appears in the Output panel Returns Nothing Description Method sends a text string to the Output panel terminated by a new line and displays the Output panel if it...

Страница 254: ...iption Read only property the long string version of the Flash authoring tool including platform Example The following example displays the version of the Flash authoring tool in the Output panel aler...

Страница 255: ...e or more parameters that specifies the location of a file or folder The location of the file or folder is expressed as a string in a form very similar to a website URL It is called a file URI Uniform...

Страница 256: ...seconds have passed between January 1 1970 and the time the file or folder was created FLfile getCreationDateObj Gets the date a file or folder was created FLfile getModificationDate Specifies how man...

Страница 257: ...d config ini and places it inside the same folder in which it is located with a new name var originalFileURI file C Program Files MyApp config ini var newFileURI file C Program Files MyApp config_back...

Страница 258: ...older01 The following example attempts to create a folder called tempFolder at the root level on the C drive and displays an alert box indicating whether the operation was successful var folderURI fil...

Страница 259: ...it is created var configFile file C MyApplication config ini if FLfile exists configFile FLfile write configFile See also FLfile write FLfile getAttributes Availability Flash MX 2004 7 2 Usage FLfile...

Страница 260: ...or folder Windows only A fileOrFolderURI is ready for archiving Windows only For example if fileOrFolderURI is a hidden folder the string returned is DH Example The following example gets the attribut...

Страница 261: ...reationTime FLfile getCreationDate fileURI var modificationTime FLfile getModificationDate fileURI if modificationTime creationTime alert The file has been modified since it was created else alert The...

Страница 262: ...ty Flash MX 2004 7 2 Usage FLfile getModificationDate fileOrFolderURI Parameters fileOrFolderURI A string expressed as a file URI specifying the file whose modification date and time you want to retri...

Страница 263: ...me time See also FLfile getCreationDate FLfile getModificationDateObj FLfile getModificationDateObj Availability Flash MX 2004 7 2 Usage FLfile getModificationDateObj fileOrFolderURI Parameters fileOr...

Страница 264: ...A string expressed as a file URI specifying the file whose size you want to retrieve Returns An integer that represents the size of the specified file in bytes or 0 if the file doesn t exist Descripti...

Страница 265: ...enting the contents of the folder or false if the folder doesn t exist Description Method returns an array of strings that represent the contents of the folder or an empty array if the folder doesn t...

Страница 266: ...u want to retrieve Returns The contents of the specified file as a string or null if the read fails Description Method returns the contents of the specified file as a string or null if the read fails...

Страница 267: ...with the R read only attribute cannot be removed Examples The following example warns a user if a file exists and then deletes it if the user chooses to do so var fileURI prompt Enter file folder to b...

Страница 268: ...ues for the attribute s you want to set For acceptable values for strAttrs see the description below Returns A Boolean value of true if successful Description Method specifies system level attributes...

Страница 269: ...exists URI FLfile setAttributes URI RH The following example sets the file mydata txt to be read only and hidden It also ensures that the archive attribute is not set var URI file c temp mydata txt i...

Страница 270: ...ateFolder Example The following example attempts to write the string xxx to the file mydata txt and displays an alert message if the write succeeded It then attempts to append the string aaa to the fi...

Страница 271: ...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 S...

Страница 272: ...ect Inheritance Item object fontItem object Availability Flash MX 2004 Description The fontItem object is a subclass of the Item object There are no unique methods or properties of fontItem See Item o...

Страница 273: ...cription frame actionScript A string representing ActionScript code frame duration Read only an integer that represents the number of frames in a frame sequence frame elements Read only an array of El...

Страница 274: ...at the start of the tween and the shape in the following keyframe frame soundEffect A string that specifies effects for a sound that is attached directly to a frame frame soundLibraryItem frame soundL...

Страница 275: ...X 2004 Usage frame duration Description Read only property an integer that represents the number of frames in a frame sequence Example The following example stores the number of frames in a frame sequ...

Страница 276: ...e 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 around this issue Example The f...

Страница 277: ...rame setCustomEase frame useSingleEaseCurve frame hasCustomEase Availability Flash 8 Usage frame hasCustomEase Description Property a Boolean value If true the frame gets its ease information from the...

Страница 278: ...ts label to comment fl getDocumentDOM getTimeline layers 0 frames 0 name First Frame fl getDocumentDOM getTimeline layers 0 frames 0 labelType comment frame motionTweenOrientToPath Availability Flash...

Страница 279: ...rame motionTweenOrientToPath set this property to none Example See frame motionTweenRotateTimes frame motionTweenRotateTimes Availability Flash MX 2004 Usage frame motionTweenRotateTimes Description P...

Страница 280: ...tweened element should scale to the size of the object in the following keyframe increasing its size with each frame in the tween fl getDocumentDOM getTimeline layers 0 frames 0 motionTweenScale true...

Страница 281: ...enSync true frame name Availability Flash MX 2004 Usage frame name Description Property a string that specifies the name of the frame Example The following example sets the name of the first frame top...

Страница 282: ...tructed by the horizontal ordinal left to right position of the control points and tangent endpoints For example the following illustration shows an ease curve that would be created if the easeCurve a...

Страница 283: ...lability Flash MX 2004 Usage frame soundEffect Description Property a string that specifies effects for a sound that is attached directly to a frame frame soundLibraryItem Acceptable values are none l...

Страница 284: ...frame soundLoop Description Property an integer value that specifies the number of times a sound that is attached directly to a frame frame soundLibraryItem plays If you want to specify a value for t...

Страница 285: ...tem as stored in the library Example The following example changes the soundName property of the first frame to song1 mp3 song1 mp3 must exist in the library fl getDocumentDOM getTimeline layers 0 fra...

Страница 286: ...e number values var stFrame fl getDocumentDOM getTimeline layers 0 frames 4 startFrame fl trace stFrame 4 var stFrame fl getDocumentDOM getTimeline layers 0 frames 9 startFrame fl trace stFrame 4 fram...

Страница 287: ...eline 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 keyfram...

Страница 288: ...e each property has its own ease curve This property is ignored if the frame doesn t have custom easing applied Example The following example specifies that a single custom ease curve should be used f...

Страница 289: ...Edge object The following methods are available for the HalfEdge object Property summary for the HalfEdge object The following properties are available for the HalfEdge object halfEdge getEdge Availab...

Страница 290: ...an edge and a half edge for the specified shape var shape fl getDocumentDOM selection 0 var hEdge shape edges 0 getHalfEdge 0 var edge hEdge getEdge halfEdge getNext Availability Flash MX 2004 Usage...

Страница 291: ...ability Flash MX 2004 Usage halfEdge getOppositeHalfEdge Parameters None Returns A HalfEdge object Description Method gets the HalfEdge object on the other side of the edge Example The following examp...

Страница 292: ...Edge hEdge getPrev halfEdge getVertex Availability Flash MX 2004 Usage halfEdge getVertex Parameters None Returns A Vertex object Description Method gets the Vertex object at the head of the HalfEdge...

Страница 293: ...ape fl getDocumentDOM selection 0 alert shape contours 0 getHalfEdge id halfEdge index Availability Flash MX 2004 Usage halfEdge index Description Read only property an integer with a value of 0 or 1...

Страница 294: ...cceptable values are symbol bitmap embedded video linked video video and compiled clip Example The following example shows that the instance type of a movie clip is symbol Select a movie clip and then...

Страница 295: ...te this instance You can change this property only to another library item of the same type that is you cannot set a symbol instance to refer to a bitmap See library object Example The following examp...

Страница 296: ...library item has the named data item removeData Removes persistent data from the library item Property Description item itemType Read only a string that specifies the type of element item linkageClass...

Страница 297: ...ger 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 o...

Страница 298: ...data Example The following example gets the value of the data named myData from the first item in the library and stores it in the variable libData var libData fl getDocumentDOM library items 0 getDat...

Страница 299: ...sound bitmap compiled clip screen and video If this property is video you can determine the type of video see videoItem videoType Example The following example shows the type of the specified library...

Страница 300: ...is true the item is exported for ActionScript You can also set the item linkageExportForRS and item linkageExportInFirstFrame properties to true If you set this property to true the item linkageImport...

Страница 301: ...d library item fl getDocumentDOM library items 0 linkageExportForRS true item linkageExportInFirstFrame Availability Flash MX 2004 Usage item linkageExportInFirstFrame Description Property a Boolean v...

Страница 302: ...sed to identify the library item when it is linked to the destination SWF file to which it is being exported fl getDocumentDOM library items 0 linkageIdentifier my_mc See also item linkageURL item lin...

Страница 303: ...at that is forward slashes or backward slashes depending on the platform Example The following example specifies a linkage URL for the specified library item fl getDocumentDOM library items 0 linkageU...

Страница 304: ...me 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 name...

Страница 305: ...s Read only an array of Frame objects layer height An integer that specifies the percentage layer height equivalent to the Layer height value in the Layer Properties dialog box layer layerType A strin...

Страница 306: ...the first layer in the colorValue variable var colorValue fl getDocumentDOM getTimeline layers 0 color The following example shows three ways to set the color of the first layer to red fl getDocument...

Страница 307: ...a frame is a keyframe check whether the frame startFrame property matches the array index as shown in the following example var frameArray fl getDocumentDOM getTimeline layers 0 frames var n frameArra...

Страница 308: ...ype 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 guided mask masked an...

Страница 309: ...ecifies 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...

Страница 310: ...ses 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 la...

Страница 311: ...the current items or a specified item from the Library panel library duplicateItem Makes a copy of the currently selected or specified item library editItem Opens the currently selected or specified i...

Страница 312: ...Returns A Boolean value true if the item is successfully added to the document false otherwise library newFolder Creates a new folder with the specified name or a default name untitled folder if no fo...

Страница 313: ...lip button graphic bitmap screen and folder so for example you cannot add a sound to the library with this method Specifying a folder path is the same as using library newFolder before calling this me...

Страница 314: ...value true if the items are successfully deleted false otherwise Description Method deletes the current items or a specified item from the Library panel This method can affect multiple items if severa...

Страница 315: ...lity Flash MX 2004 Usage library editItem namePath Parameters namePath A string that specifies the name of the item If the item is in a folder you can specify its name and path using slash notation If...

Страница 316: ...and optionally the path of the folder to expand or collapse If this parameter is not specified the method applies to the currently selected folder This parameter is optional Returns A Boolean value tr...

Страница 317: ...e 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 Us...

Страница 318: ...s optional Returns A string value specifying the type of object For possible return values see item itemType Description Method gets the type of object currently selected or specified by a library pat...

Страница 319: ...created item If the name is already used the method creates an alternate name This parameter is optional Returns Nothing Description Method imports a Shockwave SWF file into the library as a compiled...

Страница 320: ...Method checks to see if a specified item exists in the library Example The following example displays true or false in a dialog box depending on whether the item Symbol_1 exists in the Folder_1 librar...

Страница 321: ...exists specifying true for the bReplace parameter replaces the existing item with the item being moved If false the name of the dropped item changes to a unique name The default value is false This pa...

Страница 322: ...w library folders the second folder is a subfolder of the first folder fl getDocumentDOM library newFolder first second library renameItem Availability Flash MX 2004 Usage library renameItem name Para...

Страница 323: ...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 getDocum...

Страница 324: ...value true if the specified 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 insid...

Страница 325: ...e the Property summary for the Item object and property summaries for its subclasses To see which objects are subclasses of the Item object see Summary of the DOM structure value The value to assign t...

Страница 326: ...icking on an item and selecting Update from the menu in the user interface If no name is provided the current selection is updated This parameter is optional Returns A Boolean value true if Flash upda...

Страница 327: ...object Math concatMatrix Availability Flash MX 2004 Usage Math concatMatrix mat1 mat2 Parameters mat1 and mat2 Specify the Matrix objects to be concatenated see Matrix object Each parameter must be a...

Страница 328: ...ix Availability Flash MX 2004 Usage Math invertMatrix mat Parameters mat Indicates the Matrix object to invert see Matrix object It must have the following fields a b c d tx and ty Returns A Matrix ob...

Страница 329: ...hich distance is measured Returns A floating point value that represents the distance between the points Description Method computes the distance between two points Example The following example store...

Страница 330: ...s x axis Property Description matrix a A floating point value that specifies the 0 0 element in the transformation matrix matrix b A floating point value that specifies the 0 1 element in the matrix...

Страница 331: ...ere a d and b c For example values of 0 5 0 8 0 8 and 0 5 rotate the object 60 var mat fl getDocumentDOM selection 0 matrix mat a 0 5 mat b 0 8 mat c 0 8 1 mat d 0 5 fl getDocumentDOM selection 0 matr...

Страница 332: ...ailability Flash MX 2004 Usage matrix c Description Property a floating point value that specifies the 1 0 element in the matrix This value causes Flash to skew the object by moving its bottom edge al...

Страница 333: ...llowing example setting tx and ty to 0 moves the registration point of the object to point 0 0 in the document var mat fl getDocumentDOM selection 0 matrix mat tx 0 mat ty 0 fl getDocumentDOM selectio...

Страница 334: ...r Availability Flash MX 2004 Usage outputPanel clear Parameters None Returns Nothing Description Method clears the contents of the Output panel You can use this method in a batch processing applicatio...

Страница 335: ...ing if false it saves the Output panel text using UTF 8 encoding with Byte Order Mark characters at the beginning of the text The default value is false Returns Nothing Description Method saves the co...

Страница 336: ...isible This method is identical to fl trace and works in the same way as the trace statement in ActionScript To send a blank line use outputPanel trace or outputPanel trace n You can use the latter co...

Страница 337: ...ter insertItem Inserts an item into a list object or array parameter removeItem Removes an element of the list object or array type of a screen or component parameter Property Description parameter ca...

Страница 338: ...Flash MX 2004 Usage parameter insertItem index name value type Parameters index A zero based integer index that indicates where the item will be inserted in the list object or array If the index is 0...

Страница 339: ...r prop in values fl trace labelPlacement parameter value values prop value parameter listIndex Availability Flash MX 2004 Usage parameter listIndex Description Property the value of the selected list...

Страница 340: ...race name parms 4 name The following example shows the name of the fifth parameter for the specified screen var parms fl getDocumentDOM screenOutline screens 1 parameters fl trace name parms 4 name pa...

Страница 341: ...fter 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 pr...

Страница 342: ...ing 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...

Страница 343: ...ct The following properties are available for the Path object Method Description path addCubicCurve Appends a cubic B zier curve segment to the path path addCurve Appends a quadratic B zier segment to...

Страница 344: ...point number that specifies the x position of the third control point y3 A floating point number that specifies the y position of the third control point x4 A floating point number that specifies the...

Страница 345: ...e x position of the third control point y3 A floating point value that specifies the y position of the third control point Returns Nothing Description Method appends a quadratic B zier segment to the...

Страница 346: ...rawingLayer newPath myPath addPoint 10 100 path clear Availability Flash MX 2004 Usage path clear Parameters None Returns Nothing Description Method removes all points from the path Example The follow...

Страница 347: ...The default value is false This parameter is optional bSupressStroke A Boolean value that if set to true suppresses the stroke that would be applied to the shape The default value is false This param...

Страница 348: ...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 addPoint 30 30 myPath addPoint 30 0 myPath addPoint...

Страница 349: ...mber 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 drawingL...

Страница 350: ...he specified file to the project project canPublishProject Determines whether the project can be published project canTestProject Determines whether the project can be tested project findProjectItem S...

Страница 351: ...ified file to the project You can use autoCreateFolder to determine where the new file should be positioned in the Project panel If you omit autoCreateFolder or pass a value of false the file is added...

Страница 352: ...l of the project var newFile myProject addFile file C Projects files myFile_02 fla false var newFile myProject addFile file C Projects files myFile_02 fla fl trace newFile isMissing false The followin...

Страница 353: ...Output panel if the project cannot be published if fl getProject canPublishProject fl trace Project cannot be published See also fl getProject project publishProject projectItem canPublish project ca...

Страница 354: ...ect that represents the default document in the project You must specify a default item if you want to test the project See ProjectItem object Example The following example sets the default document i...

Страница 355: ...or a specified file in the project Example The following example displays an error message in the Output panel if a specified file is not found in the project var myProject fl getProject var item myPr...

Страница 356: ...ility Flash 8 Usage project name Description Property the name of the project that appears in the Project panel Example The following example specifies a new name to be displayed in the Project panel...

Страница 357: ...oject Parameters None Returns A Boolean value indicating if the project was successfully published Description Method publishes the FLA files in a project Example The following example publishes the p...

Страница 358: ...he project A project must have a default document to be tested Example The following example tests the project after confirming that it can be tested and then indicates whether the project was tested...

Страница 359: ...ojectItem object The following properties can be used with the ProjectItem object Method Description projectItem canPublish Determines whether a project item can be published projectItem canTest Deter...

Страница 360: ...ed An item can be published only if it is a FLA file Example The following example displays a message in the Output panel if the first item in the project cannot be published var item fl getProject it...

Страница 361: ...trace item name cannot be tested See also fl getProject project canTestProject project items projectItem test projectItem displayName Availability Flash 8 Usage projectItem displayName Description Rea...

Страница 362: ...t panel that indicates whether a specific file is on the disk in the expected folder var item fl getProject findProjectItem file C Projects files DynamicHighAscii fla fl trace DynamicHighAscii fla is...

Страница 363: ...lability Flash 8 Usage projectItem publish Parameters None Returns A Boolean value of true if successful false otherwise Description Method publishes a project item Only FLA files can be published Exa...

Страница 364: ...item is not a FLA file this property is an empty string and any attempts to set this property fail Example The following example sets the publish profile of all the items in the project to a specified...

Страница 365: ...Descriptionn Method tests a project item If the test operation fails because the item is not a FLA or HTML file this method returns false Example The following example tests all the FLA and HTML file...

Страница 366: ...ield in the Accessibility panel screen forceSimple A Boolean value that enables and disables accessibility for the object s children screen hidden A Boolean value that specifies whether a screen is vi...

Страница 367: ...mentDOM screenOutline screens 1 accName The following example sets the name of the object to Home Button fl getDocumentDOM screenOutline screens 1 accName Home Button screen childScreens Availability...

Страница 368: ...nOutline rootScreen childScreens i name fl trace The child screens of myParent are myChildren screen description Availability Flash MX 2004 Usage screen description Description Property a string that...

Страница 369: ...the Make Child Object Accessible option being selected Example The following example stores the value of forceSimple in the areChildrenAccessible variable a value of false means the children of the o...

Страница 370: ...entDOM 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...

Страница 371: ...he Output panel to show the name of the screen var myChildren new Array if fl getDocumentDOM allowScreens var myName fl getDocumentDOM screenOutline rootScreen childScreens 0 name fl trace The name of...

Страница 372: ...creens 0 nextScreen name fl trace The next screen to myCurrent is myNext screen parameters Availability Flash MX 2004 Usage screen parameters Description Read only property an array of ActionScript 2...

Страница 373: ...their parent child relationship in the Output panel if fl getDocumentDOM allowScreens var myCurrent fl getDocumentDOM screenOutline rootScreen childScreens 1 name var myParent fl getDocumentDOM screen...

Страница 374: ...erty 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...

Страница 375: ...DOM 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...

Страница 376: ...eenOutline copyScreenFromFile Inserts all the screens or a named screen and its children from a specified document under the currently selected screen screenOutline deleteScreen Deletes the currently...

Страница 377: ...othing If the file is not found or is not a valid FLA file or if the specified screen is not found an error is reported and the script is cancelled screenOutline renameScreen Changes the screen with a...

Страница 378: ...fla slide1 screenOutline currentScreen Availability Flash MX 2004 Usage screenOutline currentScreen Description Property a Screen object the currently selected screen see Screen object Example The fo...

Страница 379: ...If you don t pass a value for screenName the currently selected screen s are duplicated This parameter is optional Returns A Boolean value true if the screen is successfully duplicated false otherwise...

Страница 380: ...jects that are currently selected in the screen outline Example The following example stores the selected Screen objects in the myArray variable and displays the screen names in the Output panel var m...

Страница 381: ...ptional screenTypeName A string that specifies the screen type to attach to the new nested screen The screen type and class name are set for this screen Acceptable values are Form and Slide This param...

Страница 382: ...parent This parameter is optional screenTypeName A string that specifies the screen type to attach to the new screen The screen type and classname are set for this screen Acceptable values are Form an...

Страница 383: ...le moves screen slide1 to be the first child of slide2 fl getDocumentDOM screenOutline moveScreen slide1 slide2 firstChild screenOutline renameScreen Availability Flash MX 2004 Usage screenOutline ren...

Страница 384: ...ead only property the first screen in the screen outline You can use screenOutline rootScreen as a shortcut for screenOutline screens 0 Example The following example displays the name of the first chi...

Страница 385: ...ose names are myArray screenOutline setCurrentScreen Availability Flash MX 2004 Usage screenOutline setCurrentScreen name Parameters name A string that specifies the name screen which should become th...

Страница 386: ...he type of value depends on the property being set For a list of available properties and values see Property summary for the Screen object Returns Nothing Description Method sets the specified proper...

Страница 387: ...alse Flash extends the current selection to include the specified screens This parameter is optional Returns Nothing Description Method selects the specified screens in the screen outline If multiple...

Страница 388: ...addition to the Element 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 propert...

Страница 389: ...that change the Shape object or any of its subordinate parts Example The following example takes the currently selected shape and removes the first edge in the edge array from it var shape fl getDocum...

Страница 390: ...ameters index A zero based index that specifies the edge to delete from the shape edges array This method changes the length of the shape edges array Returns Nothing Description Method deletes the spe...

Страница 391: ...ordinate 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 subordinate parts Example The following example takes the cur...

Страница 392: ...also document crop document deleteEnvelope document intersect document punch document union shape isGroup shape isGroup Availability Flash MX 2004 Usage shape isGroup Description Read only property if...

Страница 393: ...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 in the Ou...

Страница 394: ...es the bit rate of a sound in the library Available only for the MP3 compression type soundItem bits A string that specifies the bits value for a sound in the library that has ADPCM compression soundI...

Страница 395: ...DocumentDOM library items 0 bitRate See also soundItem compressionType soundItem convertStereoToMono soundItem bits Availability Flash MX 2004 Usage soundItem bits Description Property a string that s...

Страница 396: ...fl getDocumentDOM library getSelectedItems 0 compressionType Speech soundItem convertStereoToMono Availability Flash MX 2004 Usage soundItem convertStereoToMono Description Property a Boolean value av...

Страница 397: ...ecifies the playback quality of a sound in the library This property is available only for MP3 compression type Acceptable values are Fast Medium and Best Example The following example sets the playba...

Страница 398: ...tDOM library items 0 sampleRate 5 kHz See also soundItem compressionType soundItem useImportedMP3Quality Availability Flash MX 2004 Usage soundItem useImportedMP3Quality Description Property a Boolean...

Страница 399: ...rty Property summary for the Stroke object The following properties are available for the Stroke object Property Description stroke breakAtCorners Same as the Sharp Corners setting in the custom Strok...

Страница 400: ...fies the pattern of a ragged line stroke rotate A string that specifies the rotation of a hatch line stroke scaleType A string that specifies the type of scale to be applied to the stroke stroke shape...

Страница 401: ...the stroke Acceptable values are none round and square Example The following example sets the stroke cap type to round var myStroke fl getDocumentDOM getCustomStroke myStroke capType round fl getDocu...

Страница 402: ...he stroke style property is hatched see stroke style Acceptable values are straight slight curve medium curve and very curved Example The following example sets the curve property as well as others fo...

Страница 403: ...etDocumentDOM setCustomStroke myStroke stroke dash2 Availability Flash MX 2004 Usage stroke dash2 Description Property an integer that specifies the lengths of the blank parts of a dashed line This pr...

Страница 404: ...only if the stroke style property is set to stipple see stroke style Acceptable values are tiny small medium and large The following example sets the dotsize property to tiny for the stroke style of s...

Страница 405: ...f a hatch line This property is available only if the stroke style property is set to hatched see stroke style Acceptable values are hairline thin medium and thick Example The following example sets t...

Страница 406: ...hatched var myStroke fl getDocumentDOM getCustomStroke myStroke style hatched myStroke curve straight myStroke space close myStroke jiggle wild myStroke rotate free myStroke length slight myStroke hat...

Страница 407: ...oke jiggle wild myStroke rotate free myStroke length slight myStroke hatchThickness thin fl getDocumentDOM setCustomStroke myStroke stroke miterLimit Availability Flash 8 Usage stroke miterLimit Descr...

Страница 408: ...om triple dotted Example The following example sets the pattern property to random for a stroke style of ragged var myStroke fl getDocumentDOM getCustomStroke myStroke style ragged myStroke pattern ra...

Страница 409: ...Description Property a string that specifies the type of scale to be applied to the stroke Acceptable values are normal horizontal vertical and none Example The following example sets the scale type o...

Страница 410: ...rty is set to hatched see stroke style Acceptable values are very close close distant and very distant Example The following example sets the space property to close for a stroke style of hatched var...

Страница 411: ...lowing list If value is solid or noStroke there are no other properties If value is dashed there are two additional properties dash1 and dash2 If value is dotted there is one additional property dotSp...

Страница 412: ...tring that specifies the variation of a stippled line This property is available only if the stroke style property is set to stipple see stroke style Acceptable values are one size small variation var...

Страница 413: ...at myStroke waveLength short fl getDocumentDOM setCustomStroke myStroke stroke waveLength Availability Flash MX 2004 Usage stroke waveLength Description Property a string that specifies the wave lengt...

Страница 414: ...n symbols only sets the same property as the pop up menu for Track as Button or Track as Menu Item in the Property inspector symbolInstance cacheAsBitmap A Boolean value that specifies whether runtime...

Страница 415: ...stance equivalent to using the Color Advanced setting in the instance Property inspector symbolInstance colorRedPercent Part of the color transformation for the instance equivalent to using the Color...

Страница 416: ...tion 0 accName The following example sets the value for the Accessibility panel name of the object to Home Button fl getDocumentDOM selection 0 accName Home Button symbolInstance silent A Boolean valu...

Страница 417: ...entDOM getTimeline layers 0 frames 0 elements 0 actionScr ipt onClipEvent enterFrame trace movie clip enterFrame symbolInstance blendMode Availability Flash 8 Usage symbolInstance blendMode Descriptio...

Страница 418: ...sets the first symbol in the first frame of the first layer in the timeline to Track as Menu Item as long as that symbol is a button fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 buttonT...

Страница 419: ...values are from 255 to 255 Example The following example subtracts 100 from the alpha setting of the selected symbol instance fl getDocumentDOM selection 0 colorAlphaAmount 100 symbolInstance colorAlp...

Страница 420: ...Instance colorBluePercent Description Property an integer that is part of the color transformation for the instance This property is equivalent to using the Color Advanced setting in the instance Prop...

Страница 421: ...valent to using the Color Advanced setting in the instance Property inspector the percentage controls on the left of the dialog box This value sets the green values by a specified percentage Allowable...

Страница 422: ...values are from 255 to 255 Example The following example sets the colorRedAmount of the selected symbol instance to 255 fl getDocumentDOM selection 0 colorRedAmount 255 symbolInstance colorRedPercent...

Страница 423: ...ject in the theDescription variable var theDescription fl getDocumentDOM selection 0 description The following example sets the value for the Accessibility panel description to Click the home button t...

Страница 424: ...entDOM getTimeline layers 0 frames 0 elements 0 filters filterArray symbolInstance firstFrame Availability Flash MX 2004 Usage symbolInstance firstFrame Description Property a zero based integer that...

Страница 425: ...This property is available only for movie clip objects Example The following example checks to see if the children of the object are accessible a return value of false means the children are accessib...

Страница 426: ...y a string that is equivalent to the shortcut key 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 pr...

Страница 427: ...value of false means the object is accessible var isSilent fl getDocumentDOM selection 0 silent The following example sets the object to be accessible fl getDocumentDOM selection 0 silent false symbo...

Страница 428: ...Accessibility panel Creates a tab order in which objects are accessed when the user presses the Tab key This property is not available for graphic symbols Example The following example sets the tabInd...

Страница 429: ...mbol item in the library to a compiled movie clip symbolItem exportSWC Exports the symbol item to a SWC file symbolItem exportSWF Exports the symbol item to a SWF file Property Description symbolItem...

Страница 430: ...clip fl getDocumentDOM library items 3 convertToCompiledClip symbolItem exportSWC Availability Flash MX 2004 Usage symbolItem exportSWC outputURI Parameters outputURI A string expressed as a file URI...

Страница 431: ...MX 2004 Usage symbolItem exportSWF outputURI Parameters outputURI A string expressed as a file URI that specifies the SWF file to which the method will export the symbol The outputURI must reference...

Страница 432: ...calingGrid true See also symbolItem scalingGridRect symbolItem scalingGridRect Availability Flash 8 Usage symbolItem scalingGridRect Description Property a rectangle object that specifies the location...

Страница 433: ...toUpdate property for a library item fl getDocumentDOM library items 0 sourceAutoUpdate true symbolItem sourceFilePath Availability Flash MX 2004 Usage symbolItem sourceFilePath Description Property a...

Страница 434: ...el fl trace fl getDocumentDOM library items 0 sourceLibraryName symbolItem symbolType Availability Flash MX 2004 Usage symbolItem symbolType Description Property a string that specifies the type of sy...

Страница 435: ...e symbolItem timeline Description Read only property a Timeline object Example The following example obtains and shows the number of layers that the selected movie clip in the library contains var tl...

Страница 436: ...ed text field use document setElementProperty The following example assigns the currently selected text field to the variable textVar fl getDocumentDOM setElementProperty variableName textVar Method s...

Страница 437: ...that specifies characters to embed This is equivalent to entering text in the Character Options dialog box text embedRanges A string that consists of delimited integers that correspond to the items th...

Страница 438: ...ffset of the end of a text subselection text selectionStart A zero based integer that specifies the offset of the beginning of a text subselection text shortcut A string that is equivalent to the Shor...

Страница 439: ...Example See text fontRenderingMode See also text antiAliasSharpness text fontRenderingMode text accName Availability Flash MX 2004 Usage text accName Description Property a string that is equivalent t...

Страница 440: ...o 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 MX 2004 Usage text border Des...

Страница 441: ...OM getTimeline layers 0 frames 0 elements 0 descripti on Enter your name here text embeddedCharacters Availability Flash MX 2004 Usage text embeddedCharacters Description Property a string that specif...

Страница 442: ...ts 0 embedRang es text fontRenderingMode Availability Flash 8 Usage text fontRenderingMode Description Property a string that specifies the rendering mode for the text This property affects how the te...

Страница 443: ...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 do...

Страница 444: ...tr size fl trace TheTextSize The following example gets the text fill color of the selected text field var TheFill fl getDocumentDOM selection 0 getTextAttr fillColor fl trace TheFill The following ex...

Страница 445: ...ter s from the fifth character through the end of the selected text field var myText fl getDocumentDOM selection 0 getTextString 4 fl trace myText The following example gets the fourth through the nin...

Страница 446: ...tiline no wrap fl getDocumentDOM selection 0 lineType multiline no wrap text maxCharacters Availability Flash MX 2004 Usage text maxCharacters Description Property an integer that specifies the maximu...

Страница 447: ...DocumentDOM getTimeline layers 0 frames 0 elements 0 orientati on vertical right to left text renderAsHTML Availability Flash MX 2004 Usage text renderAsHTML Description Property a Boolean value If th...

Страница 448: ...04 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...

Страница 449: ...ionStart and no text is selected Example The following example sets the start of the text subselection to the sixth character fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 selection Start...

Страница 450: ...extRun elements Using it may change the position and number of TextRun elements within this object s text textRuns array see text textRuns If you omit the optional parameters the method uses the entir...

Страница 451: ...startIndex position If you specify both startIndex and endIndex the specified string replaces the segment of text starting from startIndex up to but not including endIndex Example The following exampl...

Страница 452: ...ue var theShortcut fl getDocumentDOM selection 0 shortcut fl trace theShortcut The following example sets the shortcut key of the selected object fl getDocumentDOM selection 0 shortcut Ctrl i text sil...

Страница 453: ...x Description Property an integer that is equivalent to the Tab Index field in the Accessibility panel This value lets you determine the order in which objects are accessed when the user presses the T...

Страница 454: ...pe 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 Avail...

Страница 455: ...y 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 gene...

Страница 456: ...rue or ignores false pair kerning information in the font s to kern the text textAttrs bold A Boolean value A value of true causes text to appear with the bold version of the font textAttrs characterP...

Страница 457: ...true textAttrs alignment Availability Flash MX 2004 Usage textAttrs alignment textAttrs lineSpacing An integer that specifies the line spacing leading of the paragraph textAttrs rightMargin An intege...

Страница 458: ...ection 0 3 fl getDocumentDOM setElementTextAttr alignment justify textAttrs autoKern Availability Flash MX 2004 Usage textAttrs autoKern Description Property a Boolean value that determines whether Fl...

Страница 459: ...racterPosition Description Property a string that determines the baseline for the text Acceptable values are normal subscript and superscript This property applies only to static text Example The foll...

Страница 460: ...xtAttrs 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...

Страница 461: ...720 Example The following example sets 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 outsi...

Страница 462: ...ied range if they are in the same paragraph fl getDocumentDOM selection 0 setTextAttr leftMargin 100 2 8 textAttrs letterSpacing Availability Flash 8 Usage textAttrs letterSpacing Description Property...

Страница 463: ...0 setTextAttr lineSpacing 100 textAttrs rightMargin Availability Flash MX 2004 Usage textAttrs rightMargin Description Property an integer that specifies the paragraph s right margin Acceptable values...

Страница 464: ...es a warning if used with other text types Example The following example sets the rotation of the selected text field to true fl getDocumentDOM setElementTextAttr rotation true textAttrs size Availabi...

Страница 465: ...e top layer of the current scene and shows it in the Output panel fl outputPanel trace fl getDocumentDOM getTimeline layers 0 frames 0 elements 0 getTextAttr target textAttrs url Availability Flash MX...

Страница 466: ...provides the following properties textRun characters Availability Flash MX 2004 Usage textRun characters Description Property the text contained in the TextRun object Example The following example di...

Страница 467: ...ttrs object containing the attributes of the run of text Example The following example displays the properties of the first run of characters in the selected text field in the Output panel var curText...

Страница 468: ...irst frame has a frame index of 0 Method summary for the Timeline object The following methods are available for the Timeline object Method Description timeline addMotionGuide Adds a motion guide laye...

Страница 469: ...timeline getSelectedLayers Retrieves the zero based index values of the currently selected layers timeline insertBlankKeyframe Inserts a blank keyframe at the specified frame index if the index is no...

Страница 470: ...rent layer timeline showLayerMasking Shows the layer masking during authoring by locking the mask and masked layers Property Description timeline currentFrame A zero based index for the frame at the c...

Страница 471: ...ddMotionGuide timeline addNewLayer Availability Flash MX 2004 Usage timeline addNewLayer name layerType bAddAbove Parameters name A string that specifies the name for the new layer If you omit this pa...

Страница 472: ...tFrameIndex the method uses the current selection This parameter is optional endFrameIndex A zero based index that defines the end of the range of frames to clear The range goes up to but does not inc...

Страница 473: ...artFrameIndex 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 th...

Страница 474: ...ame 10 to blank keyframes remember that index values are different from frame number values fl getDocumentDOM getTimeline convertToBlankKeyframes 1 9 The following example converts Frame 5 to a blank...

Страница 475: ...es 1 9 The following example converts Frame 5 to a keyframe fl getDocumentDOM getTimeline convertToKeyframes 4 timeline copyFrames Availability Flash MX 2004 Usage timeline copyFrames startFrameIndex...

Страница 476: ...Index endFrameIndex Parameters startFrameIndex A zero based index that specifies the beginning frame at which to create a motion tween If you omit startFrameIndex the method uses the current selection...

Страница 477: ...the frame at the current playhead location Example The following example sets the playhead of the current timeline to Frame 10 remember that index values are different from frame number values fl getD...

Страница 478: ...tartFrameIndex 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 A...

Страница 479: ...OM getTimeline cutFrames 4 timeline deleteLayer Availability Flash MX 2004 Usage timeline deleteLayer index Parameters index A zero based index that specifies the layer to be deleted If there is only...

Страница 480: ...valent to the Expand All Collapse All menu items in the Flash authoring tool This parameter is optional Returns Nothing Description Method expands or collapses the specified folder or folders If you d...

Страница 481: ...er index is flat so folders are considered part of the main index Example The following example shows the index values of all layers named Layer 7 in the Output panel var layerIndex fl getDocumentDOM...

Страница 482: ...summary for the Frame object on page 273 for a complete list of properties startFrameIndex A zero based index that specifies the starting frame number for which to get the value If you omit startFrame...

Страница 483: ...y whose value you want to retrieve For a list of properties see Property summary for the Layer object on page 305 Returns The value of the specified property Flash looks at the layer s properties to d...

Страница 484: ...utput panel var timeline fl getDocumentDOM getTimeline timeline setSelectedFrames 5 10 timeline setSelectedFrames 20 25 false var theSelectedFrames timeline getSelectedFrames fl trace theSelectedFrame...

Страница 485: ...If Frame 5 is selected and is a keyframe with a regular frame next to it this method inserts a blank keyframe at Frame 6 If Frame 5 is a keyframe and the frame next to it is already a keyframe no keyf...

Страница 486: ...specified index If no parameters are specified this method works as follows If one or more frames are selected the method inserts the selected number of frames at the location of the first selected f...

Страница 487: ...getTimeline insertFrames 5 The following example inserts three frames in the current layer only fl getDocumentDOM getTimeline insertFrames 3 false The following example inserts four frames in all laye...

Страница 488: ...tKeyframe The following example inserts a keyframe at Frame 10 of the second layer remember that index values are different from frame or layer number values fl getDocumentDOM getTimeline currentLayer...

Страница 489: ...line 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 follo...

Страница 490: ...scription Method pastes the range of frames from the Clipboard into the specified frames Example The following example pastes the frames on the Clipboard to the currently selected frame or playhead lo...

Страница 491: ...meIndex endFrameIndex defaults to the startFrameIndex value This parameter is optional Returns Nothing Description Method deletes the frame Example The following example deletes Frame 5 up to but not...

Страница 492: ...ves the layer at index 2 to the top on top of the layer at index 0 fl getDocumentDOM getTimeline reorderLayer 2 0 The following example places the layer at index 3 after the layer at index 5 fl getDoc...

Страница 493: ...me 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...

Страница 494: ...age 273 startFrameIndex A zero based index that specifies the starting frame number to modify If you omit startFrameIndex the method uses the current selection This parameter is optional endFrameIndex...

Страница 495: ...FrameProperty tweenType motion 1 4 timeline setLayerProperty Availability Flash MX 2004 Usage timeline setLayerProperty property value layersToChange Parameters property A string that specifies the pr...

Страница 496: ...is the frame after the last frame in the range to select bReplaceCurrentSelection A Boolean value that if it is set to true causes the currently selected frames to be deselected before the specified...

Страница 497: ...er to the current selection fl getDocumentDOM getTimeline setSelectedFrames 0 0 9 fl getDocumentDOM getTimeline setSelectedFrames 0 11 14 false See also timeline getSelectedFrames timeline setSelected...

Страница 498: ...ters 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 locki...

Страница 499: ...j setIcon Identifies a PNG file to use as a tool icon in the Flash Tools panel toolObj setMenuString Sets the string that appears in the pop up menu as the name for the tool toolObj setOptionsFile Ass...

Страница 500: ...tools Example The following example specifies that the tool has a depth of 1 which means one level under a tool in the Tools panel fl tools activeTool depth 1 toolObj enablePIControl Availability Fla...

Страница 501: ...the control Returns Nothing Description Method enables or disables the specified control in a Property inspector Used only when creating extensible tools Example The following command in an extensibl...

Страница 502: ...ollowing example assigns a value of 1 the icon ID of the current tool to the toolIconID variable var toolIconID fl tools activeTool iconID toolObj position Availability Flash MX 2004 Usage toolObj pos...

Страница 503: ...thod is used only when you create extensible tools Example The following example specifies that the image in the PolyStar png file should be used as the icon for the tool named PolyStar This code is t...

Страница 504: ...ol theTool setMenuString PolyStar Tool toolObj setOptionsFile Availability Flash MX 2004 Usage toolObj setOptionsFile xmlFile Parameters xmlFile A string that specifies the name of the XML file that h...

Страница 505: ...size variable pointParam min 0 max 1 defaultValue 5 type Double properties Example The following example specifies that the file named PolyStar xml is associated with the currently active tool This c...

Страница 506: ...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 too...

Страница 507: ...the tooltip for the tool should be PolyStar Tool This code is taken from the sample PolyStar jsfl file see Sample PolyStar tool on page 20 theTool fl tools activeTool theTool setToolTip PolyStar Tool...

Страница 508: ...ctor This method is used only when you create extensible tools Example The following command in an extensible tool s JavaScript file will set Flash to not show the fill options in the Property inspect...

Страница 509: ...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 extensible tool s JavaS...

Страница 510: ...nly when creating extensible tools Method Description tools constrainPoint Takes two points and returns a new adjusted or constrained point tools getKeyDown Returns the most recently pressed key tools...

Страница 511: ...heTool variable var theTool fl tools activeTool tools altIsDown Availability Flash MX 2004 Usage tools altIsDown tools penDownLoc Read only a point that represents the position of the last mouse down...

Страница 512: ...1 and pt2 specify the starting click point and the drag to point Returns A new adjusted or constrained point Description Method takes two points and returns a new adjusted or constrained point If the...

Страница 513: ...etermines whether the Control key is being pressed var isCtrldown fl tools ctrlIsDown tools getKeyDown Availability Flash MX 2004 Usage tools getKeyDown Parameters None Returns The integer value of th...

Страница 514: ...vailability Flash MX 2004 Usage tools penDownLoc Description Read only property a point that represents the position of the last mouse down event on the Stage The tools penDownLoc property comprises t...

Страница 515: ...ocation of the mouse pointer Example The following example determines the current location of the mouse var tempPt fl tools penLoc See also tools penDownLoc tools setCursor Availability Flash MX 2004...

Страница 516: ...MX 2004 Usage tools shiftIsDown Description Read only property a Boolean value that is true if the Shift key is pressed false otherwise Example The following example determines whether the Shift key i...

Страница 517: ...t geometric object If snapping is disabled in the View menu in the Flash user interface the point returned is the original point Example The following example returns a new point that may be snapped t...

Страница 518: ...tex object The following properties are available for the Vertex object vertex getHalfEdge Availability Flash MX 2004 Usage vertex getHalfEdge Parameters None Returns A HalfEdge object Method Descript...

Страница 519: ...Location Availability Flash MX 2004 Usage vertex setLocation x y Parameters x A floating point value that specifies the x coordinate of where the vertex should be positioned in pixels y A floating poi...

Страница 520: ...f the x and y values of the vertex in the Output panel var shape fl getDocumentDOM selection 0 var hEdge shape edges 0 getHalfEdge 0 var vertex hEdge getVertex fl trace x location of vertex is vertex...

Страница 521: ...LUI dialog box use fl xmlui For more information see Appendix B XML to UI in Using Flash Method summary for the XMLUI object The following methods are available for the XMLUI object Method Description...

Страница 522: ...ich is equivalent to the user clicking the OK button See also fl xmlui document xmlPanel xmlui cancel xmlui cancel Availability Flash MX 2004 Usage xmlui cancel Parameters None Returns Nothing xmlui s...

Страница 523: ...se value you want to retrieve Returns A string that represents the value of the specified property In cases where you might expect a Boolean value of true or false it returns the string true or false...

Страница 524: ...value of the currently selected line for the myListBox control var elem new Object elem fl xmlui getControlItemElement myListBox fl trace label elem label value elem value See also fl xmlui document x...

Страница 525: ...Parameters controlID A string that specifies the ID attribute of the control whose visibility status you want to retrieve Returns A Boolean value of true if the control is visible or false if it is i...

Страница 526: ...e sets the value of a property named URL to www macromedia com fl xmlui set URL www macromedia com See also fl xmlui document xmlPanel xmlui get xmlui setControlItemElement xmlui setControlItemElement...

Страница 527: ...xmlui setControlItemElements xmlui setControlItemElements Availability Flash 8 Usage xmlui setControlItemElements controlID elementItemArray Parameters controlID A string that specifies the ID attribu...

Страница 528: ...thArray See also xmlui getControlItemElement xmlui set xmlui setControlItemElement xmlui setEnabled Availability Flash 8 Usage xmlui setEnabled controlID enable Parameters controlID A string that spec...

Страница 529: ...D attribute of the control you want to show or hide visible A Boolean value of true if you want to show the control false if you want to hide it Returns Nothing Description Method shows or hides a con...

Страница 530: ...use the following properties with the VideoItem object videoItem sourceFilePath Availability Flash 8 Usage videoItem sourceFilePath Description Read only property a string expressed as a file URI that...

Страница 531: ...library items videoItem videoType Availability Flash 8 Usage videoItem videoType Description Read only property a string that specifies the type of video the item represents Possible values are embedd...

Страница 532: ...532 Objects...

Страница 533: ...mproves performance or when you want to create more advanced tools or effects This extensibility mechanism is a subset of the Macromedia Dreamweaver API If you are familiar with that API you might rec...

Страница 534: ...5 Run the JSFL file from the Commands menu in the Flash authoring environment For more information see Sample DLL implementation on page 540 C level extensibility and the JavaScript interpreter The C...

Страница 535: ...bject JSObject typedef long jsval ifndef JSBool typedef long JSBool endif typedef JSBool JSNative JSContext cx JSObject obj unsigned int argc jsval argv jsval rval Possible values for JSBool define JS...

Страница 536: ..._ValueToObject JSContext cx jsval v JSObject op define JS_ValueToObject c v o mmEnv valueToObject mmEnv valueToObject c v o JS_FALSE JSBool JS_StringToValue JSContext cx unsigned short bytes uint sz j...

Страница 537: ...ent 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...

Страница 538: ...t length jsval vp long getArrayLength JSContext cx JSObject obj JSBool getElement JSContext cx JSObject obj unsigned int idx jsval vp JSBool setElement JSContext cx JSObject obj unsigned int idx jsval...

Страница 539: ...vPtr char env char mmPtr char mmEnv char envEnd char char envPtr envSize char mmEnd char char mmPtr sizeof MM_Environment Copy fields from env to mmEnv one pointer at a time while mmPtr mmEnd envPtr e...

Страница 540: ...t panel This section discusses the development of the sample In this case the DLL contains only one function which adds two numbers The C code is shown in the following example Source code in C Save t...

Страница 541: ...r defines the following data types JSContext JSObject jsval JSBool typedef struct JSContext JSContext A pointer to this opaque data type passes to the C level function Some functions in the API accept...

Страница 542: ...SBool JS_DefineFunction unsigned short JS_ValueToString JSBool JS_ValueToInteger JSBool JS_ValueToDouble JSBool JS_ValueToBoolean JSBool JS_ValueToObject JSBool JS_StringToValue JSBool JS_DoubleToValu...

Страница 543: ...sval structures The array is argc elements in length The rval pointer is a pointer to a single jsval structure The function s return value should be written to rval The function returns JS_TRUE if suc...

Страница 544: ...ture converts it to a string if possible and passes the converted value back to the caller Arguments JSContext cx jsval v unsigned int pLength The cx argument is the opaque JSContext pointer that pass...

Страница 545: ...stores the converted value in lp Returns A Boolean value JS_TRUE indicates success JS_FALSE indicates failure JSBool JS_ValueToDouble Usage JSBool JS_ValueToDouble JSContext cx jsval v double dp Desc...

Страница 546: ...Returns A Boolean value JS_TRUE indicates success JS_FALSE indicates failure JSBool JS_ValueToObject Usage JSBool JS_ValueToObject JSContext cx jsval v JSObject op Description Method extracts a functi...

Страница 547: ...string must be null terminated The sz argument is the size of the string in bytes If sz is 0 the length of the null terminated string is computed automatically The vp argument is a pointer to the jsv...

Страница 548: ...ontains the Boolean value that passes to the function as an argument JSVal JS_BytesToValue Usage JSBool JS_BytesToValue JSContext cx unsigned short bytes uint sz jsval vp Description Method converts b...

Страница 549: ...the integer that passed to the function as an argument JSVal JS_ObjectToValue Usage jsval JS_ObjectToValue JSObject obj Description Method stores an object return value in a JSVal Use JS_ NewArrayObj...

Страница 550: ...object the function returns Array Arguments JSObject obj Typically this argument is passed in and converted using the JS_ValueToObject function Returns A pointer to a null terminated string The caller...

Страница 551: ...n 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 array object or the value null upon failure long JS_GetA...

Страница 552: ...val where the contents of the jsval 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...

Страница 553: ...function The obj argument is a pointer 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 tha...

Страница 554: ...554 C Level Extensibility...

Отзывы: