Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Flex > Flex 2, 3 & 4

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-02-2006, 03:01 PM   #1
ljonny18
Registered User
 
Join Date: Oct 2006
Posts: 112
Default Flex 2 Component communication

Hi I am having trouble in my Flex 2 application in terms of calling a function of a component from another component etc….

I have in my main MXML file an “ApplicationControlBar” containing a “LinkBar” that is populated by a “ViewStack” as shown:

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comps="components.*" layout="vertical">

<mx:ApplicationControlBar id="acb" dock="true">
<mx:LinkBar id="menu_lb" dataProvider="menu_vs"/>
</mx:ApplicationControlBar>

<mx:ViewStack id="menu_vs" resizeToContent="true" width="100%">
<comps:homePage id="home_page" label="Home Page"/>
<comps:menu1 id="menu_1" label="Menu 1"/>
<comps:menu2 id="menu_2" label="Menu 2"/>
<comps:menu3 id="menu_3" label="Menu 3"/>
</mx:ViewStack>

</mx:Application>


I want to have a Button that is within the “homepage” component which when is “clicked” calls a function (testFunc() etc) that is in the “menu1” component…

If the button was within the main MXML application file (as shown above) I could add the button which works fine and how is expected:

<mx:Button label=”go to menu1” click=”menu_1.testFunc()”/>

Although if I put this button in the “homePage” component then I get the error:

1120: Access of undefined property menu_1

as it is not defined within this component etc….

is there a way of communicating to the route application file to get this to work… e.g. I have tried things such as:

click=”parentDocument.menu_vs.menu_1.testFunc()” etc…….

but have had no joy

Can anyone tell me how to get my button click to navigate to / run the testFunc() within a different component in the viewStack……


Thanks,
Jon.
ljonny18 is offline   Reply With Quote
Old 11-06-2006, 04:36 PM   #2
flexy
Everything about me's...
 
Join Date: Aug 2006
Location: UK
Posts: 198
Default

I think this might have been answered here
flexy is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
List Component Flex 2 Beta 3 AS3 Anunnakispirit Flex 2, 3 & 4 5 10-10-2007 04:57 PM
removeMovieClip() not work for components? djandrew Components 30 08-03-2007 04:51 PM
Passing variables between MXML files / components - Flex component communication ljonny18 Flex 2, 3 & 4 4 10-27-2006 04:54 PM
Flex Paypal shopping cart component scale? mattyanimator Components 2 08-26-2006 05:31 PM
Help, Component LivePreview in Flex? astgtciv Flex 2, 3 & 4 0 06-28-2006 11:26 AM


All times are GMT. The time now is 11:59 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.