Community Page
- www.apueee.com Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- simply cool !
- Very refreshing. Most of us are too busy with our jobs and personal life that we tend to forget watching our favorite sport of choice.
- Nice! Sleek looking with decent features. Now what's left is the price, how much did it cost you Tarek?
- Hi , this script not run when web page having vertical scrollbar when we scroll the vertical scroll at down position and drag element at leave distance please remove offset.....
- Great information you shared through this post. Thanks.
Jump to original thread »
adding custom event in as3 can make life easy. Sometime it needs to set root variable from different class or need to call root function for a specific application. Its better to use custom event than using “root” in class. Its easy to trigger and also can be listen from anyw
... Continue reading »
3 months ago
Oh yeah, this custom Event can do something like accessing other movieclip object that have linkage with a class, can it?
3 months ago
Thanks for ur comment.
The following code need to write where you want to call the event. first u need to import the custom event class. then u need to call the dispatchEvent method to call ur custom event. This is not a part of myCustomEvent Class. Here you just using the myCustomEvent class. :)
**************
import wneeds.events.myCustomEvent; //import ur class here
dispatchEvent(new myCustomEvent("Hello ...")); // call your custom event.
*******************
To track the event in any where of ur code u need to put the following code:
**********
addEventListener("myCustomEvent", showMessage);
function showMessage(e:myCustomEvent):void {
trace(e.myMessage);
}
*********************
I'm not clear about your last question. Do you want to call a event from a movieclip and receive the event from main timeline?
3 months ago
2 months ago
great tutorial, i got it so far working as i can send the one var back to e.myMessage
But when i try you example line with multi values , i get stuck and only get erros.
can you make a example how the myCustomEvent class needs to look if i
dipatch this message.:
dispatchEvent(new myCustomEvent({Amode:'tma',SID:this.SID,MYID:this.MYID,PRID:this.PRID,TYP:this.TYP}));
where SID, MYID,PRID,TYP are all byte arrays.
Best regards Oliver
2 months ago
Thanks for ur comment.
Have u changed at myCustomEvent ? in myCustomEvent class i have set the type of myMessage as string. But you are passing the message as object. So its need to change the myMessage as Object or u can set * for any type.
package wneeds.events{
import flash.events.Event;
public class myCustomEvent extends Event {
public var myMessage:*;
public function myCustomEvent(msg) {
super("myCustomEvent");
myMessage = msg;
}
}
}
Try it . i think it should work.