i merged two threads lost :beam:
*Originally posted by ahmed *
**i merged two threads lost :beam: **
ohhh… now it all makes sense:sleep:
overloading would have been nice :-\
shibby shibby sweet ahmed! thanks for the link, this should be a dozy!
*Originally posted by senocular *
**overloading would have been nice :-\ **
yup… I though now that AS 2.0 supports strict datatyping, I was quiet confident overloading would be supported, but nooo, actionscript can’t be perfect
I merged the threads…
*Originally posted by ahmed *
**yup… I though now that AS 2.0 supports strict datatyping, I was quiet confident overloading would be supported, but nooo, actionscript can’t be perfect**
whats over loading? and, there will be an AS 3.0
http://www.macromedia.com/
nice :snug:
*Originally posted by mdipi.com *
**whats over loading? and, there will be an AS 3.0**
Basically, what overloading lets you do i have a class with two identical member function whos names are the same, but they take different types of arguments… look at the code below and see if that helps
class MyClass
{
function tracetype ( argument:String )
{
trace ( 'the string you entered is: \'' + argument + '\'')
}
function tracetype ( argument:Number )
{
trace ( 'the number you entered is: \'' + argument + '\'')
}
}
If overloading was supported, if you say
MyInstance = new MyClass();
MyInstance.tracetype( 'mike' );
would call the tracetype function that takes in strings and not numbers, and hence will output ‘the <b>string</b> you entered is ‘mike’’… but since overloading is not supported, that script would throw many errors on defining a function twice in your code
hope that helps
Wow I never knew anything like that existed. That would be nice to be able to do that in AS… bastards!
Maybe in the future :shrug:
*Originally posted by reverendflash *
**They are doing a demonstration of it and ActionScript2 @ MM :
MEETING TIME
Wednesday, September 3, 2003
6:30 PM Reception
7:00 PM Presentation Begins
MEETING LOCATION
Macromedia Headquarters, 1st Floor Conference Room
600 Townsend Street (corner of 7th Street),
San Francisco 94103
If I weren’t out of town that day, I’d go…
Rev **
They are also doing 1 in Fresno, CA along with giving away Studio MX 2004.
Here is the site with details. http://www.ccmmug.org/
I plan on attending.
ahmed :thumb:
i dont understand it but one day :thumb:
lol… i knew you wouldn’t
mdipi:
Ok… how a function works…
function name() - creates a function
function name(arguments) - creates a function where you use arguments within it… for example… [AS]function move(x, y){
//using the x argument
clipInstanceName._x = x;
//using the y argument
clipInstanceName._y = y;
}
//example usage
move(250, 200);
//it would move the clip to the coords (250, 200)
}[/AS]
Now time for ahmeds functions… [AS]function tracetype ( argument:String )
{
trace ( ‘the string you entered is: ‘’ + argument + ‘’’)
}
function tracetype ( argument:Number )
{
trace ( 'the number you entered is: '' + argument + ''')
}[/AS]
Take careful note that both the function names are exactly the same (tracetype). But as you see, the arguments are written differently. One says argument:String and the other says argument:Number. So if this were to actually work, if you call the function and have a string as the argument example (tracetype(“mike”)) then the function with the argument:String as an argument variable will be called, but if you called the function with a number as the argument value (tracetype(255)) then the function with the argument:Number as an argument variable would be called instead of the one with argument:String.
nice explanation…
thanks for clearing up my point
Sorry if this sounds dumb, but wouldn’t that just be like creating 2 seperate functions anyway, just giving them the same name? Is there really a point to it or am I missing something?
ok i get it now. lost is good at explaining things :thumb:
twitch: say if you didnt know if it were a string or a number, but you wantted your function to stay the same for both you would use that. am i correct? i think thats what you would use it for.