< Day Day Up > |
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 objectThe following methods are available for the Item object.
Property summary for the Item objectThe following properties are available for the Item object.
item.addData()Availability Flash MX 2004. Usage item.addData( name, type, data ) Parameters name A string that specifies the name of the data. type A string that specifies the type of data. Valid types are "integer", "integerArray", "double", "doubleArray", "string", and "byteArray". data The data to add to the specified library item. The type of data depends on the value of the type parameter. 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 A string that specifies the name of the data to retrieve. Returns The data specified by the name parameter. The type of data returned depends on the type of stored data. Description Method; retrieves the value of the specified data. Example The following example gets the value of the data named myData from the first item in the library and stores it in the variable libData. var libData = fl.getDocumentDOM().library.items[0].getData( "myData" ); item.hasData()Availability Flash MX 2004. Usage item.hasData( name ) Parameters name A string that specifies the name of the data to check for in the library item. Returns 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.itemTypeAvailability Flash MX 2004. Usage item.itemType Description Read-only property; a string that specifies the type of element. The value is one of the following: "undefined", "component", "movie clip", "graphic", "button", "folder", "font", "sound", "bitmap", "compiled clip", "screen", and "video". If this property is "video", you can determine the type of video; see videoItem.videoType. Example The following example shows the type of the specified library item in the Output panel: fl.trace(fl.getDocumentDOM().library.items[0].itemType); item.linkageClassNameAvailability 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.linkageExportForASAvailability Flash MX 2004. Usage item.linkageExportForAS Description Property; a Boolean value. If this property is TRue, the item is exported for ActionScript. You can also set the item.linkageExportForRS and item.linkageExportInFirstFrame properties to true. If you set this property to true, the item.linkageImportForRS property must be set to false. Also, you must specify an identifier (item.linkageIdentifier) and a URL (item.linkageURL). Example The following example sets this property for the specified library item: fl.getDocumentDOM().library.items[0].linkageExportForAS = true; item.linkageExportForRSAvailability Flash MX 2004. Usage item.linkageExportForRS Description Property; a Boolean value. If this property is TRue, the item is exported for runtime sharing. You can also set the item.linkageExportForAS and item.linkageExportInFirstFrame properties to TRue. If you set this property to true, the item.linkageImportForRS property must be set to false. Also, you must specify an identifier (item.linkageIdentifier) and a URL (item.linkageURL). Example The following example sets this property for the specified library item: fl.getDocumentDOM().library.items[0].linkageExportForRS = true; item.linkageExportInFirstFrameAvailability 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. If the item does not appear on the Stage, it isn't exported. This property can be set to true only when item.linkageExportForAS and/or item.linkageExportForRS are set to TRue. Example The following example specifies that the specified library item is exported in the first frame: fl.getDocumentDOM().library.items[0].linkageExportInFirstFrame = true; item.linkageIdentifierAvailability Flash MX 2004. Usage item.linkageIdentifier Description Property; a string that specifies the name Flash will use to identify the asset when linking to the destination SWF file. Flash ignores this property if item.linkageImportForRS, item.linkageExportForAS, and item.linkageExportForRS are set to false. Conversely, this property must be set when any of those properties 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"; See also item.linkageURL item.linkageImportForRSAvailability 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. Also, you must specify an identifier (item.linkageIdentifier) and a URL (item.linkageURL). Example The following example sets this property to TRue for the specified library item: fl.getDocumentDOM().library.items[0].linkageImportForRS = true; item.linkageURLAvailability Flash MX 2004. Usage item.linkageURL Description Property; a string that specifies the URL where the SWF file containing the shared asset is located. Flash ignores this property if item.linkageImportForRS, item.linkageExportForAS, and item.linkageExportForRS are set to false. Conversely, this property must be set when any of those properties are set to true. You can specify a web URL or a filename in platform-dependent format (that is, forward slashes [/] or backward slashes [\], depending on the platform). Example The following example specifies a linkage URL for the specified library item: fl.getDocumentDOM().library.items[0].linkageURL = "theShareSWF.swf"; See also item.linkageIdentifier item.nameAvailability Flash MX 2004. Usage item.name 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 name property of Symbol_1 is "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); item.removeData()Availability Flash MX 2004. Usage item.removeData(name) Parameters name Specifies the name of the data to remove from the library item. Returns Nothing. Description Property; removes persistent data from the library item. Example The following example removes the data named myData from the first item in the library: fl.getDocumentDOM().library.items[0].removeData( "myData" ); |
< Day Day Up > |