Note that there are some explanatory texts on larger screens.

plurals
  1. POflex 3 passing data from modules to parent application to switch views in the viewstack
    primarykey
    data
    text
    <p>Hello Fellow stackoverflowers,</p> <p>I´m stuck writing a piece of code. I have application with a viewstack witch load 5 modules. each module is loaded via the moduleLoader tag and they all have an id.</p> <p>Every loaded module has a context menu. the context menu has 5 menuItems. one menuItem for each view for the viewstack.</p> <p>The context menu is loaded via xml.</p> <p>this is my application file.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#b1b1b1" backgroundGradientColors="[#b1b1b1,#252525]"&gt; &lt;mx:Script&gt; &lt;![CDATA[ import mx.core.Container; //change viewstack views via modules context menu public function switchView(viewId:String):void { var container:Container = Container(tops.getChildByName(viewId)); if (container != null) { tops.selectedChild = container; } } ]]&gt; &lt;/mx:Script&gt; &lt;mx:ViewStack id="tops" width="100%" height="100%"&gt; &lt;mx:ModuleLoader id="admin" url="view/admin.swf" width="100%" height="100%"/&gt; &lt;mx:ModuleLoader id="tv" url="view/tv.swf" width="100%" height="100%"/&gt; &lt;mx:ModuleLoader id="community" url="view/community.swf" width="100%" height="100%"/&gt; &lt;mx:ModuleLoader id="shop" url="view/shop.swf" width="100%" height="100%"/&gt; &lt;mx:ModuleLoader id="communicator" url="view/communicator.swf" width="100%" height="100%"/&gt; &lt;/mx:ViewStack&gt; &lt;/mx:Application&gt; </code></pre> <p>and this is my switch statement in my Module</p> <pre><code>public function changeView():void{ switch(action) { case "admin": parentApplication.switchView("admin"); break; case "tv": parentApplication.switchView("tv"); break; case "shop": parentApplication.switchView("shop"); break; case "community": parentApplication.switchView("community"); break; case "default": parentApplication.switchView("communicator"); break; } } </code></pre> <p>and this is my context menu xml</p> <pre><code> &lt;mx:XML id="appMenu"&gt; &lt;root&gt; &lt;menuitem enabled="false"/&gt; &lt;menuitem label="Administration" action="admin" icon="adminMDI"/&gt; &lt;menuitem label="Television" action="tv" icon="tvMDI"/&gt; &lt;menuitem label="Community" action="community" icon="communityMDI"/&gt; &lt;menuitem label="Shopping Mall" action="shop" icon="shoppingMallMDI"/&gt; &lt;menuitem label="Communicator" action="default" icon="communicatorMDI"/&gt; &lt;/root&gt; &lt;/mx:XML&gt; </code></pre> <p>What i would like to do is switch the views in the viewstack by clicking on one of the menuitems in the context menu. i can't communicate from my module to the application. What am i doing wrong? what must i do? Can anybody help me out?</p> <p>Oyeah before i forget </p> <p>the xml of the context menu is in the module but, the context menu is in a as file that extensiate a button.</p> <p>please can any body give me a good example how to accomplish this.</p> <p>Thank</p> <p>DJ</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload