How to Embed an External SWF in an AS3 Flash Movie

Written by william harrel
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Embed an External SWF in an AS3 Flash Movie
Use UILoader to embed external SWFs. (old movie film onwhite background image by Anatoly Tiplyashin from Fotolia.com)

One of the many ways Flash movie designers keep the size of their Flash Timelines manageable is to embed Flash Small Web Format (SWF) movies inside other Flash movies, or play a movie in a movie. External SWFs (known as a "child") load into parent movies inside container components, such as UILoader. In movies designed to use ActionScript 3.0 (AS3), Flash's built-in scripting language, you can place the component wherever you want on the Timeline and then configure it to load the desired external SWF.

Skill level:
Moderate

Other People Are Reading

Things you need

  • Adobe Flash CS3 or later

Show MoreHide

Instructions

  1. 1

    Open an existing Flash ActionScript 3.0 FLA file or create a new one in Flash.

  2. 2

    Go to the frame in the Timeline panel where you want your external movie to play. Right-click the frame and choose "Insert Keyframe" from the pop-up menu.

  3. 3

    Click "Window" on the menu bar and choose "Components."

  4. 4

    Drag "UILoader" to the Stage.

  5. 5

    Click "Window" on the menu bar and choose "Components Inspector."

  6. 6

    Select the instance of UILoader on the Stage. Change the "scaleContent" value in the Parameters column to "false" (click the drop-down and choose "false"). This tells Flash to let the external SWF set the size of UILoader.

  7. 7

    Drag the component to the desired position on the Stage, or use the "X" and "Y" fields in the Position and Size section of the Properties panel to place it precisely. The coordinates correspond to the upper-left corner of the component.

  8. 8

    Click the "value" field to the right of "source" in Component Inspector and type the path to the external movie file. For example, if the external file is in a subdirectory named "flash," the path would be "/flash/moviename.swf."

  9. 9

    Test your movie. If the path and file names are correct, the external SWF should load and play.

Tips and warnings

  • You can create many UILoader instances and load several external SWFs in the same scene without writing any scripts.
  • You can load external movies into UILoader on a button click with a simple ActionScript event handler that advances the movie to the frame where you placed UILoader.
  • When you deploy your movie to a web server, make sure you maintain the file paths. For example, if your movies are in a subdirectory on your computer, they should be in the same subdirectory on the server. Otherwise, your external movies will not play.
  • It is important to upload all the files, including the external SWFs. Otherwise, they will not be available to the main SWF movie.

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.