Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Actionscript Function with Value Send Into

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

This ActionScript function is bit more complicated when compared with the previous example. However the function syntax is almost the same. In this ActionScript function tutorial, two values are sent to the function to process. The whole process is better to illustrate with the following diagram.

ActionScript function tutorial

Flash ActionScript Codes:

// Create a custom function
// The name of function is displayMyAge
// Two values (one is String and one is Number) will be
// sent into the function to process when being called
// The function will not return a value, therefore use void for the Return Data Type
function showMyAge (myName:String, myAge:Number):void {
// The codes below will be executed when being called or run
// The parameter myName (String) will be act as a variable that equal to "Alex"
// The parameter myAge (Number) will be act
output_txt.text = "My name is " + myName + ". I am " + myAge + " years old.";
}

 

// Run or call the function with the function name (displayMyAge)
// Two values ("Alex" and 25) are sent to the function when run
// These two values must match the data type of the Argument parameters
// specified in the function
showMyAge ("Alex", 25);

Download Flash Source File:

Flash Source File functions-with-value-send-into.fla

Remarks:

For ActionScript function with values send to the function to process, the Argument parameters of the function must be matched with the values send into.