Load External swf as2

Need a Website? Contact Us Now!

This entry is part 31 of 32 in the series Flash CS4 Tutorials

In this tutorial you will learn how to load an external swf file in Flash using Action Script 2.0 (AS2).

We will create a button on the main timeline, clicking which will load up the external swf file as well as a close button. Clicking the close button will unload the external swf file and cause the close button to disappear.

Let’s begin!

Let’s assume the external swf file is named ‘external.swf’

1. In the main timeline create a button. You can put the text ‘Click Me’ on this button.

2. On the ‘Click Me’ button put the following AS2 code:

on (Release) {
_root.mymc._visible = true;
_level0.mymc.holder_mc.loadMovie(“external.swf”);
}

2. In the main timeline create a movie clip called ‘mymc’

3. Within ‘mymc’ create another movie clip called ‘holder_mc’ and a button. You can put the text ‘close’ on this button.

4. On the close button put the following AS2 code:

on (Release) {
_root.mymc._visible = false;
_level0.mymc.holder_mc.unloadMovie(“external.swf”);
}

That’s it!

You can download the .fla file for this tutorial here

Series Navigation«How to load pictures in flash CS4 dynamically using the loader componentUpload a Website/ FTP»
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • E-mail this story to a friend!
  • LinkedIn
  • MySpace
  • StumbleUpon
  • Technorati

Posted in Flash CS4 Tutorial | No Comments »

Post a Comment