PDA

View Full Version : Effects or Item Renderer?


jsimpson
08-03-2007, 06:24 AM
I'm trying to figure out what events allow properties to be modified and at what level I have to make changes to allow them to be reusable. In top flash sites, or at least those winning awards, there's often a mouse over effect on links that is consistent throughout the entire site.

I'm attempting to do the following:
1. Create a button that has three events happen on rollOverEffect and rollOutEffect

Label's Color change gradually
Label's X position change (like move xBy)
Buttons Icon to fade in

2. Create in such a way that I can then specify the same effects for list items in trees and datagrids. So that when you mouse over them they perform the same operations.

So far I have a parallel tag with a few events, and a button that uses it for its effect.


<mx:Parallel id="RollOver1">
<mx:Move xBy="10" duration="500" />
</mx:Parallel>

<mx:Parallel id="RollOut1">
<mx:Move xBy="-10" duration="500" />
</mx:Parallel>

<mx:Button label="Sample Text" rollOverEffect="{RollOver1}" rollOutEffect="{RollOut1}"/>


This works to a degree, but I don't have the ability to seperate what parts of the button should be moved, and there isn't a quick color change. How would I go about making something along the lines I mentioned? And if I have to create some sort of item renderer, which I've had almost no success with, what methods do I need to be overriding? Thanks for your help!

jsimpson
08-06-2007, 04:42 AM
Well I've been looking into it and found that the event I want is the itemRollOver, as the one I was using triggered whenever the tree recieved a roll over. I can't seem to find a way to effect the row that triggers the itemRollOver.

Tracing event.target or event.currentTarget both return the entire tree, and there is only the selectedIndex not an index of the line the mouse is currently over.

I tried writing an entire TreeItemRenderer but then realized I can't override the itemRollOver events.

I've now been working on this particular tree/menu for nearly three weeks on and off. None of my co-workers have any Flex experience and all of our components are built seperate of adobe's flash components.

I'd like to have an itemRenderer that bumps the label field when moused over and fades in the icon. Any help, any, would be greatly appreciated!