RE: [Flashcoders] To Void or not to void?? That is my question..

2009-07-14 Thread Kerry Thompson
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

Re: [Flashcoders] To Void or not to void?? That is my question..

2009-07-14 Thread Eric E. Dolecki
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

Re: [Flashcoders] To Void or not to void?? That is my question..

2009-07-14 Thread Joel Stransky
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

RE: [Flashcoders] To Void or not to void?? That is my question..

2009-07-14 Thread Merrill, Jason
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

Re: [Flashcoders] To Void or not to void?? That is my question..

2009-07-13 Thread Taka Kojima
: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

RE: [Flashcoders] To Void or not to void?? That is my question..

2009-07-13 Thread Barry Hannah
Karl, a function returns something if you include a line return value at the end of the function... For example, if you had a function that returned a random number below 100: function giveMeARandomNumberBelow100():Number { var myRandomNumberBelow100:Number = Math.random() * 100;

Re: [Flashcoders] To Void or not to void?? That is my question..

2009-07-13 Thread Taka Kojima
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 that