Week 9: Intro to Actionscript Review

Using what we learned in last week’s Practical, complete the following assignment.

Create a new file and call it, “intro-review.fla”

  • Set up your actions layer and open the actions panel
  • Create a function that accepts 2 number parameters and returns a number value
  • Name the function addTenTimes
  • Name the parameters num1 and num2
  • Inside the function block (aka the curly braces), create a new variable called total which will be set equal to the sum of the first parameter, num1 and the second parameter, num2.
  • So now we have the sum of the two parameters stored inside the variable total, but we called the function addTenTimes, so we should actually do that.
  • So next try on your own to add the value of num2  to the total the remaining nine times
  • When you have the final value return it back out of the function using the return statement
  • Now that you have the function created call the function, but remember it is returning a number value so you should catch that value as well by storing it in a variable. You can call this variable myFunctionResult
  • Lastly, trace the value of  myFunctionResult so that when you test the movie the value is displayed in the output window

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>