Ghislain,

There are a number of different ways of doing this, both covered in
"Developing Rich Clients with Macromedia Flex".  Crudely, you could
refer to mx.core.Application.application.vs1 
(mx.core.Application.application is a static reference to the top-level
of your app).

Alternatively, you can pass a reference down to myComp1, eg:

<mx:ViewStack id="vs1">
  <comp1:myComp1 parent="{this}" />
   : : :
</mx:ViewStack>

And then declare in myComp1.mxml:

<mx:Script>
<![CDATA[

        public var parent;
]]>
</mx:Script>

and then within myComp1.mxml, you can refer to parent.vs1

It's a matter of personal style which you choose ... as your application
scales, you'll likely require a strategy to manage location of all these
different view components.

Steven

--
Steven Webster
Technical Director
iteration::two
 
This e-mail and any associated attachments transmitted with it may contain
confidential information and must not be copied, or disclosed, or used by
anyone other than the intended recipient(s). If you are not the intended
recipient(s) please destroy this e-mail, and any copies of it, immediately.
 
Please also note that while software systems have been used to try to ensure
that this e-mail has been swept for viruses, iteration::two do not accept
responsibility for any damage or loss caused in respect of any viruses
transmitted by the e-mail. Please ensure your own checks are carried out
before any attachments are opened.

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ghislain Simard
Sent: 24 July 2005 20:23
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: accessing a different component once inside one of
them

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 flexcoders@yahoogroups.com, "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



 




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

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