You need to create a function that specifies the type of its arguments, as well as its return type.
Use the function keyword and type identifiers to create a function that takes and returns a typed value.
function foo(bar:String):Void
{
trace(bar);
}
foo("hello");
function foo(bar:String):void
{
trace(bar);
}
foo("hello");
Note: We specify the return type as void, which means that the function does not return a value.
Also note that in ActionScript 3 the usage is void, and not Void as in ActionScript 2.
If you try to call the function in ActionScript 3 and pass it a Number instead of a String, you will get an error.