Besides the compiler checking, specifying the return type is also good when you
write code - enforces you to return the correct type and code correctly. Also
helps apps like FlashDevelop know what the method returns, so great with
code-hinting.
Jason Merrill
Bank of America Global Learni
If I remember correctly, in AS2, you need to write a complete function
signature including the scope.
Try including the scope on the functions that stopped working when you added
:Void
*public* function fName():Void {
gotoAndPlay(2);
}
You can choose between internal, private, protected or
void is good when you compile - if your method does not return something and
you try to return something from the method, your compiler will complain
which is good:
private function foo():void {
return true;
}
// 1051:Return value must be undefined.
Also, if you define something being returne
Karl DeSaulniers wrote:
> Using AS2.
> When is it best to use the :Void ? and what is the difference between
> that and :void ?
You use void when a function doesn't return anything. In fact, there are
some languages, like Pascal and, I believe, Fortran, that have that built
in. In Pascal, a funct
That is what I figured.
Then why would my function not fire the gotoAndPlay when there was
a :Void and would when removed??
This isn't a bug is it? I mean were talking about a simple
function fName():Void {
gotoAndPlay(2);
}
Not working and a
function fName() {
gotoAndPlay(2)
Let's say I wanted to do something like this...
trace("Taka " + getLastName("Taka"));
function getLastName(firstName:String):String{
if(firstName == "Taka"){return "Kojima";}
else{return "";}
}
That function returns a String. Having a gotoAndPlay() inside a function is
not a return value.
Hope
ly 2009 4:30 p.m.
To: Flash Coders List
Subject: Re: [Flashcoders] To Void or not to void?? That is my
question..
Thanks for the quick response Taka,
So what contitutes a return?
I have used the :Void on functions that had a gotoAndPlay() inside it
and it didnt work.
But if I removed the :Void, i
Thanks for the quick response Taka,
So what contitutes a return?
I have used the :Void on functions that had a gotoAndPlay() inside it
and it didnt work.
But if I removed the :Void, it did!?!
Karl
On Jul 13, 2009, at 11:18 PM, Taka Kojima wrote:
:Void is AS2, and :void is AS3
The defin
:Void is AS2, and :void is AS3
The definition of void is "nothingness: the state of nonexistence"...
The syntax of functionName():void{} simply states that the function returns
nothing... i.e. there is no return at the end of the function.
Although specifying a :void return type is not necessary
9 matches
Mail list logo