BluesmanUK
Programmer
Hi all,
I posted this in some flash forums but I thought it would be just as appropriate to post my question here too...
Im creating a UI using Flash and OOP Actionscript; and my question relates to designing the menu navigation system.
What needs to happen is fairly simple i guess : when a button is rolled over, it changes state (enlarges and changes colour) AND all the other buttons change (they shrink and fade out slightly).
My question is about how to approach writing the classes from a design perspective. I havent totally got to grips with using Design patterns but im wondering if the Observer pattern would be suitable:
Have a 'Navigation manager' as the observable subject, and each menu-button would be an instance of a class that acted as the Observer and registers for updates with the Navigation Manager. When a menu button (observer) is interacted with (rolled over, clicked etc), the Subject is notified and tells all of the observers to update themselves. Not sure if its good practice to have the observer updating the observable :-S
Does it sound like i'm on the right track?
If anyone has any thoughts it'd be much appreciated!
thanks
Tim
I posted this in some flash forums but I thought it would be just as appropriate to post my question here too...
Im creating a UI using Flash and OOP Actionscript; and my question relates to designing the menu navigation system.
What needs to happen is fairly simple i guess : when a button is rolled over, it changes state (enlarges and changes colour) AND all the other buttons change (they shrink and fade out slightly).
My question is about how to approach writing the classes from a design perspective. I havent totally got to grips with using Design patterns but im wondering if the Observer pattern would be suitable:
Have a 'Navigation manager' as the observable subject, and each menu-button would be an instance of a class that acted as the Observer and registers for updates with the Navigation Manager. When a menu button (observer) is interacted with (rolled over, clicked etc), the Subject is notified and tells all of the observers to update themselves. Not sure if its good practice to have the observer updating the observable :-S
Does it sound like i'm on the right track?
If anyone has any thoughts it'd be much appreciated!
thanks
Tim