This can probably help you:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml" layout="vertical"
 xmlns:local="*" width="500"  height="350">
 <mx:Script>
  <![CDATA[
   private function setEnableB():void{
    compB.setEnabled(true);
    selectViewIndex(1);
   }
   
   private function selectViewIndex(index:int):void{
    bViewStack.selectedIndex = index;
   }
  ]]>
 </mx:Script>

  <mx:LinkBar id="myLinkBar" dataProvider="{bViewStack}"/>
  <mx:ViewStack id="bViewStack" >
   <local:ComponentA id="compA" label="Comp A" clickA="{setEnableB()}"/>
   <local:ComponentB id="compB" label="Comp B" clickB="{selectViewIndex(0)}"/>  
  </mx:ViewStack>
</mx:Application>

 

--------------------
<?xml version="1.0" encoding="utf-8"?>
<!-- ComponentA.mxml-->
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml" width="400" height="300">
 <mx:Metadata >
  [Event(name="clickA")]
 </mx:Metadata>

  <mx:Button label="Enabled Hello World B" click="{dispatchEvent(new Event('clickA'))}" />
</mx:Canvas>

-----------------

<?xml version="1.0" encoding="utf-8"?>
<!-- ComponentB.mxml-->
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml" width="400" height="300"
  >
 <mx:Metadata >
   [Event(name="clickB")]
  </mx:Metadata>
  <mx:Script>
   <![CDATA[
    [Bindable]
    private var _isEnabled:Boolean=false;
    
    public function setEnabled(value:Boolean):void{
     _isEnabled = value;
    }
   ]]>
  </mx:Script>
  <mx:VBox width="100%" height="100%">
  <mx:Button label="Hello B World!" enabled="{_isEnabled}"/>
  <mx:Button label="Change Select Index" click="dispatchEvent(new Event('clickB'))"/>  
   
  </mx:VBox>

</mx:Canvas>

 


--- In [email protected], "Wally Randall" <[EMAIL PROTECTED]> wrote:
>
> There has been a lot of discussion recently about how components
> should talk to each other but no code samples. I have attempted to
> get answers to these questions but noone has provided a coding example:
>
> Application Main includes two sub-components (A and B) which are
> canvases included in the Main viewstack.
>
> 1. The 'A' component needs to be capable of "enabling" a button on
> the 'B' component.
> 2. The 'B' component needs to be able to alter the viewstack index on
> Main.
>
> How should these two problems be coded?
>
> Thanks for your patience.
>

__._,_.___

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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to