• home
  • forum
  • my
  • kt
  • download
  • LoadVars.decode

    Author: 2007-06-13 12:56:53 From:

    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.

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (112)
      Backend (25)
      Text Effects (65)
      Drawing (18)
      Tips and Techniques (41)
      Dynamic Content (25)
      Tricks (6)
      Games (66)
      Utilities (19)
      Getting Started (71)
      Video (10)
      Interactivity (21)
      Web Design (22)

    New

    Hot