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);
}

Working...

This is why I thought I might be missing something about the :Void.
Maybe its something else in my code, but I don't think so.

Here is the code I am working on:
I took Jiri's advice on fixing the function calls on my tweens,
but it either is not firing the function or not firing the gotoAndPlay.
my first thought was that because the other tweens started working after I made the change to the function call,
that this was a :Void culprit.

[code]
var beginAlpha = 0;
var endAlpha = 100;
var quoteShowY:Number = 219.9;
var quoteHideY:Number = -219.9;
this.quoteRequest_mc._x = 354.1;
this.quoteRequest_mc._y = quoteHideY;
this.quoteRequest_mc._alpha = 0;
function formVisible():Void {
        this.quoteRequest_mc.gotoAndPlay("startQuote");
}

function formHidden():Void {
        this.quoteRequest_mc.gotoAndStop(1);
}

function showForm() {
        this.quoteRequest_mc.alphaTo(endAlpha,5,"easeincirc",.5);
this.quoteRequest_mc.ySlideTo(quoteShowY,5,"easeincirc",. 5,formVisible);
}

function hideForm() {
        this.quoteRequest_mc.alphaTo(beginAlpha,5,"easeincirc",.5);
        this.quoteRequest_mc.ySlideTo(quoteHideY,5,"easeincirc",.5,formHidden);
}

Thanks for taking the time to answer my question everyone.

Karl


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

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 helps.

 -Taka

On Mon, Jul 13, 2009 at 9:29 PM, Karl DeSaulniers <k...@designdrumm.com>wrote:

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 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
definition.

- Taka

On Mon, Jul 13, 2009 at 9:07 PM, Karl DeSaulniers <k...@designdrumm.com
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.

Best,


Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 _______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to