|
Mailing Lists
|
Home /
Groups /
Adobe Flex
sharing data between two different components
Author: mojtaba tabatabaie
Short Link: http://www.houseoffusion.com/groups/flex/thread.cfm/threadid:2151#6549
hi , again problem in sharing data! I now know how to share data between
components and the main application . I wanted to use the same technique to share
data between two different components but id doesn't work .
I have a component named "signIn_Up2" and another named " BookView" I assign the
"username" property in "signIn_Up2" and I want to use that property in "BookView"
.and the actionscript class is named "LoginEvent.as" which has two public
variables named "username" and "password". I wrote these codes:
<!-- signIn_Up2 component -->
....
<fx:Metadata>
[Event(name"login",type="events.LoginEvent")]
</fx:Metadata>
.....
<fx:script>
.....
public function somefunction():viod{
var e:LoginEvent = new LoginEvent("login");
e.username = "my UserName";
e.password = "my Password";
dispatchEvent(e);
}
...
</fx:script>
<!-- BookView component -->
<fx:script>
public var myEvent:LoginEvent;
...
public function creationComplete():void{
sometextinput.text = myEvent.username;
}
...
</fx:script>
I expect the textinput to show the "my UserName" value that I have assigned in
"signIn_Up2" component in LoginEvent class . but it doesn't show that .
can anyone tell me where the problem is?
thanks
|
June 19, 2013
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||