Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Array get element name Flex 4

Posted on 2011-02-20
4
Medium Priority
?
1,103 Views
Last Modified: 2012-05-11
Now I have lots of images I want to get their state

so I did
for
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
cardState[ttstr]=this[ttstr]["visible"];

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];  }



0
Comment
Question by:yahoolane
  • 2
  • 2
4 Comments
 
LVL 1

Author Comment

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

Expert Comment

by:deepanjandas
ID: 34940011
cardState[ttstr]=this[ttstr]["visible"];
 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
0
 
LVL 1

Author Comment

by:yahoolane
ID: 34957802
how do I do something like this

cardstate['card1']=true

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

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

Accepted Solution

by:
deepanjandas earned 1300 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
0

Featured Post

WatchGuard Case Study: NCR

With business operations for thousands of customers largely depending on the internal systems they support, NCR can’t afford to waste time or money on security products that are anything less than exceptional. That’s why they chose WatchGuard.

Question has a verified solution.

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

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…
In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Screencast - Getting to Know the Pipeline
Suggested Courses

886 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