dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to dump an object?

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    13
    I'm getting a structure back from cfmx and I'd like to dump it's values (both key/value) into a dynamic text field. Was thinking a loop but how can I reference they keys/values?

    Thank ya!

    Stace

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    266
    Hi,

    I dont use CFMX, however I imagine your data comes into flash in a urlencoded format.

    Try using the split function.

    Here's an example:

    Code:
    myString = "name=dan&age=27&email=dan@technomedia.co.uk"
    split1 = myString.split("&");
    for(i=0;i<split1.length;i++){
    	trace (split1[i].split("="));
    }
    Hope it helps,

    Dan.

  3. #3
    Junior Member
    Join Date
    May 2002
    Posts
    13
    It's coming in as an object. Normally I can reference a value by doing:

    myObjectStructure.keyName

    and that will print out the value...now in my latest case I won't know the keys. :\

    thanks for the help!

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    667
    If your vars come in as an object you can loop through the object with a for...in loop and refrence each successive property as you would in an array.

    ex.

    for (var j in myObject) {
    someVar = myObject[j];
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center