Well I figured it out after messing around with anything. Replying here so others can see my results for help…it may not be the best way though, no clue.

What works = best way
J

 

Code up top:
[Embed(source="1star.swf")]

var image_up :String;

                 

[Embed(source="2star.swf")]

var image_down :String;

 

public function changeIcon(linkName:String,itemIndex:Number) {

   var i:Number = 1;

   for(i;i<6;i++) {

     if(i <= itemIndex) {

     this[linkName+"_"+i].icon = image_down;

   } else {

     this[linkName+"_"+i].icon = image_up;     

   }

 }


Application chunk:


<mx:Link id="time_1" icon="{image_up}" click="changeIcon('time',1)"/>

<mx:Link id="time_2" icon="{image_up}" click="changeIcon('time',2)"/>

<mx:Link id="time_3" icon="{image_up}" click="changeIcon('time',3)"/>

<mx:Link id="time_4" icon="{image_up}" click="changeIcon('time',4)"/>

<mx:Link id="time_5" icon="{image_up}" click="changeIcon('time',5)"/>

 

 

_________________________________________

Jonathan Miranda

 

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Miranda
Sent: Friday, January 27, 2006 10:20 AM
To: [email protected]
Subject: [flexcoders] Looping through Dynamic named components

 

Let’s say I have 10 links with names diff_1,diff_2,diff_3, diff_4, diff_5, rush_1, rush_2, rush_3, rush_4, rush_5. I want them all to share a common function that will change the icon of the objects below the current one clicked. Aka, if you click rush_5, it changes the icon of rush_4 down to diff_1.

Now I don’t want to write  out a huge case statement and am having troubles referencing them dynamically. Let’s say I sent into the function - myFunc(“diff_4”). How would I run through diff_3 and down knowing this? Having issues with doing this dynamically and I know it’s easy, but any help would be nice.

Thanks guys,
Jon




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to