1 / 47

Events

Events. Events are things that happen. Onpress () Videos loaded Mouse click. Event Handlers. Something that runs when a certain event occurs. Open Events.fla. Select the first keyframe of actions layer and f9. Keyboard Control to Character.

eadoin
Download Presentation

Events

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Events

  2. Events are things that happen • Onpress() • Videos loaded • Mouse click

  3. Event Handlers • Something that runs when a certain event occurs.

  4. Open Events.fla

  5. Select the first keyframe of actions layer and f9

  6. Keyboard Control to Character • 1st thing to do is to add an event listener. Tells an object to wait for a particular event to happen. • Set the keypress to the stage and not the boarder..

  7. Add EventListener

  8. Event to listen for is called Keyboard Event

  9. Inport Line of Code-- Access

  10. Calling a function

  11. Creating a function

  12. Evt—represent the event the occurred.. Data sent to the function when a key is pressed.

  13. DatatypeKeyboardEvent

  14. Line of code

  15. Void and Curley Braces

  16. Inside curley braces is what happen with a key press

  17. Move the skateboarder

  18. Test movie and press any key

  19. Explain Event listener– connect event Event And c command

  20. Conditions– Programs that think and make decisions. • Open Conditions.fla

  21. Test the code all keys will make boarder move to right

  22. If a condition is met run a block of code First frame f9

  23. Explain code

  24. Conditional statement to check which key was pressed

  25. () and {} wrapping or nesting

  26. Code cleanup

  27. If the key was press was RIGHT Talk about evt

  28. keyCode

  29. == is compare is equal to = set a value is assign

  30. Move to right

  31. Test

  32. Make Left

  33. Right and left at same is a conflict

  34. Testd

  35. Neither

  36. Test

  37. Another way… Select the if block and delete

  38. Delete

  39. Switch case Check the value of the keycode and do different things based on the value.

  40. Case and value

  41. IF true tell flash what to do

  42. Stop looking for different options: break;

  43. Test

  44. Copy the case lines

  45. Test

  46. All other keys

  47. Test

More Related