Old Articles - 3 years, 3 months ago - 0 Comments
XML.idMap - Node Lookup Table
XML Objects in Flash Player 8 have an additional property called idMap. This property is an object that contains a reference to each and every xml node in the xml document that has an id attribute defined. The name of each property in the XML.idMap object is the value of the id attribute. So for example if i had an xml node that had an id attribute of 0001:
-
<contact id='0001'>
-
<name>Guy Watson</name>
-
<telephone>00447837924006</telephone>
-
</contact>
There would be a property defined in the XML.idMap object called "0001" and its value would be a reference to that particular xml node instance:
-
xmlStr='<contact id='0001'><name>Guy Watson</name>'
-
xmlStr+='<telephone>00447837924006</telephone>'
-
xmlStr+='</contact>'
-
myXML=new XML(xmlStr)
-
myXML.ignoreWhite=true
-
trace(myXML.idMap['0001'])
You can use this object to quickly locate particular nodes of interest, by simply assigning them a unique id in the xml file.
[update] Turns out it was actually easier to do with actionscript in previous versions of the Flash Player using myXml['0001'] for example. However if you publish your Flash Movie for Flash Player 8, the old way doesnt work anymore, so this is the way to do it instead. [/update]
Note: This is an old article!
Please be aware that the content of this article may no longer be accurate and the links contained within could be broken.
Update Notifications
You can add our RSS feed to your favorite feed reader or recieve an email when a new article is posted by entering your email address below.
FLASH EXPERTS
- Andre Michelle
- Aral Balkan
- Big Spaceship
- Chafic Kazoun
- Colin Moock
- Craig Swann
- Erik Natzke
- Grant Skinner
- Jesse Warden
- John Grden
- Keith Peters
- Lee Brimelow
- Lord Alex
- Mario Kingemann
- Matt Voermn
- Ralph Hauwert
- Richard Leggett
- Trevor McCauley
FLASH COMPONENTS
- AFComponents
- Components Network
- Extend Studio
- Flash Relief
- Flash Store
- Flashden
- Flashloaded
- Ghostwire
- Image Vue
- Jumpeye
- Page Flip Component
- Slideshowpro
FLASH VIDEO
- Akamai
- FFMPEG
- FlashComGuru
- Flashstreamworks
- FLV Player
- FLVMDI
- flvPlayerPro
- FLVTool2
- Influxis
- JW FLV Player
- Vital Stream
FLASH RESOURCES
- Actionscript.org
- Adobe Labs
- Developer Center
- Flash Interface
- Flash Player Statistics
- Flashkit
- Kirupa
- MDM Zinc
- OSFlash
- PaperVision3D
- SWXFormat
- Tweener
SPONSORS
More In Actionscript
- Adobe MAKE SOME NOISE
- Undocumented Actionscript 3
- BitmapData.loadBitmap gone in AS3
- Actionscript 3 - New Capabilities
- Flash 8 - setTimeout

