AS3: Performance question calling an event function with null param
Posted
by adehaas
on Stack Overflow
See other posts from Stack Overflow
or by adehaas
Published on 2010-05-07T08:28:48Z
Indexed on
2010/05/07
10:38 UTC
Read the original article
Hit count: 161
Lately I needed to call a listener function without an actual listener like so:
foo(null);
private function foo(event:Event):void
{
//do something
}
So I was wondering if there is a significant difference regarding performance between this and using the following, in which I can prevent the null in calling the function without the listener, but am still able to call it with a listener as well:
foo();
private function foo(event:Event = null):void
{
}
I am not sure wether it is just a question of style, or actually bad practice and I should write two similar functions, one with and one without the event param (which seems cumbersome to me).
Looking forward to your opinions, thx.
© Stack Overflow or respective owner