Thank you Oscar!  That code is exactly what I needed. This is a 
wonderful example why I love this list.  Thanks for sharing your 
expertise with us newbies.  

--- In flexcoders@yahoogroups.com, "Oscar" <[EMAIL PROTECTED]> wrote:
>
> 
>     This can probably help you:
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
> <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
> <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
> <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 flexcoders@yahoogroups.com, "Wally Randall" <wally.randall@>
> 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 
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:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

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