Detailed instructions for use are in the User's Guide.
[. . . ] Flash JavaScript Dictionary
Trademarks Add Life to the Web, Afterburner, Aftershock, Andromedia, Allaire, Animation PowerPack, Aria, Attain, Authorware, Authorware Star, Backstage, Bright Tiger, Clustercats, ColdFusion, Contribute, Design In Motion, Director, Dream Templates, Dreamweaver, Drumbeat 2000, EDJE, EJIPT, Extreme 3D, Fireworks, Flash, Flash Lite, Flex, Fontographer, FreeHand, Generator, HomeSite, JFusion, JRun, Kawa, Know Your Site, Knowledge Objects, Knowledge Stream, Knowledge Track, LikeMinds, Lingo, Live Effects, MacRecorder Logo and Design, Macromedia, Macromedia Action!, Macromedia Breeze, Macromedia Flash, Macromedia M Logo and Design, Macromedia Spectra, Macromedia xRes Logo and Design, MacroModel, Made with Macromedia, Made with Macromedia Logo and Design, MAGIC Logo and Design, Mediamaker, Movie Critic, 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. or other entities and may be registered in certain jurisdictions including internationally. [. . . ] You can change this property only to another library item of the same type (that is, you cannot set a symbol instance to refer to a bitmap). See library object.
Instance object
199
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];
200
Chapter 3: Objects
Item object
Availability
CHAPTER 3 Objects
Flash MX 2004.
Description
The Item object is an abstract base class. Method summary for the Item object The following methods are available for the Item object.
Method
item. addData() item. getData() item. hasData() item. removeData()
Description Method; adds specified data to a library item. Method; removes persistent data from the library item.
Property summary for the Item object The following properties are available for the Item object.
Property
item. itemType item. linkageClassName
Description Read-only; a string that specifies the type of element. Property; a string that specifies the ActionScript 2. 0 class that will be associated with the symbol. frame.
item. linkageExportForAS
item. linkageExportForRS
item. linkageExportInFirstFrame Property; a Boolean value. If true, the item is exported in the first
item. linkageIdentifier
Property; a string that specifies the name Flash will use to identify the asset when linking to the destination SWF file. Property; a string that specifies the URL where the SWF file containing the shared asset is located. Property; a string that specifies the name of the library item, which includes the folder structure.
item. linkageImportForRS
item. linkageURL
item. name
Item object
201
item. addData()
Availability
Flash MX 2004.
Usage item. addData( name, type, data ) Parameters name type
A string that specifies the name of the data. Valid types are "integer", "integerArray", and "byteArray".
"double", "doubleArray", "string", data
The data to add to the specified library item. For example, if type is "integer", the value of data must be an integer, and so on.
Returns
Nothing.
Description
Method; adds specified data to a library item.
Example
The following example adds data named myData with an integer value of 12 to the first item in the library:
fl. getDocumentDOM(). library. items[0]. addData("myData", "integer", 12);
item. getData()
Availability
Flash MX 2004.
Usage item. getData( name ) Parameters name Returns
A string that specifies the name of the data to retrieve.
The data specified by the name parameter. The type of data returned depends on the type of stored data.
Description
Method; retrieves the value of the specified data.
202
Chapter 3: Objects
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 name Returns
A string that specifies the name of the data to check for in the library item.
A Boolean value: true if the specified data exists; false otherwise.
Description
Method; determines whether the library item has the named data.
Example
The following example shows a message in the Output panel if the first item in the library contains data point named myData:
if ( fl. getDocumentDOM(). library. items[0]. hasData( "myData" ) ){ fl. trace("Yep, it's there!"); }
item. itemType
Availability
Flash MX 2004.
Usage item. itemType Description
Read-only property; a string that specifies the type of element. Potential values are "undefined",
"component", "movie clip", "graphic", "button", "video", "folder", "font", "sound", "bitmap", "compiled clip", Example
and "video".
The following example shows the type of the specified library item in the Output panel:
fl. trace(fl. getDocumentDOM(). library. items[0]. itemType);
Item object
203
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 item. linkageExportForAS and/or item. linkageExportForRS properties must be set to true, and the item. linkageImportForRS property must be set to false.
Example
The following example specifies that the ActionScript 2. 0 class name associated with the first item in the Library is myClass:
fl. getDocumentDOM(). library. items[0]. linkageClassName = "myClass";
item. linkageExportForAS
Availability
Flash MX 2004.
Usage item. linkageExportForAS Description
Property; a Boolean value. You can also set the item. linkageExportForRS and item. linkageExportInFirstFrame properties to true. The item. linkageImportForRS property must be set to false if this property is set to true.
Example
The following example sets this property for the specified library item:
fl. getDocumentDOM(). library. items[0]. linkageExportForAS = true;
item. linkageExportForRS
Availability
Flash MX 2004.
Usage item. linkageExportForRS
204
Chapter 3: Objects
Description
Property; a Boolean value. This property can be set to true only if item. linkageImportForRS is set to false. Also, the properties item. linkageIdentifier and item. linkageURL must be defined.
Example
The following example sets this property for the specified library item:
fl. getDocumentDOM(). library. items[0]. linkageExportForRS = true;
item. linkageExportInFirstFrame
Availability
Flash MX 2004.
Usage item. linkageExportInFirstFrame Description
Property; a Boolean value. If true, the item is exported in the first frame; if false, the item is exported on the frame of the first instance. This property can be set to true only when item. linkageExportForAS and/or item. linkageExportForRS are set to true.
Example
The following example specifies that the specified library item is exported in the first frame:
fl. getDocumentDOM(). library. items[0]. linkageExportInFirstFrame = true;
item. linkageIdentifier
Availability
Flash MX 2004.
Usage item. linkageIdentifier Description
Property; a string that specifies the name Flash will use to identify the asset when linking to the destination SWF file. It must be specified if item. linkageExportForAS and/or item. linkageExportForRS are set to true.
Example
The following example specifies that the string my_mc will be used to identify the library item when it is linked to the destination SWF file to which it is being exported:
fl. getDocumentDOM(). library. items[0]. linkageIdentifier = "my_mc";
Item object
205
item. linkageImportForRS
Availability
Flash MX 2004.
Usage item. linkageImportForRS Description
Property; a Boolean value: if true, the item is imported for runtime sharing. If this property is set to true, both item. linkageExportForAS and item. linkageExportForRS must be set to false. [. . . ] JSVal JS_ObjectToValue()
Usage jsval JS_ObjectToValue(JSObject *obj); Description
Method; stores an object return value in a JSVal. Use JS_ NewArrayObject() to create an array object; use JS_SetElement() to define its contents.
Arguments JSObject *obj
· The obj argument is a pointer to the JSObject object that you want to convert to a JSVal
structure.
Returns
A JSVal structure that contains the object that you passed to the function as an argument. unsigned short *JS_ObjectType()
Usage unsigned short *JS_ObjectType(JSObject *obj); Description
Method; given an object reference, returns the class name of the object. For example, if the object is a DOM object, the function returns "Document". [. . . ]