tags:

views:

1376

answers:

1

Hi All,

Im new to this flex. can anybody solve my problem.This is my query- i have home page divided into 3 part like top,left,middle positon. in middle postion -panel and combobox are there. i want to load my module to the middle positon like to panel. i have combobox, when i selected any item based on that im loading module to that panel using Custom moduleloader control.uptohere its working fine. my probelm, i selected one option from combobox. its showing the one module(sam1). when i click(sam1),it should open anothermodule(sam2) in same location(instead of sam1-sam2).so can u tel ur idea and how to resolve it.plz.

A: 

It sounds like what you need is to put all the modules into a ViewStack. Then you have a choice:

  • You can simply bind to an index in the combobox (or an index specified by the combobox data like I have in the example below).
  • You can pickup the change event of the ComboBox and manually change the selectedChild of the ViewStack.
  • You can

Something like:

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&gt;

    <mx:Script>
        <![CDATA[
            [Bindable]
            public var modules:Array = 
                [ {label:"Module A", moduleIndex:0}, 
                  {label:"Module B", moduleIndex:1}, 
                  {label:"Mobule C", moduleIndex:2} ]);
        ]]>
    </mx:Script>

    <mx:ComboBox dataProvider="{modules}" id="modulesCombobox" />

    <mx:ViewStack id="modulesViewStack" creationPolicy="auto" 
            selectedIndex="{modulesCombobox.selectedItem.moduleIndex}">

        <mx:ModuleLoader id="moduleA" url="{'views/ModuleA.swf}" /> 
        <mx:ModuleLoader id="moduleB" url="{'views/ModuleB.swf}" /> 
        <mx:ModuleLoader id="moduleC" url="{'views/ModuleC.swf}" /> 
    </mx:ViewStack>
</mx:Application>
Richard Szalay