[Flashcoders] Simple encapsulation question
I have a typical tabbed layout and am trying to figure out the simplest/best way to reset the focused state on the focused tab when another is clicked. Classes: Tab - contains graphics and a public variable referencing the MovieClip of the over state. Header - creates tabs, adds event listeners, contains array of references to tabs and a function to loop through them and remove the over state child. Is there a better way - to somehow add an event listener to each tab listening for a click on each other tab? Even if I don't know how many tabs there will be? _ _ _ Erik Mattheis | Weber Shandwick P: (952) 346.6610 M: (612) 377.2272 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Simple encapsulation question
I would suggest allowing Tabs to remain ignorant of each other and let the parent deal with the focus, because you might like to change it. In my lazy world of radio-buttons that can only have on toggled on at once, I keep a reference to the currently toggled button. If I receive a click from a button and there is a current one, I untoggle that first, before toggling the clicked one and assigning it to the current reference. On 16/03/2011 17:00, Mattheis, Erik (MIN-WSW) wrote: I have a typical tabbed layout and am trying to figure out the simplest/best way to reset the focused state on the focused tab when another is clicked. Classes: Tab - contains graphics and a public variable referencing the MovieClip of the over state. Header - creates tabs, adds event listeners, contains array of references to tabs and a function to loop through them and remove the over state child. Is there a better way - to somehow add an event listener to each tab listening for a click on each other tab? Even if I don't know how many tabs there will be? _ _ _ Erik Mattheis | Weber Shandwick P: (952) 346.6610 M: (612) 377.2272 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Simple encapsulation question
Mattheis, Erik (MIN-WSW) skriver: I have a typical tabbed layout and am trying to figure out the simplest/best way to reset the focused state on the focused tab when another is clicked. Classes: Tab - contains graphics and a public variable referencing the MovieClip of the over state. Header - creates tabs, adds event listeners, contains array of references to tabs and a function to loop through them and remove the over state child. Is there a better way - to somehow add an event listener to each tab listening for a click on each other tab? Even if I don't know how many tabs there will be? _ _ _ Erik Mattheis | Weber Shandwick P: (952) 346.6610 M: (612) 377.2272 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders The last time I did a tab system I used a different approach. I let each tab worry about the drawing, but I let the container manage what tab is selected. This way it is easy for the manager to just tell the previous tab that it is no longer selected and to tell the new tab that it is selected. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Simple encapsulation question
Hi Erik, Can't you use the array of references to tabs to reset the focused state of all tabs but the one just clicked? HTH Willem van den Goorbergh On 16 mrt 2011, at 18:00, Mattheis, Erik (MIN-WSW) wrote: I have a typical tabbed layout and am trying to figure out the simplest/best way to reset the focused state on the focused tab when another is clicked. Classes: Tab - contains graphics and a public variable referencing the MovieClip of the over state. Header - creates tabs, adds event listeners, contains array of references to tabs and a function to loop through them and remove the over state child. Is there a better way - to somehow add an event listener to each tab listening for a click on each other tab? Even if I don't know how many tabs there will be? _ _ _ Erik Mattheis | Weber Shandwick P: (952) 346.6610 M: (612) 377.2272 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= Geografiek is een in Utrecht gevestigd kartografisch bureau Willem van den Goorbergh is telefonisch bereikbaar onder nummer 030-2719512 of mobiel: 06-26372378 Per fax is Geografiek bereikbaar onder nummer: 030-2719687 postadres: Hooghiemstraplein 89 3514 AX UTRECHT Bezoek onze website op: www.geografiek.nl twitter: @wvdgoorbergh =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Simple encapsulation question
Yes, I was hoping I could avoid the class of the tabs parent having to know anything about the Tab class. I think I'll go with Henrik and Glen's suggestion to keep track of the tab that has focus. On 3/16/11 12:20 PM, Geografiek geograf...@geografiek.nl wrote: Hi Erik, Can't you use the array of references to tabs to reset the focused state of all tabs but the one just clicked? HTH Willem van den Goorbergh On 16 mrt 2011, at 18:00, Mattheis, Erik (MIN-WSW) wrote: I have a typical tabbed layout and am trying to figure out the simplest/best way to reset the focused state on the focused tab when another is clicked. Classes: Tab - contains graphics and a public variable referencing the MovieClip of the over state. Header - creates tabs, adds event listeners, contains array of references to tabs and a function to loop through them and remove the over state child. Is there a better way - to somehow add an event listener to each tab listening for a click on each other tab? Even if I don't know how many tabs there will be? _ _ _ Erik Mattheis | Weber Shandwick P: (952) 346.6610 M: (612) 377.2272 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= Geografiek is een in Utrecht gevestigd kartografisch bureau Willem van den Goorbergh is telefonisch bereikbaar onder nummer 030-2719512 of mobiel: 06-26372378 Per fax is Geografiek bereikbaar onder nummer: 030-2719687 postadres: Hooghiemstraplein 89 3514 AX UTRECHT Bezoek onze website op: www.geografiek.nl twitter: @wvdgoorbergh =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _ _ _ Erik Mattheis | Weber Shandwick P: (952) 346.6610 M: (612) 377.2272 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders