Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Playing the RoboDemo Movie and Animation Concurrently

Playing the RoboDemo Movie and Animation Concurrently

Having the RoboDemo movie continue playing while the interactive animation is displaying is slightly more difficult. This is because RoboDemo removes an animation after it has played onceā€”so a five-frame animation will only display for one-quarter of a second. This is not very useful if you need your animation to display on every frame of your movie.

Fortunately you can use ActionScript to get around this issue by having the animation duplicate itself to a new movie clip. Then, when the original animation is removed, the new movie clip remains.

  1. In Flash, open Example4_a.fla.

    You’ll see that the animation again uses three layers: one to display the information icon, the second to display the caption, and the third to hold your ActionScript.

  2. Preview the movie by selecting Control > Test Movie.

    You’ll see the information icon displayed; rolling over it displays the caption, rolling out hides the caption.

    Now you need to add ActionScript to duplicate the animation so it will continue to play throughout the RoboDemo movie.

  3. Click frame 1 of the Script layer and add the following ActionScript before the existing code:

    if (this._target.indexOf("rdInsert") != -1) {
    duplicateMovieClip(this, "myClip", 1);

    It should now read:

    if (this._target.indexOf("rdInsert") != -1) {
    duplicateMovieClip(this, "myClip", 1);

    The if statement at the start of the code tests the name of the movie clip to see if it’s the original animation or the duplicate. If the name begins with rdInsert, it’s the original and needs to be duplicated and named myClip.

    After the code creates myClip, the if statement runs again. However, this time the movie clip name doesn’t begin with rdInsert, so the movie clip is not duplicated.

    You don’t need to add any code to remove myClip because you want it to display on every slide of the movie.

  4. Now you can save the file (File > Save) and export it as Example4_a.swf (File > Export Movie).
  5. In RoboDemo, open Example4_rd.rd.
  6. Double-click slide 1 to open it in the Edit window.
  7. Select Insert > Animation, then navigate to and open Example4_a.swf.
  8. Leave all options at their defaults and press OK.
  9. Drag the animation down to the lower right corner.
  10. Now save the file (File > Save) and preview it (File > Preview).