views:

36

answers:

3

I have a MouseEvent function and I need to call it without MouseEvent as well. I know there is quick and easy way to do it but I forgot....

my_mc.addEventListener(MouseEvent.CLICK, callEvent);
function callEvent(e:MouseEvent):void
{
    trace("Mouse event called");
}

callEvent()???

now I need to call the same event without any events. I know I can create a new function without any event an call that from callEvent. But that is not what I am looking for...

Thanks, Rex

+1  A: 

You can do that easily like this (put "= null" after the event arg):

my_mc.addEventListener(MouseEvent.CLICK, callEvent);
function callEvent(e:MouseEvent = null):void
{
    trace("Mouse event called");
}
Robusto
Thanks a lot, I know that I did it little bit different way but this one is even better... :)
rex
A: 

from this:

dispatchEvent(new CustomEvent(CustomEvent.ONLOADED, data ));

Eugene
A: 

When you call the function simply insert null in the braces

Like that-

CallEvent(null);

shani
hummm I think that is what I use to do.... Thanks, a lot....
rex