function getGroceries() { trace("Milk"); trace("Eggs"); trace("Bacon"); trace("Suger"); trace("Watermellon"); } getGroceries(); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Function: Passing Parameters //The trace withing the funtion is function getGroceries(myItem1:String,myItem2:String,myItem3:String,myItem4:String,myItem5:String) { trace(myItem1); trace(myItem2); trace(myItem3); trace(myItem4); trace(myItem5); } getGroceries("Cereal","Milk","Eggs","Bacon","Pancakes"); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function: Returning Values function getTotal():Number // I tell flash that this function will return a number value after it's ran by using :Number. { var steak:Number = 4.99; var chili:Number = 1.99; return steak + chili; // Always return a value from your functions. Even if it's a booleon. The "return" grabs the outputted data from the function. } // To display the value of the getTotal function simply place the function into a trace(); statement trace(getTotal()); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |