RE: [flexcoders] Replace an on screen component.

2007-02-20 Thread Ely Greenfield


Hi Grant.  The answer is yes, and yes.

Ely.
 

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, February 20, 2007 12:26 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Replace an on screen component.

Hi guys,

We have a chart displayed on a dashboard amongst other components, when
a user selects a different chart we need to remove the chart and display
a different one, I was going to use view states but we have lots of
different charts and it seems that the charts not in the current view
are still alive and respond to events they are subscribed for, is this
correct ?

In flash i'd remove the movie clip and load a new one, can I remove
the component and load another one within my dashboard ?

Grant


RE: [flexcoders] Replace an on screen component.

2007-02-20 Thread Karl Johnson
In your method that handles the adding and removing of the charts, instead of 
changing the state or changing the visibility of the chart, you can completely 
remove it using chartParent.removeChild(chartInstance); Then you can add your 
new one using chartParent.addChild(newChartInstance). chartParent could just be 
this depending on where you are adding and removing it in the component 
structure.
 
Unless you pre-load the charts in memory there will be an instantiation hit 
when you add the component on the fly depending on how complex your chart is. 
Best to use a preloading image or something.
 
HTH,
Karl
 
Cynergy



From: flexcoders@yahoogroups.com on behalf of [EMAIL PROTECTED]
Sent: Tue 2/20/2007 2:25 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Replace an on screen component.



Hi guys,

We have a chart displayed on a dashboard amongst other components, when a user 
selects a different chart we need to remove the chart and display a different 
one, I was going to use view states but we have lots of different charts and it 
seems that the charts not in the current view are still alive and respond 
to events they are subscribed for, is this correct ?

In flash i'd remove the movie clip and load a new one, can I remove the 
component and load another one within my dashboard ?

Grant