Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modular Functions REVIEW FOR LESSON 7. 1. When you encounter a problem, what’s the first thing you should do? A. If you get a compile error, go to the.

Similar presentations


Presentation on theme: "Modular Functions REVIEW FOR LESSON 7. 1. When you encounter a problem, what’s the first thing you should do? A. If you get a compile error, go to the."— Presentation transcript:

1 Modular Functions REVIEW FOR LESSON 7

2 1. When you encounter a problem, what’s the first thing you should do? A. If you get a compile error, go to the line that contains the error and fix it yourself. B. LOOK AT YOUR NOTES AND TRY TO SOLVE IT YOURSELF C. Ask a neighbor for help. D. Raise your hand and ask the teacher for help.

3 2. Where is the error in this code: box1_mc.addEventListener(MouseEvent.CLICK, scaleMe; box2_mc.addEventListener(MouseEvent.CLICK, scaleMe; function scaleMe(event:MouseEvent):void { event.currentTarget.scaleX -=.1; } A. You can’t have two objects call the same function B. There is a missing semicolon after void C. There is a missing parenthesis after scaleMe D. There is no error

4 3. Which function will take whatever object calls it and place it in a random place on the stage? A. function moveItmoveIt(event:MouseEvent):void { box_mc.x = Math.random()*stage.stageWidth; box_mc.y = Math.random()*stage.stageHeight; } B. function moveItmoveIt(event:MouseEvent):void { box_mc.x = Math.random(500); box_mc.y = Math.random(500); } C. function moveItmoveIt(event:MouseEvent):void { event.currentTarget.x = Math.random()*stage.stageWidth; event.currentTarget.y = Math.random()*stage.stageHeight; } D. function moveItmoveIt(event:MouseEvent):void { currentTarget.x = Math.random()*stage.stageWidth; currentTarget.y = Math.random()*stage.stageHeight; }

5 4. Where is the error in this code: box2_mc.addEventListener(MouseEvent.CLICK, jumpAround); function jumpAround(event.MouseEvent):void { event.currentTarget. x = Math.random()*stage.stageWidth; event.currentTarget.y = Math.random()*stage.stageHeight; } A. MouseEvent.CLICK should be MouseEvent:CLICK B. event.MouseEvent should be event:MouseEvent C. There is a missing parenthesis after scaleMe D. There is no error

6 5. Once box1_mc has been clicked once, what does the following write to the output window? var score:Number = 10; box1_mc.addEventListener(MouseEvent.CLICK, writeToWindow); function writeToWindow(event:MouseEvent):void { event.currentTarget.scaleX +=.1; trace(score); score++; score *= 10; } A. 10 B. score C. 11 D. 110


Download ppt "Modular Functions REVIEW FOR LESSON 7. 1. When you encounter a problem, what’s the first thing you should do? A. If you get a compile error, go to the."

Similar presentations


Ads by Google