You can do:

this[chart].series = currentSeries;

 

if "linechart0" is an id for a component instance or a property of "this"

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of Pedro Sena
Sent: Thursday, June 04, 2009 7:15 PM
To: [email protected]
Subject: Re: [flexcoders] Variables to reference variables/ids (not variable
variables)

 






What do you think about a collection?

for each ( var chart:BaseChart in chartGroup.getCharts() ) {
       chart.doSomething();
}

Better, isn't it ? :)

Regards,

PS

On Thu, Jun 4, 2009 at 7:49 PM, Trefalgar Bain <trefal...@yahoo.
<mailto:[email protected]> com> wrote:

 

Might be a newbie question, but I'm failing to find this subject in my book
or on the web.

While you can do variable variables, to create all sorts of fun things, I'm
looking to create a variable to reference an object already created. 

For example ... I have 10 charts on a reporting interface, each with their
own id and tab. Right now, if I want to make identical buttons affect
individual charts, I'd have to create 10 buttons, each programed to update
each individual chart. What I'd like to do is be able to pass the tab name /
chart id to the function call, so it will know which chart to update.

This way, I only have to create one function to update any chart, instead of
10 functions, one to handle each button/chart.

Does that make sense? Is it possible?

chart = 'linechart0';
{chart}.series = currentSeries;

Tref




-- 
/**
* Pedro Sena
* Systems Architect
* Sun Certified Java Programmer 
* Sun Certified Web Component Developer
*/



Reply via email to