Flash Interactivity Tasks

 

Buttons:

  1. Simple multi-state button:
    1. create a new button Symbol
    2. make key frames for each state, and draw a different design for each keyframe.
    3. put button on the stage from Library
    4. test!
  2. simple multi-state button with instances:
    1. create new graphic symbol
    2. draw button design
    3. close symbol
    4. create new button symbol
    5. drag graphic into frame 1
    6. copy 1st keyframe for other states
    7. select frame, graphic and change Tint or Alpha in properties inspector
    8. repeat for each state
    9. close button, put button on main timeline, test
  3. animated multi-state button
    1. create new movie clip symbol
    2. draw sequence of keyframes to create animation
    3. close movie clip (MC)
    4. repeat steps 1-3 two more times
    5. create new button symbol
    6. drag MC from library - one MC per state of button
    7. put button on main stage, test
  4. sound on button:
    1. go to findsounds.com , download sound files
    2. import sounds into flash
    3. open button symbol, add new layer, name it sounds
    4. add keyframes for each frame of new layer
    5. select keyframe, go to Properties Inspector, select sound
    6. close button, test
  5. button controlling movie clip
    1. create new MC
    2. create animated sequence of frames in MC
    3. create new layer
    4. select 1st frame of new layer
    5. add action: Stop();
    6. add keyframe on last frame
    7. add action on last keyframe: gotoAndPlay(2);
    8. close MC, add to main stage, give it an instance name in properties inspector
    9. select one of your buttons, add action: on (press){
    10. click target button, select your MC, add script yourmovieclip.gotoAndPlay(2);}
    11. select another one of your buttons, do as above, only gotoAndStop(1);
    12. test your buttons!
  6. Invisible button, invisible movie:
    1. create a new movie clip
    2. leave 1st frame as Blank keyframe
    3. create animated sequence starting on frame 2
    4. add stop action on frame 1, as done above
    5. close MC, create new button
    6. add keyframe on Hit frame, draw shape, leave other frames blank
    7. put both symbols on stage, give MC an instance name
    8. select button, add script: on (rollOver){
    9. target your MC, do yourclip.gotoAndPlay(2);}
    10. do on (rollOut){
    11. target MC, do yourclip.gotoAndPlay(1);}
  7. Sounds off button:
    1. import sounds into flash
    2. add new layer for each sound
    3. add Sound to keyframes of various sound layers
    4. select one of your buttons that has no script, or make a new button, and add script:
    5. on (Press){ stopAllSounds();}
  8. Button to play a sound/stop a sound:
    1. create a new MC
    2. put keyframes on frames 1 and 2
    3. using Property Inspector, set sound to STOP on frame 1, PLAY on frame 2
    4. add stop action on frame 1
    5. put MC on stage, give instance name
    6. make 2 buttons, play and stop.
    7. on play button, make script to play MC from frame 2 (as done above)
    8. on stop button, make script to play MC from frame 1
  9. Button to play a video:
    1. import video
    2. edit/adjust as desired
    3. video will import into a new movie clip. let flash adust the length of the MC to the length of the video
    4. open video MC, add stop script to 1st frame
    5. put MC on stage, give instance name
    6. make button, have it play MC from frame 2
    7. if you don't want 1st frame of video to show before play, open video MC and move video so it starts on frame 2.
  10. Make a draggable button (works for a MC too):
    1. create multi-state button (as above)
    2. make a new MC - put the button into the MC
    3. put the MC on the stage (if you try to do this with a button directly on the stage, the whole stage will be draggable!)
    4. Open the MC, select the button, and add the following script:
    5. on (press){
      startDrag(this);
      }
      on (release){
      stopDrag();
      }

    6. Close MC and test movie!
  11. Test to see if your draggable button intersects another button or MC:
    1. Create draggable button as above
    2. Create another MC. Give it two different frames of graphics. Put a stop(); on frame 1 of the MC. Close MC and put on stage.
    3. Give the button and MC instance names (ie "but" and "mc")
    4. On your main timeline, add a keyframe on frame 2. Add a script to frame 2 that says:
      gotoAndPlay(1);
      This sets up a short loop.
    5. Add a script to frame 1. (Because we keep looping to frame 1, this script will be run every 2 frames!)
      if(_root.but.hitTest(_root.mc)){
      _root.mc.gotoAndStop(2);
      }

      This checks to see if the "but" instance is intersecting the "mc" instance, and, if it is, sends the MC to its 2nd frame.
  12. How to use a variable to track how many times the user has clicked something:
    1. create a movie with 2 scenes, stops on the 1st frame of each scene, and a button in the 1st scene.
    2. add a script on the 1st frame that says:
      myVariable = 0;
      //declares variable and initializes it to value 0)

    3. Add a script to the button:
      on (press){
      myVariable++
      //adds 1 to the value of variable
      trace("the number of clicks is " + myVariable);
      //puts the value of the variable in the output window
      if (myVariable >= 5){
      gotoAndPlay("Scene 2", 1);}
      //checks if variable is 5, goes to scene 2 if so
      }