Solved

Array get element name Flex 4

Posted on 2011-02-20
4
1,096 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 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
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

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…
Direct mail marketing is the act of mailing materials straight to prospective customers. This wide form of marketing is one of the oldest methods of communicating with a geographic based demographic. So is it useful in 2017 and beyond?
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

680 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