Hey Eric, thanks for the fast reply, I really appreciate the help.
eric e. dolecki wrote:
Void or void is used when the method doesn't return a value.
That make sense. :)
So, just to clarify further, if the function returns anything then
assign the function (is this called casting a function?) the datatype of
the return value.
Examples:
--<snip>--
function foo1():String {
return "some-string";
};
function foo2():Void {
...
// returns nothing.
...
};
function foo3():Array {
return myArray;
};
function foo4():Boolean {
return FALSE;
};
function onLoadError(mc:MovieClip):Void {
trace("ERROR CODE = " + errorCode); // Trace the error code.
};
--</snip>--
Question: What happens if your function is complex, and uses if/else
statements to return different types of data? Is there some sort of
generic casted datatype?
function foo( Void):Void
{
Oh, I would have never thought to put Void all by itself as a function
param. Does not look right. I will be sure NOT to do that. :D
video is prob Object - NOT a string.
Ah, ok. So this would be the correct way:
--<snip>--
var theVid:Object = myVideo; // Not tested.
...
theVid.play("foo.flv");
--</snip>--
Again, sorry for noob questions... I only code in flash from
time-to-time, but been using Flash for years. Most of my time is spent
coding PHP/CSS/HTML/JS. Just trying to get my head back into the AS
syntax for my latest project.
Thanks again for your help Eric! :)
Cheers,
Micky
--
Wishlists: <http://snipurl.com/1gqpj>
Switch: <http://browsehappy.com/>
BCC?: <http://snipurl.com/w6f8>
My: <http://del.icio.us/mhulse>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com