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 05-14-2008, 01:38 PM   #1
actionScriptorz
Registered User
 
Join Date: Apr 2008
Posts: 13
Default is communication between two MXMLs possible?

i'm trying to make 2 pages communicate each other similar to XSL's "parameter" property. I want to make it so that when i click something, the action will apply to not just the mxml that the "something" was click, but also apply to other mxml pages/components?

thanks in advance
actionScriptorz is offline   Reply With Quote
Old 05-14-2008, 05:29 PM   #2
dr_zeus
Feathers
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999
Default

Events are the natural way to communicate between components.
__________________
Josh Tynjala | Feathers
dr_zeus is offline   Reply With Quote
Old 05-14-2008, 05:54 PM   #3
actionScriptorz
Registered User
 
Join Date: Apr 2008
Posts: 13
Default

thanks, i tried having an addEventListener in mxml file A

item.addEventListener(ItemClickEvent.ITEM_CLICK, itemClickHandler);

and have the corresponding handler in mxml file B

private function itemClickHandler(event:ItemClickEvent):void
{
Alert.show("Getting click event");

}

its complaining because it cannot find the function itemClickHandler in mxml file A, how can i solve this? should i have the handler method in an as file instead and just have to refer to the script in mxml?
actionScriptorz is offline   Reply With Quote
Old 05-14-2008, 07:37 PM   #4
dr_zeus
Feathers
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999
Default

itemClickHandler is in the scope of B, so that certainly shouldn't be accessible in A.

Generally, its good to use a common parent container C as a mediator between A and B. Something happens in A, so A dispatches an event "somethingHappened". C is listening for A's event. When C receives that event, calls a function on B so that B can respond to whatever happened in B.
__________________
Josh Tynjala | Feathers
dr_zeus 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
Audio Only Communication eb110k Flash Media Server 0 11-27-2007 07:41 AM
flash -> browser communication pkghost ActionScript 2.0 3 07-06-2005 12:12 AM
LocalConnection() needs Flash Communication Server? apodixis ActionScript 2.0 1 05-20-2005 05:08 PM
cursor in communication components uxk8396 Flash Media Server 0 03-26-2004 01:48 AM
Serial/RS232 Communication? Aaron Oz Server-Side Scripting 0 06-11-2003 11:06 PM


All times are GMT. The time now is 03:50 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.