I got it figured out. I changed my menuHandler function to this.

  private function menuHandler(event : MenuEvent) : void {

     parentApplication.mainDisplay.currentState = [EMAIL PROTECTED];
    }

works like a charm now. Thanks for the help on this TH and rob


--- In [email protected], "Jeremy Rottman" <[EMAIL PROTECTED]> wrote:
>
> Maybe I didnt post this correctly.
> 
> Here is how it should work. My main mxml file displays my menubar and
> my state manager. I have an action script file that goes with my
> menubar. That holds all the xml to populate the menubar and has a
> function that should change the states with in the stateManager file. 
> 
> Here is that function.
> 
>   private function menuHandler(event : MenuEvent) : void {
> 
>    currentState = [EMAIL PROTECTED];
>     }
> 
> If I was doing this on the parentApplication level I would use
> something liek this.
> 
> parentApplication.currentState = 'Blah' or whatever.
> 
> But to better organize my application, I have split the stateManager
> into a seperate file. The issue is I cant get the menubar to change
> the state inside my stateManager file. 
> 
> I have my main mxml file that holds my application tag
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> xmlns="*"
> xmlns:widgets="components.widgets.*"
> xmlns:stateManager="components.managers.*" layout="absolute">
> 
> 
> 
> <!-- SEARCH WIDGET -->
> <widgets:widgetSearch x="0" y="0"  />
> 
> <!-- MENU BAR WIDGET -->
> <widgets:widgetMenuBar x="0" y="50" />
> 
> <!-- STATE MANAGER -->
> <stateManager:stateManager x="0" y="94" id="mainDisplay" />
> 
> </mx:Application>
> 
> 
> Then I have my Menu bar widget which contains my menu bar.
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
> creationComplete="initCollections()" width="100%" height="100%">
>       <!-- IMPORT asWidgetMenuBar.as -->
>       <mx:Script source="as/asWidgetMenuBar.as" />
>       
> <mx:MenuBar width="100%" change="menuHandler(event)" labelField="@label"
>     dataProvider="{menuBarCollection}" />
>       
> </mx:Canvas>
> 
> 
> Then I have my State Manager manager that holds all the information
> about the various states I have.
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml";
> xmlns:contacts="components.views.contacts.*"
> xmlns:content="components.views.content.*"
> xmlns:education="components.views.education.*"
> xmlns:marketing="components.views.marketing.*"
> xmlns:reports="components.views.reports.*"
> xmlns:setup="components.views.setup.*"
> xmlns:today="components.views.today.*"
> xmlns:tools="components.views.tools.*"
> xmlns:transactions="components.views.transactions.*" width="100%"
> height="100%" currentState="EditListing">
>       <mx:states>
>               <mx:State name="mainState"/>
>               
>                       <!-- EDIT LISTING STATE -->
>                       <mx:State name="EditListing" id="EditListing" 
> basedOn="mainState">
>                               <mx:AddChild>
>                                       <transactions:viewEditListing />        
>                               </mx:AddChild>                          
>                       </mx:State>
>                       
>                       <!-- EDIT SALE STATE -->
>                       <mx:State name="EditSale" id="EditSale" 
> basedOn="mainState">
>                               <mx:AddChild>
>                                       <transactions:viewEditSale />   
>                               </mx:AddChild>                          
>                       </mx:State>
>                       
>       </mx:states>
> </mx:Canvas>
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/

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

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



Reply via email to