Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Getting name of key?

Guest
May 11, 2013 May 11, 2013

Gidday

I have json data returning from my server, and then I decode it.

In php, I have unique names for the array sent back based on the result of the transaction...

$returnArray['links'] = $links;

$returnArray['msg'] = 'no matches for that code or name';

$returnArray['error'] = '3555';

(only one will ever be sent back at once)

In as3, I want to set up a switch based on the key name of the returned object...

switch (returnedServerData.nameofit-eg-links-or-msg-etc)

...so that I can set up my processing based on whether it's an error, link, msg etc

What do I type after returnedServerData. to access the name of that key?

Thanks guys

TOPICS
ActionScript
501
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 12, 2013 May 12, 2013

you can use:

for(var s:String in returnedServerData){

switch(s){

.

.

.

}

}

Translate
Community Expert ,
May 12, 2013 May 12, 2013

you can use:

for(var s:String in returnedServerData){

switch(s){

.

.

.

}

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 12, 2013 May 12, 2013

Ooo - that did the trick - thanks kGlad.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 13, 2013 May 13, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines