Custom class help (nav)
- Started
- Last post
- 8 Responses
- jysta
Any flash heads about this morning?
Been scourging forums etc but with no success.I created a OOP custom class of buttons with tweener transitions. They work great! BUT:
I need to create an 'active' state onRelease for the buttons.
Normally I would have done this in the main timeline with an array and activate function with for-loop etc...
But because my buttons are animated using tweener everything done in the custom class in 1 frame. How do I handle the 'active' states in this particular case?
- Fariska0
as2 or as3?
And as active state you mean a visual variation of the button?I usually pack my buttons mcs/sprites with all the states and then i hide them the over, active etc etc on the constructor, setting the various component visible= false and/or alpha = 0
then i trigger their visibility via the mouse events
- Fariska0
And.... you can create a variable (property) on your button which holds if the state of the button (active = true or false)
better doing it using a setter/getter
and then on the function that checks which button is active or not you can trigger the active status from there setting something like
mybtn.active = true (or false)Hope this make sense
- jysta0
Hi Fariska! Yes it AS2 with tweener. Would I set the variable to check the state and function within the main timeline or within the customClass.as
sorry if thats a stupid question but i only picked up OOP last night after playing around with tweener for a couple of hours/ !
- Fariska0
As2 or as3 doesn't change too much at this level.
you need to set up the variable inside the custom class (so each button instance will have it)
Make it private and let external classes access it thru a getter and setter you've set up.and keep this as reference.
http://www.kirupa.com/developer/…- nice one mate, reading up about what you said in that link now..jysta
- maximillion_0
paste yr code
- jysta0
This tweener example is exactly where I am at with my own buttons. I just need to add the 'active' states
- jysta0
For anyone else, found a solution here:
http://www.gotoandlearnforum.com…