10 Killer Flash Tips For Beginners

7. How to create a simple preloader

  1. Add new scene preloader using the scene panel click on plus icon . (Window > Other panels > Scene or press Shift + F2)
  2. Move the preloader scene above content scene as show in below screenshot.
  3. Create a movieclip "preloader bar" drawing a rectangle using width 200px, height 4px, and color: #CCCCCC.
  4. Create another movieclip "preloader bar bg" drawing a rectangle using width 400px, height 4px, and color: #666666.
  5. Put them on stage giving instance names bar and bar_bg and align them centered as show in the screenshot.
  6. Put a dynamic textfield loader_info and put it below the bar and centered.
  7. Add an event listener with a function to calculate the percentage loaded as show in the screenshot.

Simple Preloader AS3

Download Source

8. How to use Bandwidth Profiler and Simulate Download in Flash

You can simulate download in Flash. This is really a very useful tool in Flash, especially to check how flash movies are loaded for slow network speed users.

  1. Run your flash file, go to main menu Control > Test Movie (or press Ctrl + Enter).
  2. Click on View > Bandwidth Profiler (or press Ctrl + B) in Test Movie window.
  3. Click on View> Simulate Download (or press Ctrl + Enter) in Test Movie window.
  4. You can adjust the download speed by View > Download Settings > (different speed options).

Flash Bandwidth Profiler

Download Source

9. How to play timeline frames in reverse

  1. Declare a boolean variable reverse which can be only 2 values, either true or false.
  2. Add event listeners for mouse over, mouse out and enter frame events to the button instance box_01.
  3. When mouse pointer is on the button, reverse value is set to true.
  4. When mouse pointer is NOT on the button, reverse value is set to false.
  5. Event.ENTER_FRAME executes run function continuously. It executes the run function 30 times per second if the frame rate is 30 fps.
  6. run function continuously checks if the reverse value is true or false.
  7. It goes to previous frame when reverse is true and it goes to next frame when reverse is false.
  8. You may see how the timeline pointer goes in bandwidth profiler while testing this movie.

Play Reverse Frames

Download Source

10. How to use a Timer class in Flash

  1. Create a new timer variable timer_01 as in this example.
  2. Add an event listener function play_timer.
  3. Copy box movieclip from the FLA file of TIP number 3 into the library.
  4. Add play_timer function.

Additional: You may download and see how Timer is used with play/pause buttons in Flash XML photo rotator

AS3 Timer Class

Download Source

-->