What you are trying to do would not work as far I as know.
What you shoud be doing is creating an eventListener in myComp1 like below.

<mx:Metadata>
    [Event("changeSelection")]
</mx:Metadata>

Then pass that event to the main app using
dispatchEvent({type:"changeSelection", variables});

Your function changeStack should be in the mainApp.

In your main app, you should be able to consume this event.

Maybe there are better ways using delegates. But this should get you started.
I suggest you read the "Developing Flex Applications" help doc.

Sree


Ghislain Simard wrote:
How can I connect back to a another stack component in the main
app...see the code inside the function changeStack.  The id called
vsl is not recognized.

Thanks

main.mxml
<mx:Application....
....<mx:Panel>
        <mx:ViewStack id="vsl">
           <comp:myComp1 id="myComp1"/>
           <comp:myComp2 id="myComp2"/>
        </mx:ViewStack>
     </mx:Panel>

myComp1:
<mx:VBox....
    <mx:Script...
        function changeStack():Void{
           vsl.selectedChild = ???? //doesn't know what is vsl!!
        }

--- In [email protected], "Ghislain Simard" <[EMAIL PROTECTED]>
wrote:
> I'm inside a component, trying to get access to another component
and
> passing a value at the same. Any idea?
>
> main.mxml
> <mx:Application....
> ....<mx:Panel>
>        <mx:ViewStack id="vsl">
>           <comp:myComp1 id="myComp1"/>
>           <comp:myComp2 id="myComp2"/>
>        </mx:ViewStack>
>     </mx:Panel>
>
> myComp1:
> <mx:VBox....
>    <mx:Script...
>        function changeStack():Void{
>           vsl.selectedChild = ???? //doesn't know what is vsl!!
>        }






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




Reply via email to