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!?!


On Jul 13, 2009, at 11:18 PM, Taka Kojima wrote:

: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 in AS3, it is
considered best practice to include it. I believe it will generate warnings
if you don't.

In AS2, it really doesn't matter if you do :Void after functions.

The reason this syntax exists is to make it easy for compilers to easily identify problems in regards to object types, i.e. if you're trying to use the return value of a function as a MovieClip when it should really be an Array, or void. It also makes it easier for you to see what type of value
the function is returning just by looking at the top of the function

- Taka

On Mon, Jul 13, 2009 at 9:07 PM, Karl DeSaulniers <>wrote:

Using AS2.
When is it best to use the :Void ? and what is the difference between that
and :void ?
I have a somewhat understanding of what each are,
I am asking more to "you" (The List) as a programers, what is the best case
scenarios to use these things?
What are the advantages and why use them if say, your function works
without them?
I know that the Void is a Boolean, but I also know you cant use it when the
statement returns something.
Does this "return" include any of the basics like gotoAndPlay? or does it
literally mean a return(); ???

Thanks for any clarification anyone can give me.


Karl DeSaulniers
Design Drumm

Flashcoders mailing list

Flashcoders mailing list

Karl DeSaulniers
Design Drumm

Flashcoders mailing list

Reply via email to