Page 2
Open Sesame!, Roundtrip, Roundtrip HTML, Shockwave, Sitespring, SoundEdit, Titlemaker, UltraDev, Web Design 101, what the web can be, and Xtra are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc.
Overview of the Macromedia Flash JavaScript API........
Page 18
You can use Macromedia Flash MX 2004 Professional or your preferred text editor to write or edit Flash JavaScript (JSFL) files. If you use Flash Professional, these files have a .jsfl extension by default. To make a script appear in the Commands menu, save its JSFL file in the following folder: •...
You can embed individual JSAPI commands in ActionScript files by using the MMExecute() command, which is documented in the Flash MX 2004 ActionScript Language Reference. However, command has an effect only when it is used in the context of a custom user- MMExecute() interface element, such as a component Property inspector, or a SWF panel within the authoring environment.
object contains the following child objects: flash Object How to access componentsPanel object to access the object. This fl.componentsPanel componentsPanel object corresponds to the Components panel in the Flash authoring environment. Document object to retrieve an array of all the open documents; use fl.documents to access a particular document;...
All the objects in the DOM that aren’t listed in the previous table (see “The Flash Document Object Model” on page 19) are accessed from the object. For example, to access the Document library of a document, you use the property of the object, which retrieves a library...
Summary of the DOM structure The following list displays the DOM structure in outline format. Numbers at the beginning of each line represent the level of an object. For example, an object preceded by “03” is a child of next highest “02” object, which, in turn, is a child of the next highest “01” object. In some cases, an object is available by specifying a property of its parent object.
Included with this documentation is a sample Flash JSAPI script named PolyStar.jsfl. (You can download the file at www.macromedia.com/go/jsapi_info_en.) This script replicates the PolyStar tool that can be found in the Flash Tools panel. The PolyStar.jsfl file demonstrates how to build the PolyStar tool using the JSAPI.
Page 24
To install the updated PolyStar example files: Copy the new PolyStar.jsfl file to the Tools folder. The PolyStar.xml and PolyStar.png files that you see in this folder are needed by the new PolyStar.jsfl file. Restart Flash. Select Edit > Customize Tools Panel (Windows) or Flash > Customize Tools Panel (Macintosh).
CHAPTER 2 Top-level functions This chapter describes the top-level functions that are available when creating extensible tools. The following list shows the functions in alphabetical order: activate() configureEffect() configureTool() deactivate() executeEffect() keyDown() keyUp() mouseDoubleClick() mouseDown() mouseMove() mouseUp() notifySettingsChanged() removeEffect() setCursor()
Page 26
activate() Availability Flash MX 2004. Usage function activate() { // statements Parameters None. Returns Nothing. Description This function is called when the extensible tool becomes active (that is, when the tool is selected in the Tools panel). Any setup the tool needs to do should be performed in this function. Example function activate() { fl.trace( "Tool is active"...
Page 27
configureEffect() Availability Flash MX 2004. Usage function configureEffect() { // statements Parameters None. Returns Nothing. Description This function is called once at load time of Flash and is a good place for global initialization of your effect. The per instance parameter data for an effect cannot be accessed here. See also executeEffect() removeEffect()
Page 28
Returns Nothing. Description This function is called when Macromedia Flash opens and the tool is loaded. Use this function to set any information Flash needs to know about the tool. Example The following examples show two possible implementations of this function: function configureTool() { theTool = fl.tools.activeTool;...
Page 29
deactivate() Availability Flash MX 2004. Usage function deactivate() { // statements Parameters None. Returns Nothing. Description This function is called when the tool becomes inactive (that is, when the active tool changes from this tool to another one). Use this function to perform any cleanup the tool needs. Example function deactivate() { fl.trace( "Tool is no longer active"...
Page 30
executeEffect() Availability Flash MX 2004. Usage function executeEffect() { // statements Parameters None. Returns Nothing. Description This function is called when the user first applies an effect or changes an effect's properties. The code contained in this function is responsible for modifying the original object(s) to accomplish the desired effect.
Page 31
keyDown() Availability Flash MX 2004. Usage function keyDown() { // statements Parameters None. Returns Nothing. Description This function is called when the tool is active and the user presses a key. The script should call to determine which key was pressed. tools.getKeyDown() Example function keyDown() {...
Page 32
keyUp() Availability Flash MX 2004. Usage function keyUp() { // statements Parameters None. Returns Nothing. Description This function is called when the tool is active and a key is released. Example function keyUp() { fl.trace("Key is released"); Chapter 2: Top-level functions...
Page 33
mouseDoubleClick() Availability Flash MX 2004. Usage function mouseDoubleClick() { // statements Parameters None. Returns Nothing. Description This function is called when the mouse button is double-clicked on the Stage. Example function mouseDblClk() { fl.trace("Mouse was double-clicked"); mouseDoubleClick()
Page 34
mouseDown() Availability Flash MX 2004. Usage function mouseDown( [ pt ] ) { // statements Parameters A point that specifies the location of the mouse when the button is pressed. It is passed to the function when the mouse button is pressed. This parameter is optional. Returns Nothing.
Page 35
mouseMove() Availability Flash MX 2004. Usage function mouseMove( [ pt ] ) { // statements Parameters A point that specifies the current location of the mouse. It is passed to the function whenever the mouse moves, which tracks the mouse location. If the Stage is in edit or edit-in-place mode, the point coordinates are relative to the object being edited.
Page 36
mouseUp() Availability Flash MX 2004. Usage function mouseUp() { // statements Parameters None. Returns Nothing. Description This function is called whenever the mouse button is released after being pressed on the Stage. Example function mouseUp() { fl.trace("mouse is up"); Chapter 2: Top-level functions...
Page 37
notifySettingsChanged() Availability Flash MX 2004. Usage function notifySettingsChanged() { // statements Parameters None. Returns Nothing. Description This function is called whenever a tool is active and the user changes its options in the Property inspector. You can use the property to query the current values of the tools.activeTool options.
Page 38
removeEffect() Availability Flash MX 2004. Usage function removeEffect() { // statements Parameters None. Returns Nothing. Description This function is called when the user changes an effect's properties or uses the "remove effect" menu item. The code contained in this function is responsible for returning the object(s) to their original state.
Page 39
setCursor() Availability Flash MX 2004. Usage function setCursor() { // statements Parameters None. Returns Nothing. Description This function is called whenever the mouse moves, to allow the script to set custom pointers. The script should call to specify the pointer to use. For a list that shows which tools.setCursor() pointers correspond to which integer values, see tools.setCursor()
CHAPTER 3 Objects This chapter describes the Flash JSAPI objects, listed in alphabetical order. The objects are listed in the following table: Object Description BitmapInstance object The BitmapInstance object is a subclass of the Instance object represents a bitmap in a frame. BitmapItem object A BitmapItem object refers to a bitmap in the library of a document.
Page 42
Object Description fontItem object The fontItem object is a subclass of the Item object. Frame object The Frame object represents frames in the layer. HalfEdge object Directed side of the edge of a Shape object. Instance object The Instance object is a subclass of the Element object.
Object Description TextRun object The TextRun object represents a run of characters that have attributes that match all of the properties in the TextAttrs object. Timeline object The Timeline object represents the Flash Timeline, which can be accessed for the current document by fl.getDocumentDOM().getTimeline().
bitmapInstance.getBits() Availability Flash MX 2004. Usage bitmapInstance.getBits() Parameters None. Returns An object that contains , and, if the bitmap has a color table, width height depth bits cTab properties. The element is an array of bytes. The element is an array of color values of bits cTab the form...
var isBitmap = bmObj.instanceType; if(isBitmap == "bitmap"){ var numHorizontalPixels = bmObj.hPixels; bitmapInstance.setBits() Availability Flash MX 2004. Usage bitmapInstance.setBits(bitmap) Parameters An object that contains , and properties. The bitmap height width depth bits cTab , and properties are integers. The property is a byte array. The height width depth...
Page 46
Example The following code gets the height of the bitmap in pixels: // get the number of pixels in the vertical dimension var bmObj = fl.getDocumentDOM().selection[0]; var isBitmap = bmObj.instanceType; if(isBitmap == "bitmap"){ var numVerticalPixels = bmObj.vPixels; Chapter 3: Objects...
CHAPTER 3 Objects BitmapItem object Inheritance Item object > BitmapItem object Availability Flash MX 2004. Description A BitmapItem object refers to a bitmap in the library of a document. The BitmapItem object is a subclass of the Item object. Property summary for the BitmapItem object In addition to the Item object properties, the BitmapItem object has following properties:...
bitmapItem.compressionType Availability Flash MX 2004. Usage bitmapItem.compressionType Description Property; a string that determines the type of image compression applied to the bitmap. Acceptable values are . If "photo" "lossless" bitmapItem.useImportedJPEGQuality corresponds to JPEG using a quality from 0 to 100; if false "photo"...
Page 49
Description Property; a Boolean value. To use the default imported JPEG quality, specify true false otherwise. Available only for JPEG compression. Example The following code sets the property of the first item in the library of useImportedJPEGQuality the current document to true fl.getDocumentDOM().library.items[0].useImportedJPEGQuality = true;...
CHAPTER 3 Objects CompiledClipInstance object Inheritance Element object > Instance object > CompiledClipInstance object Availability Flash MX 2004. Description The CompiledClipInstance object is a subclass of the Instance object. It is essentially an instance of a movie clip that has been converted to a compiled clip library item. Property summary for the CompiledClipInstance object In addition to the properties of the Instance...
Example // get the name of the object. var theName = fl.getDocumentDOM().selection[0].accName; // set the name of the object. fl.getDocumentDOM().selection[0].accName = 'Home Button'; compiledClipInstance.actionScript Availability Flash MX 2004. Usage compiledClipInstance.actionScript Description Property; a string that represents the ActionScript for this instance; equivalent to symbolInstance.actionScript Example The following code assigns ActionScript to specified elements:...
compiledClipInstance.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 equivalent to the inverse logic of the Make Child Objects Accessible setting in the Accessibility panel.
Description Property; a Boolean value that enables or disables the accessibility of the object; equivalent to the inverse logic of Make Object Accessible setting in the Accessibility panel. That is, if silent , then Make Object Accessible is unchecked. If , then Make Object true silent...
CHAPTER 3 Objects ComponentInstance object Inheritance Element object > Instance object > SymbolInstance object > ComponentInstance object Availability Flash MX 2004. Description The ComponentInstance object is a subclass of the SymbolInstance object and represents a component in a frame. Property summary for the ComponentInstance object In addition to all the properties of the SymbolInstance object, the ComponentInstance object has...
CHAPTER 3 Objects componentsPanel object Availability Flash MX 2004. Description The componentsPanel object, which represents the Components panel, is a property of the flash object and can be accessed by fl.componentsPanel. Method summary for the ComponentsPanel object You can use the following method with the componentsPanel object: Property Description Adds the specified component to the document at the...
CHAPTER 3 Objects Contour object Availability Flash MX 2004. Description A Contour object represents a closed path of half edges on the boundary of a shape. Method summary for the Contour object You can use the following method with the Contour object: Property Description Method;...
elt.beginEdit(); var contourArray = elt.contours; var contourCount = 0; for (i=0; i<contourArray.length; i++) var contour = contourArray[i]; contourCount++; var he = contour.getHalfEdge(); var iStart = he.id; var id = 0; while (id != iStart) // get the next vertex var vrt = he.getVertex(); var x = vrt.x;...
elt.endEdit(); contour.orientation Availability Flash MX 2004. Usage contour.orientation Description Read-only property: an integer indicating the orientation of the contour. The value of the integer is -1 if the orientation is counterclockwise, 1 if it is clockwise, and 0 if it is a contour with no area. Example The following example traverses all the contours of the selected shape and shows the value of the property of each contour in the Output panel:...
CHAPTER 3 Objects Document object Availability Flash MX 2004. Description The Document object represents the Stage. That is, only FLA files are considered documents. Method summary for the Document object You can use the following methods with the Document object. Method Description Stores specified data with a document.
Page 60
Method Description Cuts the current selection from the document and writes document.clipCut() it to the Clipboard. Pastes the contents of the Clipboard into the document. document.clipPaste() Closes the specified document. document.close() Converts lines to fills on the selected objects. document.convertLinesToFills() Converts the selected Stage item(s) to a new symbol.
Page 61
Method Description Gets the specified property for the current document.getElementProperty() Element selection. Gets a specified property of the selected text document.getElementTextAttr() TextAttrs objects. Gets the bounding rectangle of the current selection. document.getSelectionRect() Gets the currently selected text. document.getTextString() Retrieves the current Timeline object in the document.
Page 62
Method Description Rotates the selection by a specified amount. document.rotateSelection() Saves the document in its default location; equivalent to document.save() selecting File > Save. Saves and compacts the file; equivalent to selecting document.saveAndCompact() File > Save and Compact. Scales the selection by a specified amount; equivalent to document.scaleSelection() using the Free Transform tool to scale the object.
Page 63
Method Description Sets the text selection of the currently selected text field document.setTextSelection() to the values specified by the startIndex endIndex values. Inserts a string of text. document.setTextString() Moves the transformation point of the current selection. document.setTransformationPoint() Skews the selection by a specified amount. document.skewSelection() Smooths the curve of each selected fill outline or curved document.smoothSelection()
Property Description A string that is equivalent to the Description field in the document.description Accessibility panel. A Boolean value that specifies whether the children of document.forceSimple the specified object are accessible. A float value that specifies the number of frames document.frameRate displayed per second when the SWF file plays;...
Example The following example sets the accessibility name of the document to "Main Movie" fl.getDocumentDOM().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.addDataToDocument( name, type, data ) Parameters A string that specifies the name of the data to add.
Parameters A string that specifies the name of the persistent data. name Defines the type of data. The valid values for are: type type "integer" "integerArray" , and "double" "doubleArray" "string" "byteArray" the value to add. Valid types depend on the parameter.
The following example adds the symbol from the current document’s library to the myMovieClip current document: var itemIndex = fl.getDocumentDOM().library.findItemIndex("myMovieClip"); var theItem = fl.getDocumentDOM().library.items[itemIndex]; fl.getDocumentDOM().addItem({x:0,y:0}, theItem); The following example adds the symbol from the second document in the myMovieClip documents array to the third document in the documents array: var itemIndex = fl.documents[1].library.findItemIndex("myMovieClip");...
Parameters A rectangle that specifies the bounds of the oval to be added. boundingRectangle A Boolean value that, if set to , causes the method to create the shape bSuppressFill true without a fill. The default value is . This parameter is optional. false A Boolean value that, if set to , causes the method to create the shape...
Description Method; adds a new publish profile and makes it the current one. See document.deletePublishProfile() 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: fl.getDocumentDOM().addNewPublishProfile();...
Example The following example adds a new rectangle with no round corners within the specified coordinates. flash.getDocumentDOM().addNewRectangle({left:0,top:0,right:100,bottom:100},0); The following example adds a new rectangle with no round corners and without a fill. flash.getDocumentDOM().addNewRectangle({left:0,top:0,right:100,bottom:100},0, true); The following example add a new rectangle no round corners and without a stroke. flash.getDocumentDOM().addNewRectangle({left:0,top:0,right:100,bottom:100},0, false, true);...
document.addNewText() Availability Flash MX 2004. Usage document.addNewText( boundingRectangle ) Parameters Specifies the size and location of the text field by providing locations in boundingRectangle pixels for , and . The method applies the current text attributes. It left right bottom should be followed by calling to populate the new text box.
Example The following example aligns objects to left and to the Stage. This is equivalent to turning on the To Stage setting in the Align panel and clicking the Align to Left button: fl.getDocumentDOM().align("left", true); document.allowScreens() Availability Flash MX 2004. Usage document.allowScreens() Parameters...
Returns Nothing. Description Method; arranges the selection on the Stage. This method applies only to non-shape objects. Example The following example moves the current selection to the front: fl.getDocumentDOM().arrange("front"); document.autoLabel Availability Flash MX 2004. Usage document.autoLabel Description Property; A Boolean value that is equivalent to the Auto Label check box in the Accessibility panel.
document.breakApart() Availability Flash MX 2004. Usage document.breakApart() Parameters 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(); document.canEditSymbol() Availability Flash MX 2004. Usage document.canEditSymbol() Parameters None. Returns A Boolean value: if the Edit Symbols menu and functionality are available for use;...
document.canRevert() Availability Flash MX 2004. Usage document.canRevert() Parameters None. Returns A Boolean value: if you can use the true document.revert() fl.revertDocument() methods successfully; otherwise. false Description Method; determines whether you can use the document.revert() fl.revertDocument() method successfully. Example The following example checks whether the current document can revert to the previously saved version.
Example The following example tests whether can be used. If so, it fl.getDocumentDOM().testMovie() calls the method. if(fl.getDocumentDOM().canTestMovie()){ fl.getDocumentDOM().testMovie(); document.canTestScene() Availability Flash MX 2004. Usage document.canTestScene() Parameters None. Returns A Boolean value: if you can use the method successfully; true document.testScene() false otherwise.
Description Method; copies the current selection from the document to the Clipboard. Example The following example copies the current selection from the document to the Clipboard: fl.getDocumentDOM().clipCopy(); document.clipCut() Availability Flash MX 2004. Usage document.clipCut() Parameters None. Returns Nothing. Description Method; cuts the current selection from the document and writes it to the Clipboard. Example The following example cuts the current selection from the document and writes it to the Clipboard:...
Example The following examples pastes the Clipboard contents to the center of the document: fl.getDocumentDOM().clipPaste(); The following example pastes the Clipboard contents in place in the current document: fl.getDocumentDOM().clipPaste(true); document.close() Availability Flash MX 2004. Usage document.close( [bPromptToSaveChanges] ) Parameters A Boolean value that, when set to causes the method to prompt bPromptToSaveChanges true,...
Returns Nothing. Description Method; converts lines to fills on the selected objects. Example The following example converts the current selected lines to fills: fl.getDocumentDOM().convertLinesToFills(); document.convertToSymbol() Availability Flash MX 2004. Usage document.convertToSymbol( type name registrationPoint ) Parameters A string that specifies the type of symbol to create. Valid values for type type "movie...
document.currentPublishProfile Availability Flash MX 2004. Usage document.currentPublishProfile Description Property; a string that specifies the name of the active publish profile for the specified document. Example The following example adds a new publish profile with the default name and then displays the name of the profile in the Output panel: fl.getDocumentDOM().addNewPublishProfile();...
++i; document.deletePublishProfile() Availability Flash MX 2004. Usage document.deletePublishProfile() Parameters None. Returns An integer that is the index of the new current profile. If a new profile is not available, the method leaves the current profile unchanged and returns its index. Description Method;...
Example Assuming there are three scenes ( , and ) in the current document, the Scene0 Scene1 Scene2 following example makes the current scene and then deletes it: Scene2 fl.getDocumentDOM().editScene(2); var success = fl.getDocumentDOM().deleteScene(); document.deleteSelection() Availability Flash MX 2004. Usage document.deleteSelection() Parameters None.
Returns Nothing. Description Method; performs a distribute-to-layers operation on the current selection—equivalent to selecting Distribute to Layers. This method displays an error if there is no selection. Example The following example distributes the current selection to layers: fl.getDocumentDOM().distributeToLayers(); document.documentHasData() Availability Flash MX 2004.
Returns An integer that is the index of the new profile in the profile list. Returns -1 if the profile cannot be duplicated. 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 of the new profile in the Output panel: fl.trace(fl.getDocumentDOM().duplicatePublishProfile("dup profile"));...
Returns Nothing. Description Method; duplicates the selection on the Stage. Example The following example duplicates the current selection, which is similar to Alt-clicking and then dragging an item: fl.getDocumentDOM().duplicateSelection(); document.editScene() Availability Flash MX 2004. Usage document.editScene( index ) Parameters A zero-based integer that specifies which scene to edit. index Returns Nothing.
Returns Nothing. Description Method; switches the authoring tool into the editing mode specified by the parameter. If no parameter is specified, the method defaults to symbol-editing mode, which has the same result as right-clicking the symbol to invoke the context menu and selecting Edit. See document.exitEditMode() Example The following example puts Flash in edit-in-place mode for the currently selected symbol:...
Parameters A string, expressed as a file://URL, that specifies the path of the XML file to which the fileURI profile is exported. Returns Nothing. Description Method; exports the currently active profile to a file. Example The following example exports the currently active profile to the file named profile.xml in the folder /Documents and Settings/username/Desktop on the C drive: fl.getDocumentDOM().exportPublishProfile('file:///C|/Documents and Settings/ username/Desktop/profile.xml');...
The following example displays the Export Movie dialog box and the Export Flash Player dialog box and then exports the document based on the specified settings: fl.getDocumentDOM().exportSWF("", true); The following example displays the Export Movie dialog box and then exports the document with specified settings: fl.getDocumentDOM().exportSWF();...
Example The following example sets the frame rate to 25.5 frames per second: fl.getDocumentDOM().frameRate = 25.5; document.getAlignToDocument() Availability Flash MX 2004. Usage document.getAlignToDocument() Parameters None. Returns A Boolean value: if the preference is set to align the objects to the Stage; otherwise.
Returns Fill object specified by the parameter, if successful; otherwise, it returns objectToFill undefined. Description Method; retrieves the fill object of the selected shape or, if specified, of the toolbar and Property inspector. See document.setCustomFill() Example The following example gets the fill object of the selection and then changes the selection’s color to white: var fill = fl.getDocumentDOM().getCustomFill();...
Description Returns the stroke object of the selected shape or, if specified, of the toolbar and Property inspector. See document.setCustomStroke() Example The following example returns the current stroke settings of the selection and changes the stroke thickness to 2: var stroke = fl.getDocumentDOM().getCustomStroke("selection"); stroke.thickness = 2;...
document.getElementProperty() Availability Flash MX 2004. Usage document.getElementProperty( propertyName ) Parameters The name of the Element property for which to retrieve the value. Returns The value of the specified property. Returns if the property is an indeterminate state, as null when multiple elements are selected with different property values. Returns if the undefined property is not a valid property of the selected element.
Returns If one text field is selected, the property is returned if there is only one value used within the text. Returns if there are several values used inside the text field. If several text fields are undefined selected, and all the text alignment values are equal, the method returns this value. If several text fields are selected, but all the text alignment values are not equal, the method returns undefined If the optional arguments are not passed, these rules apply to the range of text currently selected...
Example The following example gets the bounding rectangle for the current selection and then displays its properties: var newRect = fl.getDocumentDOM().getSelectionRect(); var outputStr = "left: " + newRect.left + " top: " + newRect.top + " right: " + newRect.right + " bottom: " + newRect.bottom; alert(outputStr);...
document.getTimeline() Availability Flash MX 2004. Usage document.getTimeline() Parameters None. Returns The current Timeline object. Description Method; retrieves the current Timeline object in the document. The current Timeline can be the current scene, the current symbol being edited, or the current screen. See , and document.currentTimeline document.timelines...
Description Method; gets the location of the transformation point of the current selection. You can use the transformation point for commutations such as rotate and skew. See document.setTransformationPoint() Example The following example gets the transformation point for the current selection. The property gives the x coordinate of the transformation point.
Example The following example sets the height of the Stage to 400 pixels: fl.getDocumentDOM().height = 400; document.importPublishProfile() Availability Flash MX 2004. Usage document.importPublishProfile( fileURI ) Parameters A string that specifies the path, expressed as a file://URL, of the XML file defining the fileURI profile to import.
Example The following example imports the file from the Flash Configuration folder: "mySwf.swf" fl.getDocumentDOM().importSWF(fl.configURI+"mySwf.swf"); document.library Availability Flash MX 2004. Usage document.library Description Read-only property; the library object for a document. Example The following example gets the library for the currently focused document: var myCurrentLib = fl.getDocumentDOM().library;...
document.match() Availability Flash MX 2004. Usage document.match( bWidth, bHeight [, bUseDocumentBounds] ) Parameters A Boolean value that, when set to , causes the method to make the widths of the bWidth true selected items the same. A Boolean value that, when set to , causes the method to make the heights of the bHeight true...
A Boolean value that specifies the state of the Shift key: for pressed; bToggleSel true false for not pressed. A Boolean value that specifies the state of the application preference Shift select: bShiftSel for on; for off. true false Returns Nothing.
document.moveSelectedBezierPointsBy() Availability Flash MX 2004. Usage document.moveSelectedBezierPointsBy( delta ) Parameters A pair of floating point values that specify the x and y coordinates in pixels by which the delta selected Bézier points are moved. For example, passing ( ) specifies a location that is to {x:1,y:2} the right by one pixel and down by two pixels from the current location.
For information on making a selection, see document.setSelectionRect() , and the Element object. document.mouseClick() document.mouseDblClk() Example The following example moves the selected item 62 pixels to the right and 84 pixels down: flash.getDocumentDOM().moveSelectionBy({x:62, y:84}); document.name Availability Flash MX 2004. Usage document.name Description Read-only property;...
Description Method; optimizes smoothing for the current selection, allowing multiple passes, if specified, for optimal smoothing. This method is equivalent to selecting Modify > Shape > Optimize. Example The following example optimizes the curve of the current selection to 50º of smoothing with multiple passes: fl.getDocumentDOM().optimizeCurves(50, true);...
Example The following example publishes the current document: fl.getDocumentDOM().publish(); document.publishProfiles 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 publish profiles for the document: var myPubProfiles = fl.getDocumentDOM().publishProfiles;...
document.removeDataFromSelection() Availability Flash MX 2004. Usage document.removeDataFromSelection( name ) Parameters A string that specifies the name of the persistent data to remove. name Returns Nothing. Description Method; removes persistent data with the specified name that has been attached to the selection. document.addDataToSelection() Example The following example removes from the selection the persistent data named...
document.renameScene() Availability Flash MX 2004. Usage document.renameScene( name ) Parameters A string that specifies the new name of the scene. name Returns A Boolean value: if the name is changed successfully; otherwise. If the new name is true false not unique, for example, the method returns false Description Method;...
Example The following example moves the second scene to before the first scene: fl.getDocumentDOM().reorderScene(1, 0); document.resetTransformation() Availability Flash MX 2004. Usage document.resetTransformation() Parameters None. Returns Nothing. Description Method; resets the transformation matrix. This method is equivalent to selecting Modify > Transform >...
Example The following example reverts the current document to the previously saved version: fl.getDocumentDOM().revert(); document.rotateSelection() Availability Flash MX 2004. Usage document.rotateSelection( angle [, rotationPoint] ) Parameters A floating point value that specifies the angle of the rotation. angle A string that specifies which side of the bounding box to rotate. Valid values rotationPoint are: "top right"...
Returns A Boolean value: if the save operation completes successfully; otherwise. true false Description Method; saves the document in its default location. This method is equivalent to selecting File > Save. See , and document.saveAndCompact() fl.saveDocumentAs() fl.saveDocument() fl.saveAll() Example The following example saves the current document in its default location: fl.getDocumentDOM().save();...
Parameters A floating point value that specifies the amount of x by which to scale. xScale A floating point value that specifies the amount of y by which to scale. yScale A string value that specifies the edge about which the transformation occurs. If whichCorner omitted, scaling occurs about the transformation point.
myArray.push(" "+i+" : "+fl.getDocumentDOM().screenOutline[i]) ; fl.trace("Here is the property dump for screenOutline:: "+myArray); document.selectAll() Availability Flash MX 2004. Usage document.selectAll() Parameters None. Returns Nothing. Description Method; selects all items on the Stage. This method is equivalent to pressing Control+A (Windows) or Command+A (Macintosh) or selecting Edit > Select All. See document.selectNone() document.selection Example...
Page 113
• Use one of the methods of the Timeline object to select a frame or frames, such as , or timeline.getSelectedFrames() timeline.setSelectedFrames() timeline.selectAllFrames() • Specify a particular element in a particular frame. For example, the following code specifies and selects an element: fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0];...
//begin loop through the elements on a layer for(var c=0; c < theElems.length; c++){ //checks to see if the element is of type "instance" if(theElems[c].elementType == "instance"){ //if the element is an instance, it checks if it is an instance of "myMovieClip"...
document.setAlignToDocument() Availability Flash MX 2004. Usage document.setAlignToDocument( bToStage ) Parameters A Boolean value that, if set to , aligns objects to the Stage. If set to , it bToStage true false does not. Returns Nothing. Description Method; sets the preferences for document.align() document.distribute() , and...
Example The following example changes the color of the fill color swatch in the toolbar, Property inspector, and any selected shapes to white: var fill = fl.getDocumentDOM().getCustomFill(); fill.color = '#FFFFFF'; fill.style = "solid"; fl.getDocumentDOM().setCustomFill(fill); document.setCustomStroke() Availability Flash MX 2004. Usage document.setCustomStroke( stroke ) Parameters Stroke...
Note: You can’t use this method to set values for read-only properties, such as element.elementType , and element.top element.left Specifies the value to set in the specified Element property. value Returns Nothing. Description Method; sets the specified property on selected object(s) in the document. This method Element does nothing if there is no selection.
Example The following examples set the text attributes for the selected fillColor, italic, and bold text items: var success = fl.getDocumentDOM().setElementTextAttr("fillColor", "#00ff00"); var pass = fl.getDocumentDOM().setElementTextAttr("italic", true, 10); var ok = fl.getDocumentDOM().setElementTextAttr("bold", true, 5, 15); document.setFillColor() Availability Flash MX 2004. Usage document.setFillColor( color ) Parameters...
Returns Nothing. Description Methods; sets the opacity of the instance. Example The following example sets the opacity of the tint to a value of 50: fl.getDocumentDOM().setInstanceAlpha(50); document.setInstanceBrightness() Availability Flash MX 2004. Usage document.setInstanceBrightness( brightness ) Parameters An integer that specifies brightness as a value from -100 (black) to 100 (white). brightness Returns Nothing.
Returns Nothing. Description Method; sets the tint for the instance. Example The following example sets the tint for the selected instance to red with an opacity value of 50: fl.getDocumentDOM().setInstanceTint(0xff0000, 50); document.setSelectionBounds() Availability Flash MX 2004. Usage document.setSelectionBounds( boundingRectangle ) Parameters A rectangle that specifies the new location and size of the selection.
A Boolean value, that if set to , replaces the current bReplaceCurrentSelection true selection. If it is , the method adds to the current selection. The default value, if not set, is false true Returns Nothing. Description Method; draws a rectangular selection marquee relative to the Stage, using the specified coordinates.
Returns Nothing. Description Method; sets the color, width, and style of the selected strokes. For information on changing the stroke in the toolbar and Property inspector, see document.setCustomStroke() Example The following example sets the color of the stroke to red, the size to 3.25, and the type to dashed: fl.getDocumentDOM().setStroke("#ff0000", 3.25, "dashed");...
Parameters A floating point value from 0.25 to 10 that specifies the stroke size. The method ignores size precision greater than two decimal places. Returns Nothing. Description Method; changes the stroke size of the selection to the specified size. For information on changing the stroke in the toolbar and Property inspector, see document.setCustomStroke() Example...
Parameters A text rectangle object that specifies the new size within which the text boundingRectangle item should flow. Returns A Boolean value: if the size of at least one text field is changed; otherwise. true false Description Method; changes the bounding rectangle for the selected text item to the specified size. This method causes the text to reflow inside the new rectangle;...
document.setTextString() Availability Flash MX 2004. Usage document.setTextString( text [, startIndex [, endIndex]] ) Parameters A string of the characters to insert in the text field. text An integer that specifies first character to replace. The first character position is 0 startIndex (zero).
Parameters A pair of floating point numbers that specifies values for each of the transformationPoint following elements: • Shapes: is set relative to document. 0,0 is the same as the Stage (upper transformationPoint left corner). • Symbols: is set relative to the symbol’s registration point. 0,0 is located transformationPoint at the registration point.
The following example sets the property to , indicating that the document is silent false accessible: fl.getDocumentDOM().silent = false; document.skewSelection() Availability Flash MX 2004. Usage document.skewSelection( xSkew, ySkew [, whichEdge] ) Parameters A floating point number that specifies the amount of by which to skew, measured in xSkew degrees.
Returns Nothing. Description Method; smooths the curve of each selected fill outline or curved line. This method performs the same action as the Smooth button in the Tools panel. Example The following example smooths the curve of the current selection: fl.getDocumentDOM().smoothSelection();...
document.straightenSelection() Availability Flash MX 2004. Usage document.straightenSelection() Parameters None. Returns Nothing. Description Method; straightens the currently selected strokes. This method is equivalent to using the Straighten button in the Tools panel. Example The following example straightens the curve of the current selection: fl.getDocumentDOM().straightenSelection();...
document.testMovie() Availability Flash MX 2004. Usage document.testMovie() Parameters None. Returns Nothing. Description Method; executes a Test Movie operation on the document. See document.canTestMovie() document.testScene() Example The following example tests the movie for the current document: fl.getDocumentDOM().testMovie(); document.testScene() Availability Flash MX 2004. Usage document.testScene() Parameters...
document.timelines Availability Flash MX 2004. Usage document.timelines Description Read-only property; an array of Timeline objects (see Timeline object). See document.getTimeline() document.currentTimeline Example The following example gets the array of current Timelines in the active document and displays their names in the Output panel: var i = 0;...
Example The following example traces the selected bitmap, using the specified parameters: fl.getDocumentDOM().traceBitmap(0, 500, 'normal', 'normal'); document.transformSelection() Availability Flash MX 2004. Usage document.transformSelection( a Parameters A floating point number that specifies the (0,0) element of the transformation matrix. A floating point number that specifies the (0,1) element of the transformation matrix. A floating point number that specifies the (1,0) element of the transformation matrix.
Example The following example ungroups the elements in the current selection: fl.getDocumentDOM().unGroup(); document.unlockAllElements() Availability Flash MX 2004. Usage document.unlockAllElements() Parameters None. Returns Nothing. Description Method; unlocks all locked elements on the currently selected frame. See element.locked Example The following example unlocks all locked objects in the current frame: fl.getDocumentDOM().unlockAllElements();...
document.width Availability Flash MX 2004. Usage document.width Description Property; an integer that specifies the width of the document (Stage) in pixels. See document.height Example The following example sets the width of the Stage to 400 pixels. fl.getDocumentDOM().width= 400; document.xmlPanel() Availability Flash MX 2004.
CHAPTER 3 Objects drawingLayer object Availability Flash MX 2004. Description The drawingLayer object is accessible from JavaScript as a child of the flash object. The drawingLayer object is used for extensible tools when the user wants to temporarily draw while dragging—for example, when creating a selection marquee.
Parameters A Boolean value (optional). If set to , it indicates that the drawing in the persistentDraw true last frame remains on the Stage until a new call is made. (In this beginDraw() beginFrame() context, frame refers to where you start and end drawing; it does not refer to Timeline frames.) For example, when users draw a rectangle, they can preview the outline of the shape while dragging the mouse.
drawingLayer.cubicCurveTo() Availability Flash MX 2004. Usage drawingLayer.cubicCurveTo(x1Ctrl, y1Ctrl, x2Ctl, y2Ctl, xEnd, yEnd) Parameters A floating-point value that is the x location of the first control point. x1Ctl A floating-point value that is the y location of the first control point. y1Ctl A floating-point value that is the x position of the middle control point.
Description Method; draws a quadratic curve segment starting at the current drawing position and ending at a specified point. You typically use this method only when creating extensible tools. Example The following example draws a quadratic curve using the specified control points: fl.drawingLayer.curveTo(0, 0, 2, 0);...
Example The following example exits drawing mode: fl.drawingLayer.endDraw(); drawingLayer.endFrame() Availability Flash MX 2004. Usage drawingLayer.endFrame() Parameters None. Returns Nothing. Description Method; signals the end of a group of drawing commands. A group of drawing commands refers to everything drawn between drawingLayer.beginFrame() drawingLayer.endFrame() The next call to...
drawingLayer.moveTo() Availability Flash MX 2004. Usage drawingLayer.moveTo(x, y) Parameters A floating-point value that specifies the x coordinate of the position at which to start drawing. A floating-point value that specifies the y coordinate of the position at which to start drawing.
drawingLayer.setColor() Availability Flash MX 2004. Usage drawingLayer.setColor(color) Parameters A color that is specified by a string, integer, or hexadecimal value. color Returns Nothing. Description Method; sets the color of subsequently drawn data. Applies only to persistent data. To use this method, the parameter passed to must be set to .
CHAPTER 3 Objects Edge object Availability Flash MX 2004. Description The Edge object represents an edge of a shape on the Stage. Method summary for the Edge object The following methods are available for the Edge object: Method Description Method; gets a point object set to the location of the specified control point of edge.getControl() the edge.
Example The following example stores the first control point of the specified shape in the variable: var shape = fl.getDocumentDOM().selection[0]; var pt = shape.edges[0].getControl(0); edge.getHalfEdge() Availability Flash MX 2004. Usage edge.getHalfEdge(index) Parameters An integer that specifies which half edge to return. The value of must be either 0 index index...
edge.isLine Availability Flash MX 2004. Usage edge.isLine Description Read-only property; an integer with a value of 0 or 1. A value of 1 indicates that the edge is a straight line. In that case, the middle control point bisects the line joining the two end points. Example The following example determines whether the specified edge is a straight line, and shows a value of 1 (it is a straight line) or 0 (it isn’t a straight line) in the Output panel:...
Example The following example sets the beginning control point of the specified edge to the (0, 1) coordinates: x = 0; y = 1; var shape = fl.getDocumentDOM().selection[0]; shape.beginEdit(); shape.edges[0].setControl(0, x, y); shape.endEdit(); edge.splitEdge() Availability Flash MX 2004. Usage edge.splitEdge( t ) Parameters A floating point value between 0 and 1 that specifies where to split the edge.
CHAPTER 3 Objects Effect object Availability Flash MX 2004. Description This is a single effect descriptor object. The and the properties fl.activeEffect fl.effects contain this type of object. The Effect object represents an instance of a Timeline effect. Property summary for the Effect object In addition to the properties listed in the following table, Effect objects can also have user-defined parameters, which must be specified in the same XML file that specifies the effect.effectName...
effect.groupName Availability Flash MX 2004. Usage effect.groupName Description Read-only property; a string that represents the name of the effect group used for the hierarchical Context menu for effects. If this value is an empty string, the effect appears ungrouped at the top level of the Context menu.
Description Read-only property; a string that specifies the type of symbol to create during the initial application of the effect. The supported types are: , and . If "graphic" "movie clip" "button" a symbol type was not specified when the effect was created, the default value is " ".
CHAPTER 3 Objects Element object Availability Flash MX 2004. Description Everything that appears on the Stage is of the type Element. The following code example lets you select an element: fl.getDocumentDOM().getTimeline().frames[0].layers[0].elements[0]; Method summary for the Element object The following methods are available for the Element object: Method Description Retrieves the value of the data specified by the...
element.depth Availability Flash MX 2004. Usage element.depth Description Read-only property; an integer that has a value greater than 0 for the depth of the object in the view. The drawing order of objects on the Stage specifies which one is on top of the others. Object order can also be managed with the Modify >...
Returns A Boolean value: if the specified data is attached to the object; otherwise. true false Description Method; determines whether the specified data has been attached to the specified element. Only symbols and bitmaps support persistent data. Example element.getPersistentData() element.height Availability Flash MX 2004.
fl.trace("Left (before) = " + sel.left); fl.getDocumentDOM().moveSelectionBy({x:100, y:0}); fl.trace("Left (after) = " + sel.left); See the example. element.elementType element.locked Availability Flash MX 2004. Usage element.locked Description Property; a Boolean value: if the element is locked; otherwise. If the value of true false , this property is ignored.
element.name Availability Flash MX 2004. Usage element.name Description Property; a string that specifies the name of the element, normally referred to as the Instance name. If the value of , this property is ignored. element.elementType "shape" Example The following example sets the Instance name of the first element in Frame 1, top layer to "clip_mc": fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].name = "clip_mc";...
Parameters A string that specifies the name to associate with the data. This name is used to retrieve name the data. A string that defines the type of the data. The allowable values are type "integer" , and "integerArray" "double" "doubleArray"...
element.width Availability Flash MX 2004. Usage element.width Description Property; a float value that specifies the width of the element in pixels. Note: Do not use this property to resize a text field. Instead, select the text field and use . Using this property with a text field scales the text. document.setTextRectangle() Example The following example sets the width of the specified element to 100:...
CHAPTER 3 Objects EmbeddedVideoInstance object Inheritance Element object > Instance object > EmbeddedVideoInstance object Availability Flash MX 2004. Description The EmbeddedVideoInstance object is a subclass of Instance object. There are no unique methods or properties of EmbeddedVideoInstance. EmbeddedVideoInstance object...
CHAPTER 3 Objects Fill object Availability Flash MX 2004. Description This object contains all the properties of the Fill color setting of the toolbar or of a selected shape. To retrieve a Fill object, use document.getCustomFill() Property summary for the Fill object The following properties are available for the Fill object: Property Description...
fill.colorArray Availability Flash MX 2004. Usage fill.colorArray Description Property; an array of colors in gradient. This property is available only if the value of the property is either fill.style "radialGradient" "linearGradient" Example The following example displays the color array of the current selection, if appropriate, in the Output panel.
fill.posArray = [0, 100, 200]; fl.getDocumentDOM().setCustomFill( fill ); fill.style Availability Flash MX 2004. Usage fill.style Description Property; a string that specifies the fill style. Valid values are: "solid" "linearGradient" , and . If an object has no fill, this property has a value of "radialGradient"...
CHAPTER 3 Objects flash object Availability Flash MX 2004. Description The flash object represents the Flash application. Method summary for the flash object The following methods can be used with the flash object. Method Description Opens a File Open or File Save system dialog box and lets the user fl.browseForFileURL() specify a file to be opened or saved.
Page 162
Method Description Displays the Save As dialog box for the specified document. fl.saveDocumentAs() Sets the active window to be the specified document. fl.setActiveWindow() Sends a text string to the Output panel. fl.trace() Property summary for the flash object The following properties can be used with the flash object. Properties Description Read-only;...
fl.activeEffect Availability Flash MX 2004. Usage fl.activeEffect Description Read-only property; the Effect object for the current effect being applied. For a list of properties available to , see “Property summary for the Effect object” on page 146. fl.activeEffect Example The following example stores an object that represents the current effect in the variable.
var fileURL = fl.browseForFileURL("open", "Select file"); var doc = fl.openDocument(fileURL); fl.closeAll() 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 saved. The method prompts the user, if necessary, but does not terminate the application.
Description Method; closes the specified document. See also fl.closeAll() Example The following example illustrates two ways of closing a document. //closes the specified document and prompts to save changes fl.closeDocument(fl.documents[0]); fl.closeDocument(fl.documents[0] , true); //use of true is optional //closes the specified document without prompting to save changes fl.closeDocument(fl.documents[0], false);...
fl.configURI Availability Flash MX 2004. Usage fl.configURI Description Read-only property; a string that specifies the full path for the local user’s Configuration directory in a URI format ( ). See also file:/// fl.configDirectory Example The following example runs a specified script. Using lets you specify the location fl.configURI of the script without knowing which platform the script is running on.
//create a Form Application document fl.createDocument("application"); fl.createNewDocList Availability Flash MX 2004. Usage fl.createNewDocList Description Read-only property; an array of strings that represent the various types of documents that can be created. Example The following example displays the types of documents that can be created in the Output panel. fl.trace("Number of choices "...
Description Read-only property; an array of strings that represent the various types of templates that can be created. Example The following example displays the types of templates that can be created in the Output panel. fl.trace("Number of template types: " + fl.createNewTemplateList.length); for (i = 0;...
fl.effects Availability Flash MX 2004. Usage fl.effects Description Read-only property; an array of Effect objects, based on XML parameter file. These are not effects, but a description of effects. The array length corresponds to the number of effects (based on the XML parameter definition files, not the number of JSFL implementation files) registered when the program opens.
fl.fileExists() Availability Flash MX 2004. Usage fl.fileExists( fileURI ) Parameters A string that contains the path to the file. fileURI Returns A Boolean value: if the file exists on disk; otherwise. true false Description Method; checks whether a file already exists on disk. Example The following example outputs to the Output panel for each specified file,...
fl.getDocumentDOM() Availability Flash MX 2004. Usage fl.getDocumentDOM() Parameters None. Returns A Document object, or if no documents are open. null Description Method; retrieves the DOM (Document object) of the currently active document (FLA file). If one or more documents are open but a document is not currently focused (for example, a JSFL file is focused) , retrieves the DOM of the most recently active document.
Example The following example converts a URL to UTF-8 so the player can load it. var url = MMExecute( "fl.mapPlayerURL(" + myURL + ", false);" ); mc.loadMovie( url); fl.Math Availability Flash MX 2004. Usage fl.Math Description Read-only property; the Math object provides methods for matrix and point operations.
fl.mruRecentFileListType Availability Flash MX 2004. Usage fl.mruRecentFileListType Description Read-only property; an array of the file types in the MRU list that the authoring tool manages. This array corresponds to the array in the property. fl.mruRecentFileList Example The following example displays the number of recently opened files, and the type of each file, in the Output panel.
Example The following example opens a file named Document.fla that is stored in the root directory of the C drive, stores a Document object representing that document in the variable, and sets the document to be the currently selected document. That is, until focus is changed, refers to this document.
Description Method; opens a script (JSFL, AS, ASC) or other file (XML, TXT) in the Flash text editor. Example The following example opens a file named my_test.jsfl that is stored in the /temp directory of the C drive. fl.openScript("file:///c|/temp/my_test.jsfl"); fl.outputPanel Availability Flash MX 2004.
fl.quit(true); // true is optional //quit without saving any files fl.quit(false); fl.reloadEffects() Availability Flash MX 2004. Usage fl.reloadEffects() Parameters None. Returns Nothing. Description Method; 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 without relaunching the application.
Example The following example is a one-line script that you can place in the Commands folder. When you need to reload the toolbar, go to the Commands menu and execute the script. fl.reloadTools(); fl.revertDocument() Availability Flash MX 2004. Usage fl.revertDocument( documentObject ) Parameters Document object.
Returns is specified, returns the function's result as a string. Otherwise, nothing is returned. funcName Description Method; executes a JavaScript file. If a function is specified as one of the arguments, it runs the function and also any code in the script that is not within the function. The rest of the code in the script runs before the function is run.
Description Method; saves all open documents, displaying the Save As dialog box for any documents that were not previously saved. See also fl.saveDocumentAs() fl.saveDocument() , and document.save() document.saveAndCompact() Example The following example saves all open documents. fl.saveAll(); fl.saveDocument() Availability Flash MX 2004. Usage fl.saveDocument( document [, fileURI] ) Parameters...
Parameters Document object that specifies the document to save. If , the document document null active document is saved. Returns A Boolean value: if the Save As operation completes successfully; otherwise. true false Description Method; displays the Save As dialog box for the specified document. See also , and fl.saveDocument() fl.saveAll()
fl.tools Availability Flash MX 2004. Usage fl.tools Description Read-only property; an array of Tools objects (see Tools object). This property is used only when creating extensible tools. fl.trace() Availability Flash MX 2004. Usage fl.trace( message ) Parameters A string that appears in the Output panel. message Returns Nothing.
Example The following example displays the version of the authoring tool in the Output panel. alert( fl.version ); // e.g. WIN 7,0,0,380 fl.xmlui Availability Flash MX 2004. Usage fl.xmlui Description Read-only property; an XMLUI object. This property lets you get and set XMLUI properties in a XMLUI dialog box and lets you accept or cancel the dialog box programmatically.
CHAPTER 3 Objects folderItem object Inheritance Item object > folderItem object Availability Flash MX 2004. Description The folderItem object is a subclass of the Item object. There are no unique methods or properties of folderItem. folderItem object...
CHAPTER 3 Objects fontItem object Inheritance Item object > fontItem object Availability Flash MX 2004. Description The fontItem object is a subclass of the Item object. There are no unique methods or properties of fontItem. Chapter 3: Objects...
CHAPTER 3 Objects Frame object Availability Flash MX 2004. Description The Frame object represents frames in the layer. Property summary for the Frame object The following properties can be used with the Frame object: Property Description Property; a string representing ActionScript code. frame.actionScript Read-only;...
Property Description Property; a library item (see SoundItem object) used to create a frame.soundLibraryItem sound. Property; an integer value that specifies the number of times a frame.soundLoop sound that is attached directly to a frame ) plays. frame.soundLibraryItem Property; a string that specifies whether a sound that is frame.soundLoopMode attached directly to a frame ( ) should...
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 sequence that starts at first frame in the top layer in the variable: frameSpan var frameSpan = fl.getDocumentDOM().getTimeline().layers[0].frames[0].duration;...
Example The following example sets the name of the first frame in the top layer to "First Frame" then sets its 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 MX 2004. Usage frame.motionTweenOrientToPath Description Property; a Boolean value; specifies whether the tweened element rotates the element as it moves along a path to maintain its angle with respect to each point on the path ( ) or whether it does true...
frame.motionTweenRotateTimes Availability Flash MX 2004. Usage frame.motionTweenRotateTimes Description Property; an integer that specifies the number of times the tweened element rotates between the starting keyframe and the next keyframe. Example The following example rotates the element in this frame counter-clockwise three times by the time it reaches the next keyframe: fl.getDocumentDOM().getTimeline().layers[0].frames[0].motionTweenRotate = "counter-clockwise";...
frame.motionTweenSync Availability Flash MX 2004. Usage frame.motionTweenSync Description Property; a Boolean value; if set to , synchronizes the animation of the tweened object with true the main Timeline. Example The following example specifies that tweened object should be synchronized with the Timeline: fl.getDocumentDOM().getTimeline().layers[0].frames[0].motionTweenSync = true;...
frame.soundEffect Availability Flash MX 2004. Usage frame.soundEffect Description Property; a string that specifies effects for a sound that is attached directly to a frame ). Acceptable values are frame.soundLibraryItem "none" "left channel" "right , and channel" "fade left to right" "fade right to left"...
Description Property; an integer value that specifies the number of times a sound that is attached directly to a frame ( ) plays. If you want to specify a value for this property, set frame.soundLibraryItem frame.soundLoopMode "repeat" Example frame.soundLoopMode frame.soundLoopMode Availability Flash MX 2004.
frame.soundSync Availability Flash MX 2004. Usage frame.soundSync Description Property; a string that specifies the sync behavior of a sound that is attached directly to a frame ). Acceptable values are , and frame.soundLibraryItem "event" "stop" "start" "stream" Example The following example specifies that a sound should stream: fl.getDocumentDOM().getTimeline().layers[0].frames[0].soundSync = 'stream';...
Description Property; an integer that specifies the amount of easing that should be applied to the tweened object. Valid values are -100 to 100. To begin the motion tween slowly and accelerate the tween toward the end of the animation, use a value between -1 and -100. To begin the motion tween rapidly and decelerate the tween toward the end of the animation, use a positive value between 1 and 100.
CHAPTER 3 Objects HalfEdge object Availability Flash MX 2004. Description The halfEdge object is the directed side of the edge of a Shape object. An edge has two half edges. You can transverse the contours of a shape by “walking around” these half edges. For example, starting from a half edge, you can visit all the half edges around a contour of a shape, and return to the original half edge.
Description Method; gets the Edge object for the halfEdge object. Example The following example illustrates getting an edge and a half edge for the specified shape. var shape = fl.getDocumentDOM().selection[0]; var halfEdge = shape.edges[0].getHalfEdge(0); var edge = halfEdge.getEdge(); halfEdge.getNext() Availability Flash MX 2004.
Description Method; gets the halfEdge object on the other side of the edge. Example The following example stores the half edge opposite in the variable: hEdge otherHalfEdge var shape = fl.getDocumentDOM().selection[0]; var hEdge = shape.edges[0].getHalfEdge(0); var otherHalfEdge = hEdge.getOppositeHalfEdge(); halfEdge.getPrev() Availability Flash MX 2004.
Description Method; gets the Vertex object at the head of the halfEdge object. Example The following example stores the Vertex object at the head of in the variable: hEdge vertex var shape = fl.getDocumentDOM().selection[0]; var edge = shape.edges[0]; var hEdge = edge.getHalfEdge(0); var vertex = hEdge.getVertex();...
CHAPTER 3 Objects Instance object Inheritance Element object > Instance object Availability Flash MX 2004. Description Instance is a subclass of the Element object. Property summary for the Instance object In addition to all of the Element object properties, Instance has the following properties: Property Description Read-only;...
Page 200
Example The following example changes the selected symbol to refer to the first item in the library: fl.getDocumentDOM().selection[0].libraryItem = fl.getDocumentDOM().library.items[0]; Chapter 3: Objects...
CHAPTER 3 Objects Item object Availability Flash MX 2004. Description The Item object is an abstract base class. Anything in the library derives from Item. See also library object. Method summary for the Item object The following methods are available for the Item object. Method Description Method;...
item.addData() Availability Flash MX 2004. Usage item.addData( name, type, data ) Parameters A string that specifies the name of the data. name A string that specifies the type of data. Valid types are type "integer" "integerArray" , and "double" "doubleArray" "string"...
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].getData( "myData" ); item.hasData() Availability Flash MX 2004. Usage item.hasData( name ) Parameters A string that specifies the name of the data to check for in the library item.
item.linkageClassName Availability Flash MX 2004. Usage item.linkageClassName Description Property; a string that specifies the ActionScript 2.0 class that will be associated with the symbol. For this property to be defined, the and/or item.linkageExportForAS properties must be set to , and the item.linkageExportForRS true item.linkageImportForRS...
Description Property; a Boolean value. If the item is exported for runtime sharing. This property can be true set to only if is set to . Also, the properties true item.linkageImportForRS false must be defined. item.linkageIdentifier item.linkageURL Example The following example sets this property for the specified library item: fl.getDocumentDOM().library.items[0].linkageExportForRS = true;...
item.linkageImportForRS Availability Flash MX 2004. Usage item.linkageImportForRS Description Property; a Boolean value: if , the item is imported for runtime sharing. If this property is set true , both must be set to true item.linkageExportForAS item.linkageExportForRS . Also, you must specify an identif1ier ( ) and a URL false item.linkageIdentifier...
Description Method; a string that specifies the name of the library item, which includes the folder structure. For example, if Symbol_1 is inside a folder called Folder_1, the property of Symbol_1 is name "Folder_1/Symbol_1" Example The following example shows the name of the specified library item in the Output panel: fl.trace(fl.getDocumentDOM().library.items[0].name);...
CHAPTER 3 Objects Layer object Availability Flash MX 2004. Description The Layer object represents a layer in the Timeline. The property contains an timeline.layers array of Layer objects, which can be accessed by fl.getDocumentDOM().getTimeline().layers Property summary for the Layer object The following properties are available for the Layer object: Property Description...
Example The following example stores the value of the first layer in the variable: colorValue 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.getDocumentDOM().getTimeline().layers[0].color=16711680; fl.getDocumentDOM().getTimeline().layers[0].color="#ff0000"; fl.getDocumentDOM().getTimeline().layers[0].color=0xFF0000; layer.frameCount Availability Flash MX 2004.
layer.height Availability Flash MX 2004. Usage layer.height Description Property; an integer that specifies the percentage layer height; equivalent to the Layer height value in the Layer Properties dialog box. Acceptable values represent percentages of the default height: 100, 200, or 300. Example The following example stores the percentage value of the first layer’s height setting: var layerHeight = fl.getDocumentDOM().getTimeline().layers[0].height;...
Description Property; a Boolean value that specifies the locked status of the layer. If set to , the layer is true locked. The default value is false Example The following example stores the Boolean value for the status of the first layer in the lockStatus variable: var lockStatus = fl.getDocumentDOM().getTimeline().layers[0].locked;...
layer.parentLayer Availability Flash MX 2004. Usage layer.parentLayer Description Property; a Layer object that represents the layer’s containing folder, guiding, or masking layer. Acceptable values for the parent layer are a folder, guide, or mask layer that precedes the layer, or of the preceding or following layer.
CHAPTER 3 Objects library object Availability Flash MX 2004. Description The library object represents the Library panel. It is a property of the Document object (see ) and can be accessed by document.library fl.getDocumentDOM().library The library object contains an array of items of different types, including symbols, bitmaps, sounds, and video.
Method Description Method; selects or deselects all items in the library. library.selectAll() Method; selects a specified library item. library.selectItem() Method; deselects all the library items. library.selectNone() Method; sets the property for all selected library items (ignoring library.setItemProperty() folders). Method; updates the specified item. library.updateItem() Property summary for the library object The following property is available for the library object.
library.addNewItem() Availability Flash MX 2004. Usage library.addNewItem( type [, namePath] ) Parameters A string that specifies the type of item to create. The only acceptable values for type type , and (so, for example, you "video" "movie clip" "button" "graphic" "bitmap"...
Description Method; deletes the current items or a specified item from the Library panel. This method can affect multiple items if several are selected. Example The following example deletes the currently selected item: fl.getDocumentDOM().library.deleteItem(); The following example deletes the item Symbol_1 from the library folder Folder_1: fl.getDocumentDOM().library.deleteItem("Folder_1/Symbol_1");...
Parameters A string that specifies the name of the item. If the item is in a folder, you can specify namePath its name and path using slash notation. If is not specified, the single selected library namePath item opens in Edit mode. If none or more than one item in the library is currently selected, the first scene in the main Timeline appears for editing.
library.findItemIndex() Availability Flash MX 2004. Usage library.findItemIndex( namePath ) Parameters A string that specifies the name of the item. If the item is in a folder, you can specify namePath its name and path using slash notation. Returns An integer value representing the item’s zero-based index value. Description Method;...
library.getItemType() Availability Flash MX 2004. Usage library.getItemType( [ namePath ] ) Parameters A string that specifies the name of the item. If the item is in a folder, specify its name namePath and path using slash notation. If is not specified, Flash provides the type of the current namePath selection.
var selItems = fl.getDocumentDOM().library.getSelectedItems(); selItems[0].sampleRate = "11 kHz"; library.importEmbeddedSWF() Availability Flash MX 2004. Usage library.importEmbeddedSWF( linkageName, swfData [, libName] ) Parameters A string that provides the name of the SWF linkage of the root movie clip. linkageName An array of binary SWF data, which comes from an external library or DLL. swfData A string that specifies the library name for the created item.
Description Method; checks to see if a specified item exists in the library. Example The following example displays in a dialog box, depending on whether the item true false Symbol_1 exists in the Folder_1 library folder: alert(fl.getDocumentDOM().library.itemExists('Folder_1/Symbol_1')); library.items Availability Flash MX 2004. Usage library.items Description...
Description Method; moves the currently selected or specified library item to a specified folder. If the parameter is empty, the items move to the top level. folderPath Example The following example moves the item Symbol_1 to the library folder new and replaces the item in that folder with the same name: fl.getDocumentDOM().library.moveToFolder("new", "Symbol_1", true);...
Returns A Boolean value: if the name of the item changes successfully. If multiple items are selected, true no names are changed, and the return value is (to match UI behavior). false Description Method; renames the currently selected library item in the Library panel. Example The following example renames the currently selected library item to new name...
Parameters A string that specifies the name of the item. If the item is in a folder, you can specify namePath its name and path using slash notation. A Boolean value that specifies whether to replace the current bReplaceCurrentSelection selection or add the item to the current selection. The default value is (replace current true selection).
Example The following examples deselect all the items in the library: fl.getDocumentDOM().library.selectNone(); fl.getDocumentDOM().library.selectAll(false); library.setItemProperty() Availability Flash MX 2004. Usage library.setItemProperty( property, value ) Parameters A string that is the name of the property to set. For a list of properties, see the property Property summary for the Item object and property summaries for its subclasses.
Page 226
Returns A Boolean value: if Flash updated the item successfully; otherwise. true false Description Method; updates the specified item. Example The following example displays a dialog box that shows whether the currently selected item is updated ( ) or not ( true false alert(fl.getDocumentDOM().library.updateItem());...
CHAPTER 3 Objects LinkedVideoInstance object Inheritance Element object > Instance object > LinkedVideoInstance object Availability Flash MX 2004. Description The LinkedVideoInstance object is a subclass of the Instance object. There are no unique methods or properties of LinkedVideoInstance. LinkedVideoInstance object...
CHAPTER 3 Objects Math object Availability Flash MX 2004. Description The Math object is available as a read-only property of the flash object; see . This object fl.Math provides methods that perform common mathematical operations. Method summary for the Math object The following methods are available for the Math object: Method Description...
Math.invertMatrix() Availability Flash MX 2004. Usage Math.invertMatrix(mat) Parameters Indicates the Matrix object to invert. It must have the following fields: Returns A Matrix object that is the inverse of the original matrix. Description Method; returns the inverse of the specified matrix. Example The following example stores the currently selected object in the variable, assigns that matrix...
CHAPTER 3 Objects Matrix object Availability Flash MX 2004. Description The Matrix object represents a transformation matrix. Property summary for the Matrix object The following properties are available for the Matrix object: Property Description Property; a floating-point value that specifies the (0,0) element in the matrix.a transformation matrix.
You can rotate an object by setting the , and matrix properties relative to one another, . For example, values of 0.5, 0.8, -0.8, and 0.5 rotate the object 60 º : where a = d b = -c var mat = fl.getDocumentDOM().selection[0].matrix; mat.a = 0.5;...
Example See the example. matrix.b matrix.d Availability Flash MX 2004. Usage matrix.d Description Property; a floating-point value that specifies the (1,1) element in the matrix. This value represents the scale factor of the object’s y-axis. Example matrix.a matrix.tx Availability Flash MX 2004. Usage matrix.tx Description...
Page 233
Description Property; a floating-point value that specifies the y-axis location of a symbol’s registration point or the center of a shape. It defines the y translation of the transformation. You can move an object by setting the properties. matrix.tx matrix.ty Example See the example.
CHAPTER 3 Objects outputPanel object Availability Flash MX 2004. Description This object represents the Output panel, which displays troubleshooting information such as syntax errors. To access this object, use fl.outputPanel flash.outputPanel Method summary for the outputPanel object The outputPanel object uses the following methods. Method Description Method;...
outputPanel.save() Availability Flash MX 2004. Usage outputPanel.save(fileURI [, bAppendToFile]) Parameters A string that specifies the local file to contain the Output panel’s contents. fileURI optional parameter, if it has a value of , appends the Output panel’s bAppendToFile true contents to the output file. If , the method overwrites the output file if it bAppendToFile false...
Page 236
Description Method; adds a line to the contents of the Output panel, terminated by a new line. This method shows the Output panel if it is not already visible. method duplicates the functionality of outputPanel.trace() fl.trace() Example The following example writes to the Output panel: "hello world"...
CHAPTER 3 Objects Parameter object Availability Flash MX 2004. Description The Parameter object type is accessed from the array (which corresponds to screen.parameters the screen Property inspector in the Flash authoring tool) or by the array (which corresponds to the component Property componentInstance.parameters inspector in the authoring tool).
Description Property; a string that specifies the property for the parameter or category screen parameter. This property provides an alternative way of presenting a list of componentInstance parameters. This functionality is not available through the Flash user interface. parameter.insertItem() Availability Flash MX 2004.
Description Property; the value of the selected list item. This property is valid only if the valueType parameter is "List" Example The following example sets the first parameter for a Slide, which is the parameter. To autoKeyNav set the parameter to one of its acceptable values ( , or true false...
Description Method; removes an element of the list, object, or array type of a screen or component parameter. Example The following example removes the element at index 1 from the parameter of a labelPlacement component: // select an instance of a Button component on the Stage var parms = fl.getDocumentDOM().selection[0].parameters;...
Description Property; corresponds to the Value field in the Parameters tab of the Component Inspector panel, in the component Property inspector, or in the screen Property inspector. The type of the value property is determined by the property for the parameter (see valueType parameter.valueType parameter.valueType...
CHAPTER 3 Objects Path object Availability Flash MX 2004. Description The Path object defines a sequence of line segments (straight, curved, or both), which you typically use when creating extensible tools. The following example shows an instance of a Path object being returned from the flash object: path = fl.drawingLayer.newPath();...
A floating-point number that specifies the y position of the first control point. yAnchor A floating-point number that specifies the x position of the second control point. A floating-point number that specifies the y position of the second control point. A floating-point number that specifies the x position of the third control point.
Example The following example creates a new path, stores it in the variable, and assigns the curve myPath to the path: var myPath = fl.drawingLayer.newPath(); myPath.addCurve(0, 0, 10, 20, 20, 0); path.addPoint() Availability Flash MX 2004. Usage path.addPoint(x, y) Parameters A floating-point value that specifies the x position of the point.
Example The following example removes all points from a path stored in the variable: myPath var myPath = fl.drawingLayer.newPath(); myPath.clear(); path.close() Availability Flash MX 2004. Usage path.close() Parameters None. Returns Nothing. Description Method; appends a point at the location of the first point of the path and extends the path to that point, which closes the path.
Description Method; creates a shape on the Stage by using the current stroke and fill settings. The path is cleared after the shape is created. This method has two optional parameters for suppressing the fill and stroke of the resulting shape object. If you omit these parameters or set them to , the false current values for fill and stroke are used.
path.nPts Availability Flash MX 2004. Usage path.nPts Description Read-only property; an integer representing the number of points in the path. A new path has 0 points. Example The following example uses the Output panel to show the number of points in the path referenced by the variable: myPath...
CHAPTER 3 Objects Screen object Availability Flash MX 2004. Description The Screen object represents a single screen in a slide or form document. This object contains properties related to the slide or form. For access to the array of all Screen objects in the document, use the following code: fl.getDocumentDOM().screenOutline.screens Property summary for the Screen object...
screen.accName Availability Flash MX 2004. Usage screen.accName Description Property; a string that is equivalent to the Name field in the Accessibility panel. Screen readers identify objects by reading the name aloud. Example The following example stores the value of the name of the object in the variable: theName var theName = fl.getDocumentDOM().screenOutline.screens[1].accName;...
screen.description Availability Flash MX 2004. Usage screen.description Description Property; a string that is equivalent to the Description field in the Accessibility panel. The description is read by the screen reader. Example The following example gets the description of the object and stores it in the theDescription variable: var theDescription = fl.getDocumentDOM().screenOutline.screens[1].description;...
screen.hidden Availability Flash MX 2004. Usage screen.hidden Description Property; a Boolean value that specifies whether the screen is visible. A screen with the hidden property set to is not visible in any other screen. true Example The following example checks to see if the first screen in the outline is hidden and changes the visibility of the screen accordingly.
screen.name Availability Flash MX 2004. Usage screen.name Description Read-only property; a string that represents the name of the screen. Example The following example checks to see if the current document allows screens (because it is a slide or form document). Then, it assigns the value of the first child screen in the array to the name variable and opens the Output panel to show the name of the screen:...
screen.parameters Availability Flash MX 2004. Usage screen.parameters Description Read-only property; an array of ActionScript properties that are accessible from the screen Property inspector. Example The following example stores the parameters for the second screen in the outline to the parms variable and then assigns the value to the first property: "some value"...
screen.prevScreen Availability Flash MX 2004. Usage screen.prevScreen Description Read-only property; an object that represents the previous peer screen in the parent’s array. If there isn’t a peer screen, the value is . See also childScreens null screen.nextScreen Example The following example checks to see if the current document is a slide or form, and if it is, retrieves and shows the sequence of screens in the Output panel: if(fl.getDocumentDOM().allowScreens) { var myCurrent =...
screen.tabIndex Availability Flash MX 2004. Usage screen.tabIndex Description Property; equivalent to the Tab Index field in the Accessibility panel. This value lets you determine the order in which objects are accessed when the user presses the Tab key. Example The following example gets the tab index of the object: var theTabIndex = fl.getDocumentDOM().screenOutline.screens[1].tabIndex;...
CHAPTER 3 Objects ScreenOutline object Availability Flash MX 2004. Description The ScreenOutline object represents the group of screens in a slide or form document. The object is accessed by using fl.getDocumentDOM().screenOutline. The ScreenOutline object exists only if the document is a slide or form document, so before accessing the property, use to verify that a Screens document exists, document.allowScreens()
Method Description Method; lets the specified property with the specified screenOutline.setScreenProperty() value for the selected screens. Method; selects the specified screens in the Screen screenOutline.setSelectedScreens() Outline pane. Property summary for the ScreenOutline object You can use the following properties with the ScreenOutline object: Property Description Property;...
screenOutline.currentScreen Availability Flash MX 2004. Usage screenOutline.currentScreen Description Property; a Screen object, the currently selected screen. Example The following example stores the object in the variable and then currentScreen myScreen displays the name of that screen in the Output panel: var myScreen = fl.getDocumentDOM().screenOutline.currentScreen;...
screenOutline.duplicateScreen() Availability Flash MX 2004. Usage screenOutline.duplicateScreen( [screenName] ) Parameters A string value that specifies the screen name to duplicate. If you don’t pass a value screenName , the currently selected screen(s) are duplicated. This parameter is optional. screenName Returns A Boolean value: if the screen is successfully duplicated;...
fl.trace(myArray[i].name) screenOutline.insertNestedScreen() Availability Flash MX 2004. Usage screenOutline.insertNestedScreen( [ name [, referenceScreen [, screenTypeName ] ] ]) Parameters A string indicating the name of the new screen to insert. An empty name will insert a name screen with a default screen name, such as Slide or Form (where is the first available unique...
A string indicating the name of the screen before the new screen. If this referenceScreen parameter is omitted, the new screen is inserted after the currently selected screen. If the parameter identifies a child screen, the new screen will be a peer of the child referenceScreen screen, and a child screen of the same parent.
Example The following example 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.renameScreen( newScreenName [, oldScreenName [, bDisplayError] ] Parameters A string that specifies the new name of the screen newScreenName A string that specifies the name of the existing screen to change.
Example The following example displays the name of the first child of the first screen in the screen outline: fl.trace(fl.getDocumentDOM().screenOutline.rootScreen.childScreens[0].name); screenOutline.screens Availability Flash MX 2004. Usage screenOutline.screens Description Read-only property; the array of top level Screen objects contained in the document (see Screen object).
Example The following example sets the current screen to the screen named ChildOfSlide_1: fl.getDocumentDOM().screenOutline.setCurrentScreen("ChildOfSlide_1"); screenOutline.setScreenProperty() Availability Flash MX 2004. Usage screenOutline.setScreenProperty( property, value ) Parameters A string that specifies the property to set. property The new value for the property. The type of value depends on the property being set. value For a list of available properties and values, see Property summary for the Screen...
Page 265
Description Method; selects the specified screens in the screen outline. If multiple screens are specified, the screen with the last index value of the selection array is focused on the Stage. Example The following example deselects any currently selected screens, and then selects screens slide1 , and slide4 in the screen outline: slide2...
CHAPTER 3 Objects Shape object Inheritance Element object > Shape object Availability Flash MX 2004. Description The Shape object is a subclass of the Element object. The Shape object provides more precise control than the Drawing APIs when manipulating or creating geometry on the Stage. This control is necessary so that scripts can create useful effects and other drawing commands.
Returns Nothing. Description Method; defines the start of an edit session. You must use this method before issuing any commands that change the Shape object or any of its subordinate parts. Example The following example takes the currently selected shape and removes the first edge in the edge array from it: var shape = fl.getDocumentDOM().selection[0];...
Description Method; deletes the specified edge. You must call before using this method. shape.beginEdit() Example The following example takes the currently selected shape and removes the first edge in the edge array: var shape = fl.getDocumentDOM().selection[0]; shape.beginEdit(); shape.deleteEdge(0); shape.endEdit(); shape.edges Availability Flash MX 2004.
shape.isGroup Availability Flash MX 2004. Usage shape.isGroup Description Read-only property; if , the shape is a group. true Example The following example stores the first selected object in the variable and then uses the item properties to test if the selected item is a group: element.elementType shape.isGroup var sel = fl.getDocumentDOM().selection[0];...
CHAPTER 3 Objects SoundItem object Inheritance Item object > SoundItem object Availability Flash MX 2004. Description The SoundItem object is a subclass of the Item object. It represents a library item used to create a sound. See also frame.soundLibraryItem Property summary for the SoundItem object In addition to the Item object properties, the following properties are available for the...
Description Property; a string that specifies the bit rate of a sound in the library. This property is available only for the MP3 compression type. Acceptable values are "8kbps" "16kbps" "20kbps" , and "24kbps" "32kbps" "48kbps" "56kbps" "64kbps" "80kbps" "112kbps" "128kbps"...
The following example changes a selected item’s compression type to Speech: fl.getDocumentDOM().library.getSelectedItems()[0].compressionType = "Speech"; soundItem.convertStereoToMono Availability Flash MX 2004. Usage soundItem.convertStereoToMono Description Property; a Boolean value available only for MP3 and Raw compression types. Setting this to converts a stereo sound to mono; leaves it as stereo.
Description Property; available only for ADPCM, Raw, and Speech compression types. This value sets the sample rate for the audio clip. Acceptable values are , and "5 kHz" "11 kHz" "22 kHz" "44 kHz" Note: When an MP3 is imported to the library, the Use imported MP3 quality Export setting is checked by default.
CHAPTER 3 Objects Stroke object Availability Flash MX 2004. Description The Stroke object contains all the settings for a stroke, including the custom settings. This object represents the information contained in the Stroke Properties inspector. Using the Stroke object together with the method, you can change the stroke settings for document.setCustomStroke() the toolbar, the Properties Inspector, and the current selection.
Property Description A string that specifies the wave height of a ragged line. stroke.waveHeight A string that specifies the wave length of a ragged line. stroke.waveLength stroke.breakAtCorners Availability Flash MX 2004. Usage stroke.breakAtCorners Description Property; a Boolean value. This property is the same as the Sharp Corners setting in the custom Stroke Style dialog box.
Description Property; a string that specifies type of hatching for the stroke. This property can be set only if property is . Acceptable values are stroke.style "hatched" "straight" "slight curve" , and "medium curve" "very curved" Example The following example sets the curve property, as well as others, for a stroke having the style: "hatched"...
Description Property; an integer that specifies the lengths of the blank parts of a dashed line. This property is available only if the property is set to stroke.style "dashed" Example stroke.dash1 stroke.density Availability Flash MX 2004. Usage stroke.density Description Property; a string that specifies the density of a stippled line. This property is available only if the property is set to .
myStroke.density = "sparse"; fl.getDocumentDOM().setCustomStroke( myStroke ); stroke.dotSpace Availability Flash MX 2004. Usage stroke.dotSpace Description Property; an integer that specifies the spacing between dots in a dotted line. This property is available only if the property is set to stroke.style "dotted" Example The following example sets the property to...
stroke.jiggle Availability Flash MX 2004. Usage stroke.jiggle Description Property; a string that specifies the jiggle property of a hatched line. This property is available only if the property is set to . Acceptable values are stroke.style "hatched" "none" "bounce" , and "loose"...
stroke.pattern Availability Flash MX 2004. Usage stroke.pattern Description Property; a string that specifies the pattern of a ragged line. This property is available only if the property is set to . Acceptable values are stroke.style "ragged" "solid" "simple" "random" , and "dotted"...
stroke.space Availability Flash MX 2004. Usage stroke.space Description Property; a string that specifies the spacing of a hatched line. This property is available only if the property is set to . Acceptable values are stroke.style "hatched" "very close" "close" , and "distant"...
Example The following example sets the stroke style to "ragged" var myStroke = fl.getDocumentDOM().getCustomStroke(); myStroke.style = "ragged"; fl.getDocumentDOM().setCustomStroke( myStroke ); stroke.thickness Availability Flash MX 2004. Usage stroke.thickness Description Property; an integer that specifies the stroke size. Example The following example sets the property of the stroke to a value of thickness var myStroke = fl.getDocumentDOM().getCustomStroke();...
stroke.waveHeight Availability Flash MX 2004. Usage stroke.waveHeight Description Property; a string that specifies the wave height of a ragged line. This property is available only if property is set to . Acceptable values are stroke.style "ragged" "flat" "wavy" "very , and wavy"...
CHAPTER 3 Objects SymbolInstance object Inheritance Element object > Instance object > SymbolInstance object Availability Flash MX 2004. Description SymbolInstance is a subclass of the Instance object and represents a symbol in a frame. Property summary for the SymbolInstance object In addition to the Instance object properties, the SymbolInstance object has the following...
Property Description A string that specifies the color mode as identified in the symbolInstance.colorMode symbol Property inspector Color pop-up menu. An integer that is part of the color transformation for the symbolInstance.colorRedAmount instance, equivalent to using the Color > Advanced setting in the Instance Property inspector.
Example The following example stores the value for the Accessibility panel name of the object in the variable: theName var theName = fl.getDocumentDOM().selection[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.colorAlphaAmount Availability Flash MX 2004. Usage symbolInstance.colorAlphaAmount Description Property; an integer that is part of the color transformation for the instance, specifying the Advanced Effect Alpha settings. This property is equivalent to using the Color > Advanced setting in the Property inspector and adjusting the controls on the right of the dialog box. This value either reduces or increases the tint and alpha values by a constant amount.
Description Property; an integer that is part of the color transformation for the instance. This property is equivalent to using the Color > Advanced setting in the Instance Property inspector. Allowable values are from -255 to 255. symbolInstance.colorBluePercent Availability Flash MX 2004. Usage symbolInstance.colorBluePercent Description...
Description Property; part of the color transformation for the instance. This property is equivalent 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 values are from -100 to 100.
symbolInstance.colorRedPercent Availability Flash MX 2004. Usage symbolInstance.colorRedPercent Description Property; part of the color transformation for the instance. This property is equivalent 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 red values to a specified percentage. Allowable values are from -100 to 100.
Description Property; a zero-based integer that specifies the first frame to appear in the Timeline of the graphic. This property applies only to graphic symbols and sets the same property as the First field in the Property inspector. For other types of symbols, this property is undefined Example The following example specifies that Frame 11 should be the first frame to appear in the Timeline...
Description Property; a string that, for graphic symbols, sets the same property as the Loop pop-up menu in the Property inspector. For other types of symbols, this property is . Acceptable values undefined , and to set the graphic’s animation accordingly. "loop"...
This property is not available for graphic objects. Example The following example checks to see if the object is accessible; a return value of means the false 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;...
CHAPTER 3 Objects SymbolItem object Inheritance Item object > SymbolItem object Availability Flash MX 2004. Description The SymbolItem object is a subclass of the Item object. Method summary for the SymbolItem object In addition to the Item object methods, you can use the following methods with the SymbolItem object: Method Description...
Parameters None. Returns Nothing. Description Method; converts a symbol item in the library to a compiled movie clip. Example The following example converts an item in the library to a compiled movie clip: fl.getDocumentDOM().library.items[3].convertToCompiledClip(); symbolItem.exportSWC() Availability Flash MX 2004. Usage symbolItem.exportSWC( outputURI ) Parameters parameter is a string that specifies the URI for the SWC file to which the method...
Parameters parameter is a string that specifies the URI for the SWF file to which the method outputURI will export the symbol. This URI must reference a local file. Flash will not create a folder if the specified path doesn’t exist. Returns Nothing.
symbolItem.sourceLibraryName Availability Flash MX 2004. Usage symbolItem.sourceLibraryName Description Property; a string that specifies the name of the item in the source file library. Used for Shared Library symbols. Example The following example shows the value of the property in the Output sourceLibraryName panel: fl.trace(fl.getDocumentDOM().library.items[0].sourceLibraryName);...
Page 298
Example The following example obtains and shows the number of layers that the selected movie clip in the library contains: var tl = fl.getDocumentDOM().library.getSelectedItems()[0].timeline; alert(tl.layerCount); Chapter 3: Objects...
CHAPTER 3 Objects TextAttrs object Availability Flash MX 2004. Description The TextAttrs object contains all the properties of text that can be applied to a subselection. This object is a property of the TextRun object ( textRun.textAttrs Property summary for the TextAttrs object The following properties are available for the TextAttrs object.
textAttrs.aliasText Availability Flash MX 2004. Usage textAttrs.aliasText Description Property; a Boolean value that specifies that Flash should draw the text using a method optimized for increasing the legibility of small text. Example The following example sets the property to for all the text in the currently aliasText true selected text field:...
This property applies only to static text; it generates a warning if used with other text types. Example The following example selects the characters from index 2 up to, but not including, index 6 and sets the property to autoKern true fl.getDocumentDOM().setTextSelection(3, 6);...
textAttrs.characterSpacing Availability Flash MX 2004. Usage textAttrs.characterSpacing Description Property; an integer that represents the space between characters. Acceptable values are -60 through 60. This property applies only to static text; it generates a warning if used with other text types. Example The following example sets the character spacing of the selected text field to 10: fl.getDocumentDOM().setElementTextAttr("characterSpacing", 10);...
Example The following example sets the color of the selected text field from the character at index 2 up to, but not including, the character at index 8 to red: fl.getDocumentDOM().selection[0].setTextAttr("fillColor", 0xff0000, 2, 8); textAttrs.indent Availability Flash MX 2004. Usage textAttrs.indent Description Property;...
Description Property; an integer that specifies the paragraph’s left margin. Acceptable values are 0 through 720. Example The following example sets the property of the selected text field from the character leftMargin at index 2 up to, but not including, the character at index 8 to 100. This can affect characters outside the specified range if they are in the same paragraph.
textAttrs.rotation Availability Flash MX 2004. Usage textAttrs.rotation Description Property; a Boolean value. A value of causes Flash to rotate the characters of the text 90º. true The default value is . This property applies only to static text with a vertical orientation; it false generates a warning if used with other text types.
Usage textAttrs.url Description Property; a string that represents the property of the text field. This property works only with static text. Example The following example sets the URL of the selected text field to http://www.macromedia.com: fl.getDocumentDOM().setElementTextAttr("url", "http://www.macromedia.com"); Chapter 3: Objects...
CHAPTER 3 Objects Text object Inheritance Element object > Text object Availability Flash MX 2004. Description The Text object represents a single text item in a document. All properties of the text pertain to the entire text block. To set properties of a text run within the text field, see “Property summary for the TextRun object”...
Property Description Property; a string that specifies characters to embed. This is equivalent text.embeddedCharacters to entering text in the Character Options dialog box. Property; a string that consists of delimited integers that correspond to text.embedRanges the items that can be selected in the Character Options dialog box. Read-only;...
Description Property; a string that is equivalent to the Name field in the Accessibility panel. Screen readers identify objects by reading the name aloud. This property cannot be used with dynamic text. Example The following example retrieves the name of the object: var theName = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].accName;...
text.description Availability Flash MX 2004. Usage text.description Description Property; a string that is equivalent to the Description field in the Accessibility panel. The description is read by the screen reader. Example The following example retrieves the description of the object: var theDescription = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0].descripti The following example sets the description of the object:...
Description Property; a string that consists of delimited integers that correspond to the items that can be selected in the Character Options dialog box. This property works only with dynamic or input text; it is ignored if used with static text. Note: This property corresponds to the XML file in the Configuration/Font Embedding folder.
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 example gets the size of the third character: var Char2 = fl.getDocumentDOM().selection[0].getTextAttr("size", 2); fl.trace(Char2); The following example gets the color of the selected text field from the third through the eighth character: fl.getDocumentDOM().selection[0].getTextAttr("fillColor", 2, 8);...
text.length Availability Flash MX 2004. Usage text.length Description Read-only property; an integer that represents the number of characters in the text object. Example The following example returns the number of characters in the selected text: var textLength = fl.getDocumentDOM().selection[0].length; text.lineType Availability Flash MX 2004.
Example The following example sets the value of the property to maxCharacters fl.getDocumentDOM().selection[0].maxCharacters = 30; text.orientation Availability Flash MX 2004. Usage text.orientation Description Property; a string that specifies the orientation of the text field. Acceptable values are , and "horizontal" "vertical left to right"...
text.scrollable Availability Flash MX 2004. Usage text.scrollable Description Property; a Boolean value. If the value is , the text can be scrolled. true This property works only with dynamic or input text; it generates a warning if used with static text.
text.selectionStart Availability Flash MX 2004. Usage text.selectionStart Description Property; a zero-based integer that specifies the beginning of a text subselection. You can use this property with to select a range of characters. Characters up to, but not text.selectionEnd including, are selected. text.selectionEnd •...
An integer that is a range of text, which starts at and goes up to, but not endIndex startIndex including, . This parameter is optional. endIndex Returns Nothing. Description Method; sets the attribute specified by the parameter associated with the text identified attrName to the value specified by .
Description Property; changes the text string within this text object. If you omit the optional parameters, the whole text object is replaced. If you specify only , the specified string is inserted at the startIndex position. If you specify both , the specified string replaces startIndex startIndex...
text.silent Availability Flash MX 2004. Usage text.silent Description Property; a Boolean value that specifies whether the object is accessible. This is equivalent to the inverse logic of the Make Object Accessible setting in the Accessibility panel. That is, if silent , Make Object Accessible is deselected.
text.textRuns Availability Flash MX 2004. Usage text.textRuns Description Read-only property; an array of TextRun objects (see TextRun object). Example The following example stores the value of the property in the variable: textRuns myTextRuns var myTextRuns = fl.getDocumentDOM().selection[0].textRuns; text.textType Availability Flash MX 2004. Usage text.textType Description...
text.variableName Availability Flash MX 2004. Usage text.variableName Description Property; a string that contains the name of the variable associated with the text object. This property works only with dynamic or input text; it generates a warning if used with other text types.
CHAPTER 3 Objects TextRun object Availability Flash MX 2004. Description The TextRun object represents a run of characters that have attributes that match all of the properties in the TextAttrs object. This object is a property of the Text object ( text.textRuns Property summary for the TextRun object In addition to the properties available for use with the...
Page 323
Example The following example displays the properties of the first run of characters in the selected text field in the Output panel. var curTextAttrs = fl.getDocumentDOM().selection[0].textRuns[0].textAttrs; for (var prop in curTextAttrs) { fl.trace(prop + " = " + curTextAttrs[prop]); TextRun object...
CHAPTER 3 Objects Timeline object Availability Flash MX 2004. Description The Timeline object represents the Flash Timeline, which can be accessed for the current document by . This method returns the Timeline of the fl.getDocumentDOM().getTimeline() current scene or symbol that is being edited. When you work with scenes, each scene’s Timeline has an index value, and can be accessed for the current document by .
Page 325
Method Description Retrieves the specified property’s value for the selected timeline.getFrameProperty() frames. Retrieves the specified property’s value for the selected timeline.getLayerProperty() layers. Retrieves the currently selected frames in an array. timeline.getSelectedFrames() Retrieves the zero-based index values of the currently timeline.getSelectedLayers() selected layers.
Property Description Read-only; an integer that represents the number of frames timeline.frameCount in this Timeline’s longest layer. Read-only; an integer that represents the number of layers in timeline.layerCount the specified Timeline. Read-only; an array of layer objects. timeline.layers A string that represents the name of the current Timeline. timeline.name timeline.addMotionGuide() Availability...
Parameters A string that specifies the name for the new layer. If you omit this parameter, a new name default layer name is assigned to the new layer (“Layer n,” where n is the total number of layers). This parameter is optional. A string that specifies the type of layer to add.
Example The following example clears the frames from Frame 6 up to, but not including, Frame 11 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().clearFrames(5, 10); The following example clears Frame 15: fl.getDocumentDOM().getTimeline().clearFrames(14); timeline.clearKeyframes() Availability Flash MX 2004. Usage timeline.clearKeyframes([startFrameIndex [, endFrameIndex]]) Parameters...
Parameters A zero-based index that specifies the starting frame to convert to keyframes. startFrameIndex If you omit , the method converts the currently selected frames. This startFrameIndex parameter is optional. A zero-based index that specifies the frame at which the conversion to endFrameIndex keyframes will stop.
Example The following example converts the selected frames to keyframes: fl.getDocumentDOM().getTimeline().convertToKeyframes(); The following example converts to keyframes the frames from Frame 2 up to, but not including, Frame 10 (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().convertToKeyframes(1, 9); The following example converts Frame 5 to a keyframe: fl.getDocumentDOM().getTimeline().convertToKeyframes(4);...
timeline.createMotionTween() Availability Flash MX 2004. Usage timeline.createMotionTween([startFrameIndex [, endFrameIndex]]) Parameters A zero-based index that specifies the beginning frame at which to create a startFrameIndex motion tween. If you omit , the method uses the current selection. This startFrameIndex parameter is optional. A zero-based index that specifies the frame at which to stop the motion tween.
The following example stores the value of the current playhead location in the variable: curFrame var curFrame = fl.getDocumentDOM().getTimeline().currentFrame; timeline.currentLayer Availability Flash MX 2004. Usage timeline.currentLayer Description Property; the zero-based index for the currently active layer. A value of 0 specifies the top layer, a value of 1 specifies the layer below it, and so on.
Example The following example cuts the selected frames from the Timeline and saves them to the Clipboard: fl.getDocumentDOM().getTimeline().cutFrames(); The following example cuts Frame 2 up to, but not including, Frame 10 from the Timeline and saves them to the Clipboard (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().cutFrames(1, 9);...
Parameters A Boolean value that, if set to , causes the method to expand the folder; bExpand true false causes the method to collapse the folder. A Boolean value that, if set to , causes all the layers within the bRecurseNestedParents true specified folder to be opened or closed, based on the...
Returns An array of index values for the specified layer. If the specified layer is not found, Flash returns undefined Description Method; finds an array of indexes for the layers with the given name. The layer index is flat, so folders are considered part of the main index.
A zero-based index that specifies the starting frame number for which to get startFrameIndex the value. If you omit , the method uses the current selection. This parameter startFrameIndex is optional. A zero-based index that specifies the end of the range of frames to select. The endFrameIndex range goes up to, but does not include, .
timeline.getSelectedFrames() Availability Flash MX 2004. Parameters None. Returns An array containing 3n integers, where n is the number of selected regions. The first integer in each group is the layer index, the second integer is the start frame of the beginning of the selection, and the third integer specifies the ending frame of that selection range.
timeline.insertBlankKeyframe() Availability Flash MX 2004. Usage timeline.insertBlankKeyframe([frameNumIndex]) Parameters A zero-based index that specifies the frame at which to insert the keyframe. If frameNumIndex you omit , the method uses the current playhead frame number. This parameter frameNumIndex is optional. If the specified or selected frame is a regular frame, the keyframe is inserted at the frame. For example, if you have a span of 10 frames numbered 1-10 and you select Frame 5, this method makes Frame 5 a blank keyframe, and the length of the frame span is still 10 frames.
Page 339
A Boolean value that, if set to (the default), causes the method to insert the bAllLayers true specified number of frames in the parameter into all layers; if set to , the numFrames false method inserts frames into the current layer. This parameter is optional. A zero-based index that specifies the frame at which to insert a new frame.
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 layers, starting from the first frame: fl.getDocumentDOM().getTimeline().insertFrames(4, true, 0); timeline.insertKeyframe() Availability Flash MX 2004. Usage timeline.insertKeyframe([frameNumIndex]) Parameters A zero-based index that specifies the frame index at which to insert the frameNumIndex keyframe in the current layer.
Example The following example uses the variable to store the number of layers in the current NumLayer scene: var NumLayer = fl.getDocumentDOM().getTimeline().layerCount; timeline.layers Availability Flash MX 2004. Usage timeline.layers Description Read-only property; an array of layer objects. Example The following example uses the variable to store the array of layer objects in the currentLayers current document:...
Parameters A zero-based index that specifies the beginning of a range of frames to paste. startFrameIndex If you omit , the method uses the current selection. This parameter is optional. startFrameIndex A zero-based index that specifies the frame at which to stop pasting frames. endFrameIndex The method pastes up to, but not including, .
Description Method; deletes the frame. Example The following example deletes Frame 5 up to, but not including, Frame 10 of the top layer in the current scene (remember that index values are different from frame number values): fl.getDocumentDOM().getTimeline().currentLayer = 0; fl.getDocumentDOM().getTimeline().removeFrames(4, 9);...
timeline.reverseFrames() Availability Flash MX 2004. Usage timeline.reverseFrames([startFrameIndex [, endFrameIndex]]) Parameters A zero-based index that specifies the first frame at which to start reversing startFrameIndex frames. If you omit , the method uses the current selection. This parameter is startFrameIndex optional. A zero-based index that specifies the first frame at which to stop reversing endFrameIndex frames;...
Example The following example selects all the frames in the current Timeline. fl.getDocumentDOM().getTimeline().selectAllFrames(); timeline.setFrameProperty() Availability Flash MX 2004. Usage timeline.setFrameProperty(property, value [, startFrameIndex [, endFrameIndex]]) Parameters A string that specifies the name of the property to be modified. For a complete list of property properties and values, see “Property summary for the Frame object”...
timeline.setLayerProperty() Availability Flash MX 2004. Usage timeline.setLayerProperty(property, value [, layersToChange]) Parameters A string that specifies the property to set. For a list of properties, see “Layer object” property on page 208. The value to which you want to set the property. Use the same type of value you would value use when setting the property on the Layer object.
A Boolean value that, if it is set to , causes the currently bReplaceCurrentSelection true selected frames to be deselected before the specified frames are selected. The default value is true An array of three integers, as returned by selectionList timeline.getSelectedFrames() Returns Nothing.
Description Method; sets the layer to be selected, and also makes the specified layer the current layer. Selecting a layer also means that all the frames in the layer are selected. Example The following example selects the top layer: fl.getDocumentDOM().getTimeline().setSelectedLayers(0); The following example adds the next layer to the selection: fl.getDocumentDOM().getTimeline().setSelectedLayers(1, false);...
CHAPTER 3 Objects ToolObj object Availability Flash MX 2004. Description A ToolObj object represents an individual tool in the Tools panel. To access a ToolObj object, use properties of the Tools object: either the array or tools.toolObjs tools.activeTool Method summary for the ToolObj object The following methods are available for the ToolObj object.
toolObj.enablePIControl() Availability Flash MX 2004. Usage toolObj.enablePIControl( control, bEnable ) Parameters A string that specifies the name of the control to enable or disable. Legal values control depend on the Property inspector invoked by this tool (see toolObj.setPI() A shape Property inspector has the following controls: stroke fill A text Property inspector has the following controls:...
Example The following command in an extensible tool’s JavaScript file will set Flash to not show the stroke options in the Property inspector for that tool: theTool.enablePIControl( "stroke", false); toolObj.position Availability Flash MX 2004. Usage toolObj.position Description Read-only property; an integer specifying the position of the tool in the Tools panel. Example The following commands in the method of a tool’s JavaScript file will show that...
toolObj.setMenuString() Availability Flash MX 2004. Usage toolObj.setMenuString( menuStr ) Parameters A string that specifies the name that appears in the pop-up menu as the name for the menuStr tool. Returns Nothing. Description Method; sets the string that appears in the pop-up menu as the name for the tool. Example The following example specifies that the tool named should display the name...
toolObj.setPI() Availability Flash MX 2004. Usage toolObj.setPI( pi ) Parameters A string that specifies the Property inspector to invoke for this tool. Returns Nothing. Description Method; specifies which Property inspector should be used when the tool is activated. Valid values are (the default), , and "shape"...
toolObj.setToolTip() Availability Flash MX 2004. Usage toolObj.setToolTip( toolTip ) Parameters A string that specifies the tooltip to use for the tool. toolTip Returns Nothing. Description Method; sets the tooltip that appears when the mouse is held over the tool icon. Example The following example specifies that the tooltip for the tool should be “Arrow Style 1 Tool.”...
deviceFonts varEdit options link maxChars target The movie Property inspector has the following controls: size publish background framerate player profile A Boolean value that determines whether to show or hide the specified control ( bShow true shows the control; hides the control). false Returns Nothing.
CHAPTER 3 Objects Tools object Availability Flash MX 2004. Description The Tools object is accessible from the Flash object ( ). The property fl.tools tools.toolObjs contains an array of ToolObj objects, and the property returns the ToolObj tools.activeTool object for the currently active tool. (See also ToolObj object.) Note: The following methods and properties are used only when creating extensible tools.
tools.activeTool Availability Flash MX 2004. Usage tools.activeTool Description Read-only property; returns the ToolObj object for the currently active tool. Example The following example saves an object that represents the currently active tool in the theTool variable. var theTool = fl.tools.activeTool; tools.altIsDown Availability Flash MX 2004.
tools.ctlIsDown Availability Flash MX 2004. Usage tools.ctlIsDown Description Read-only property; a Boolean value that identifies if the Control key is being pressed. The value if the Control key is pressed, and otherwise. true false tools.getKeyDown() Availability Flash MX 2004. Usage tools.getKeyDown() Parameters None.
Description Read-only property; a point that represents the position of the last mouse-down event on the Stage. has two properties, , corresponding to the location of the mouse penDownLoc on the current document. tools.penLoc Availability Flash MX 2004. Usage tools.penLoc Description Read-only property;...
Example The following example sets the pointer to a black arrow. fl.tools.setCursor(1); tools.shiftIsDown Availability Flash MX 2004. Usage tools.shiftIsDown Description Read-only property; a Boolean value that identifies if the Shift key is being pressed. The value is if the Shift key is pressed, and otherwise.
CHAPTER 3 Objects Vertex object Availability Flash MX 2004. Description The Vertex object is the part of the shape data structure that holds the coordinate data. Method summary for the Vertex object You can use the following methods with the Vertex object. Method Description Gets a...
Usage vertex.setLocation( x, y ) Parameters A floating point value that specifies the x coordinate of where the vertex should be positioned, in pixels. A floating point value that specifies the y coordinate of where the vertex should be positioned, in pixels.
vertex.y Availability Flash MX 2004. Usage vertex.y Description Read-only property; the y location of the vertex in pixels. Example vertex.x Vertex object...
CHAPTER 3 Objects VideoItem object Inheritance Item object > VideoItem object Availability Flash MX 2004. Description The VideoItem object is a subclass of the Item object. There are no unique methods or properties of VideoItem. Chapter 3: Objects...
CHAPTER 3 Objects XMLUI object Availability Flash MX 2004. Description Flash MX 2004 supports custom dialog boxes written in a subset of the XML User Interface Language (XUL). For more information, see Appendix B, “XML to UI” in Using Flash. You can write a dialog.xml file and invoke it from the JavaScript API using the document.xmlPanel() method.
Description Method; makes the current XMLUI dialog box exit with an accept state, which is equivalent to the user clicking the OK button. xmlui.cancel() Availability Flash MX 2004. Usage xmlui.cancel() Parameters None. Returns Nothing. Description Method; makes the current XMLUI dialog box exit with a cancel state, which is equivalent to the user clicking the Cancel button.
Page 367
Parameters A string that specifies the name of XMLUI property to modify. name A string that specifies the value to which you want to set the XMLUI property. value Returns Nothing. Description Method; modifies the value of the specified property of the current XMLUI dialog box. XMLUI object...
The C-level extensibility mechanism lets you implement Macromedia Flash MX 2004 and Macromedia Flash Professional MX 2004 extensibility files using a combination of JavaScript and custom C code. You define functions using C, bundle them in a dynamic linked library (DLL) or a shared library, save the library in the appropriate directory, and then call the functions from JavaScript using the Flash JavaScript API (JSAPI).
Windows 98: C:\Windows\Application Data\Macromedia\Flash MX 2004\ <language>\ Configuration\Templates\External Libraries Macintosh OS X: Hard Drive/Users/<userName>/Library/Application Support/Macromedia/ Flash MX 2004/<language>/Configuration/Templates/External Libraries Create a JSFL file that calls the functions. Run the JSFL file from the Commands menu in the Flash authoring environment.
Page 371
#define JS_FALSE 0 /***************************************************************************** * Public functions ****************************************************************************/ /* JSBool JS_DefineFunction(unsigned short *name, JSNative call, unsigned int nargs) */ #define JS_DefineFunction(n, c, a) \ (mmEnv.defineFunction ? (*(mmEnv.defineFunction))(mmEnv.libObj, n, c, a) \ : JS_FALSE) /* unsigned short *JS_ValueToString(JSContext *cx, jsval v, unsigned int *pLength) */ #define JS_ValueToString(c, v, l) \ (mmEnv.valueToString ? (*(mmEnv.valueToString))(c, v, l) : (unsigned short...
To see how the process works without actually building the DLL, you can do the following: • Store the Sample.jsfl file in the Commands directory (see “Overview of the Macromedia Flash JavaScript API” on page 17). • Store the Sample.dll file in the External Libraries directory (see “How integrating C functions...
369). Then create a JSFL with the following code, and store it in the Commands directory (see “Overview of the Macromedia Flash JavaScript API” on page 17). // JSFL file to run C function defined above var a = 5;...
typedef struct jsval jsval An opaque data structure that can contain an integer, or a pointer to a float, string, or object. Some functions in the API can read the values of function arguments by reading the contents of a structure, and some can be used to write the function’s return value by writing a jsval jsval...
typedef JSBool (*JSNative)(JSContext *cx, JSObject *obj, unsigned int argc, jsval *argv, jsval *rval) Description Method: describes C-level implementations of JavaScript functions in the following situations: • pointer is a pointer to an opaque structure, which must be passed to some JSContext of the functions in the JavaScript API.
unsigned short *JS_ValueToString() Usage unsigned short *JS_ValueToString(JSContext *cx, jsval v, unsigned int *pLength) Description Method; extracts a function argument from a structure, converts it to a string, if possible, jsval and passes the converted value back to the caller. Note: Do not modify the returned buffer pointer or you might corrupt the data structures of the JavaScript interpreter.
JSBool JS_ValueToDouble() Usage JSBool JS_ValueToDouble(JSContext *cx, jsval v, double *dp); Description Method; extracts a function argument from a structure, converts it to a double (if jsval possible), and passes the converted value back to the caller. Arguments JSContext *cx jsval v double *dp •...
JSBool JS_ValueToObject() Usage JSBool JS_ValueToObject(JSContext *cx, jsval v, JSObject **op); Description Method; extracts a function argument from a structure, converts it to an object (if jsval possible), and passes the converted value back to the caller. If the object is an array, use to read its contents.
JSBool JS_DoubleToValue() Usage JSBool JS_DoubleToValue(JSContext *cx, double dv, jsval *vp); Description Method; stores a floating-point number return value in a structure. jsval Arguments JSContext *cx double dv jsval *vp • argument is the opaque pointer that passes to the JavaScript function. JSContext •...
• argument is the number of bytes to be converted. • argument is the JavaScript value. Returns A Boolean value: indicates success; indicates failure. JS_TRUE JS_FALSE JSVal JS_IntegerToValue() Usage jsval JS_IntegerToValue(long lv); Description Method; converts a long integer value to structure.
Note: Do not modify the returned buffer pointer, or you might corrupt the data structures of the JavaScript interpreter. Arguments JSObject *obj • Typically, this argument is passed in and converted using the function. JS_ValueToObject() Returns A pointer to a null-terminated string. The caller should not free this string when it finishes. JSObject *JS_NewArrayObject() Usage JSObject *JS_NewArrayObject( JSContext *cx, unsigned int length [, jsval *v ] )
JSBool JS_GetElement() Usage JSBool JS_GetElement(JSContext *cx, JSObject *obj, jsint idx, jsval *vp) Description Method; reads a single element of an array object. Arguments JSContext *cx JSObject *obj unsigned int index jsval *v • argument is the opaque pointer that passes to the JavaScript function. JSContext •...
JSBool JS_ExecuteScript() Usage JS_ExecuteScript (JSContext *cx, JSObject *obj, unsigned short *script, unsigned int sz, jsval *rval) Description Method; compiles and executes a JavaScript string. If the script generates a return value, it returns *rval Arguments JSContext *cx JSObject *obj unsigned short *script unsigned int sz jsval *rval •...
Need help?
Do you have a question about the FLASH MX 2004-FLASH JAVASCRIPT DICTIONARY and is the answer not in the manual?
Questions and answers