Flashadvisor logo
:: Desktop Shortcut
:: Flash Help
Advices from Experts

 Submit Here! · Link to Us · Newsletter · Tell a Friend ·

      Add Tutorial |

 

Advertise here










 

Google

Search WWW   
FlashAdvisor.com

 Home > Tutorials  > ActionScript

Flash Actionscript Programming Basics

Author: steve happ | Email
Website : www.video-animation.com


Advertisement



Functions in AS 2.0



Functions in AS 2.0 are a little different. AS 2.0 allows the setting of specific datatypes.
Here is an example :


Function avgReturn(arg1:Number):Number{
Var num = arg1 * 5;
return num;
}

The template for an AS 2.0 function could be :

Function functionName(arg1:DataType,
arg2:DataType):ReturnType{
// statements go here
return something ;
}


Void is used to specify that there is no return type. E.g.

function noReturn(arg1:Number,
arg2:String):Void{
trace(arg2+" is a string and "+arg1+" is a number");
}
// call function
noReturn(5,"Steve");




| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 |

Rate This Tutorial :
We hope the information helped you. If you have any questions or comments, please don't hesitate to post them on the Forums section
Submit your Tutorial at Click Here
  

Home | About Us | Contact Us | Feedback | Advertise with us

Best viewed in 800x600 resolution with Internet Explorer.

Site Developed and Hosted by  ethicsolutions.com
All rights reserved with FlashAdvisor

Flash is a registered trademark of Adobe Systems, Inc.

1 user online