[flexcoders] Changing style/background color dynamically

2007-05-31 Thread Rachel Maxim

I'm working on a UI where I have some canvas-based components (used as
ItemRenderers within TileLists) that get dragged between different
TileLists. The background color of these canvas components changes depending
on the situation, so on the component I have a function that runs on
CreationComplete to determine the color it should be, and then set the
background color property of the canvas.

This works most of the time, but when I drag the component from one TileList
to another, it does not change to the correct color as it should. If I
refresh the page (reload the SWF), it shows the correct color, but after
that initial drag and drop, the color does not apply correctly. I've also
tried running the function on dataChange as well as creationComplete, and it
doesn't seem to make a difference.

Am I approaching this right, or can anyone suggest a more reliable way to
change the color dynamically?

Thanks
Rachel


Re: [flexcoders] Changing style/background color dynamically

2007-05-31 Thread Michael Schmalle

Hi,

Have you tried listening for the ChildExistenceChangedEvent.CHILD_ADD event
of your client(accepting container) dnd canvas.

This event would tell you when you need to update the dragging component
background.
The releatedObject property will also give you direct access to the child
being added to the container.

Peace, Mike

On 5/31/07, Rachel Maxim [EMAIL PROTECTED] wrote:


  I'm working on a UI where I have some canvas-based components (used as
ItemRenderers within TileLists) that get dragged between different
TileLists. The background color of these canvas components changes depending
on the situation, so on the component I have a function that runs on
CreationComplete to determine the color it should be, and then set the
background color property of the canvas.

This works most of the time, but when I drag the component from one
TileList to another, it does not change to the correct color as it should.
If I refresh the page (reload the SWF), it shows the correct color, but
after that initial drag and drop, the color does not apply correctly. I've
also tried running the function on dataChange as well as creationComplete,
and it doesn't seem to make a difference.

Am I approaching this right, or can anyone suggest a more reliable way to
change the color dynamically?

Thanks
Rachel
 





--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.