Array get element name Flex 4

Posted on 2011-02-20
Last Modified: 2012-05-11
Now I have lots of images I want to get their state

so I did
var cardState:array;  ttstr:String;

for (var i:int = 10; i < 79; i++) {  // Loop all cards  
ttstr = "Ca" +  i.toString();   // the ID's of the cards

Now I want to put the state back
This is my Guess, but I want to get the name of the element
for (var y:int = 10; i < cardState.length; i++) {  // player  
     this[cardState[y]name ]["visible"] =   cardState[y];  }

Question by:yahoolane
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Author Comment

ID: 34939929
Looks Like I have to use an object
LVL 17

Expert Comment

ID: 34940011
 this[cardState[y]name ]["visible"] =   cardState[y];  }

The above 2 live are wrong. I am sorry I did not understand your problem. Kindly brief what you are trying to do in these 2 lines so that I can suggest.

Warm Regards
Deepanjan Das

Author Comment

ID: 34957802
how do I do something like this


Then do cardstate[0]  and get back 'card1'

so I set it by name but want to return the name numericaly
LVL 17

Accepted Solution

deepanjandas earned 325 total points
ID: 34957879
That seems to be a difficult call.
You may use Dictionary Class for something like this:
cardstate['card1'] = true;

But then by doing cardstate[0] you will not get the value as "card1".

Can you please explain me the scenario why you are looking for such a solution. May be I can help you to think in another way as this might not be possible.

Warm Regards
Deepanjan Das

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
looking for noob/pro flash game developers to grow with 4 667
Flex 4.6  -- how to debug runtime errors 3 835
Port 4000 issue 1 1,958
[Q] XML to Object/Dictionary class available? 3 719
First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below.…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question