rex
rex

Reputation: 1023

Actionscript MouseEvent

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

Upvotes: 1

Views: 282

Answers (3)

shannoga
shannoga

Reputation: 19879

When you call the function simply insert null in the braces

Like that-

CallEvent(null);

Upvotes: 0

Eugene
Eugene

Reputation: 2216

from this:

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

Upvotes: 0

Robusto
Robusto

Reputation: 31913

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");
}

Upvotes: 1

Related Questions