Old Articles - 6 years, 3 months ago - 0 Comments
LoadVars.decode
Another hidden away feature of Flash MX, this time a method of the LoadVars object. This little method, is the method that the LoadVars object uses internally to decode your name/value pairs into object properties and values…
LoadVars.decode is inherited by all instances of the LoadVars object. The method accepts one argument, the argument is a string that contains name/value pairs, that you wish to be converted into object properties and associated values.
Name/value pairs look like this:
myvariable=value&myothervariable=anothervalue
This hidden method, will convert the above name/value pairs into two properties ‘myvariable’ and ‘myothervariable’, the values of these properties are the associated values in the name/value pair string, so the value of ‘myvariable’ in the above string is ‘value’ and the value of ‘myothervariable’ in the above string is ‘anothervalue’. Heres a little code example to show you what this method does:
//create a new instance of the LoadVars object
myvars=new LoadVars()
//call the method with our name/value pair string
myvars.decode('name=Guy&age=18&icq=71063418')
//iterate over all the properties in the 'myvars' object
for(var i in myvars){
//trace the property name and property value
trace(i+':'+myvars[i])
}
The output of the above code is:
name:Guy
age:18
icq:71063418
This method has not yet been added to the Macromedia Flash MX Actionscript Dictionary Errata.
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

