Re: Parent View States Control Child Component View States

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Parent View States Control Child Component View States

Bruce Denham
Rather than setting up some kind of binding mechanism to the view
state, which still may be better (don't know), I'm doing something
like this, in which a Presenter (controller) puts the View in one of
its view states (using a public method defined on the View's
interface), and the parent loops through its child components to set
their view states to match.

// VIEW STATE Setter -- Called by Presenter to change view state for user
       public function setViewState(state:String):void
            {
            //Sets parent's view state
            this.currentState = state;
           
            //Parent controls child component view states
            // TODO: Make recursive to get through various wrapper components
            var children:Array=this.getChildren();
            for (var i:String in children)
            {
            children[i].currentState = this.currentState;
            }
            }

Using this technique, the children would have to define the same view
states as the parent.

Is there a cleaner way? Is this unnecessarily processor intensive?
Please let me know.  

Thanks,
Bruce





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[hidden email]
    mailto:[hidden email]

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/