flex - Mate Dispatcher tag -
I have to pass a variable in the dispatcher tag ... for example
var Google: EventName = New Event Name (EventName.ADD_User, User); DispatchEvent (Google);
Now when I go to the Mate Dispatcher tag ... How can I pass value to the user?
& lt; Mate: Dispatcher id = "mydispatcher" generator = "{EventName}" type = "{EventName.ADD_User}" & gt; & Lt; Friend: eventProperties & gt; & Lt; Friend: Event Properties myProperty = "myValue" myProperty2 = "100" /> & Lt; / Friend: eventProperties & gt; & Lt; / Friend: Dispatcher & gt;
How can I pass the user in the matte dispatcher tag now?
You must declare the user as the property of your GoogleEvent.as class. For GoogleEvent.as:
package extends {public class GoogleEvent event {public static contact ADD_User: String = "GoogleEvent_AddUser"}; Public users: string; Public event GoogleEvent (type: string, bubbles: boolean = true, cancellable: boolean = false) {super (types, bubbles, cancellable); }}}
and in your event announcement:
var google: GoogleEvent = new GoogleEvent (GoogleEvent.ADD_User); Google.user = "My User Name"; DispatchEvent (Google);
Then to get the value of the user from your event in your event map:
& lt; EventHanders type = "{GoogleEvent.ADD_User}" & gt; & Lt; Anti-Generic Generator = "{MyTargetPresentaionModel}" method = "DoSomething" argument = "{[event.user]}" /> & Lt; / EventHandlers & gt;
Let me know if you have any questions, I hope it helps!
Comments
Post a Comment