You need to create a function that takes an argument and then call it.
Use the function keyword to create a function that takes a variable.
function foo(bar)
{
trace(bar);
}
foo("hello");
function foo(bar)
{
trace(bar);
}
foo("hello");
Note: Unlike in ActionScript 2, in ActionScript 3 if you attempt to call the function without any arguments, you will get an error. For example, he following would throw an error:
function foo(bar)
{
trace(bar);
}
foo();