PDA

View Full Version : AS3 Global function silly questions



pixeldude
May 14th, 2009, 12:31 AM
Hi everyone.....

I'm try to calling my sloppy global function by calling my global function class as u can see below




package{

public class GlobalFunc{

public static function someFunc():void{
trace("some global function");
}

}

}



My problem is why it's thrown undefined underneath the trace statement...

//some testing

trace(GlobalFunc.someFunc());

//output
some global function
undefined-->why???

Hope someone can lighting me up on this...tq in advanced..

Tq

Krilnon
May 14th, 2009, 01:00 AM
It's because you're tracing something inside of the function and then attempting to trace the return value, which is void, and void traces as undefined.

pixeldude
May 14th, 2009, 01:47 AM
It's because you're tracing something inside of the function and then attempting to trace the return value, which is void, and void traces as undefined.

Tq Krilnon....