?
Solved

Flash actionscript 2 load external swf with preloader

Posted on 2010-09-13
4
Medium Priority
?
734 Views
Last Modified: 2013-11-11
Im looking to load an external swf file into my movieclip with the instance name holder_mc, i would like to show the progress of loading within my dynamic text field instance name loading_txt

how would i do this in actionscript 2
0
Comment
Question by:Brant Snow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:florimit
ID: 33664740
try something like this :

loading_txt.text = (holder_mc.getBytesLoaded() / holder_mc.getBytesTotal() * 100) + "%";
0
 
LVL 4

Author Comment

by:Brant Snow
ID: 33665010
so that would maybe show the loading but what about loading the swf.   So lets so my external swf file is called external.swf and i want holder_mc to load it, what is that going to look like?
0
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 2000 total points
ID: 33669222
Something like this should do it:

(You should have a textField called "txt" for this example to work).

<code>

-V
var container:MovieClip = createEmptyMovieClip("container", getNextHighestDepth());
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(this);
loader.loadClip("loadme.swf", container);

function onLoadProgress(mc:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
	txt.text = (bytesLoaded / bytesTotal) * 100 + "%";
}

Open in new window

0
 
LVL 3

Expert Comment

by:ayanaculis
ID: 33674087
I usually use this (attached) class for all my preloader needs. It's completely customizable and reusable in other projects. Since I can't attach FLA files, please drop me an e-mail at ayanaculis@shoclabs.com and I'll be happy to send you the rest of the code.

Just copy the class in the same folder as your *.fla, then just copy the frames in the FLA I'll send to you to your own. You can change the loading animation (progress_mc_ext) Note that it should always be 100 frames long. You can also change the font and size of the preloading text, just remember to embed the font.

If you need further explanation on how it works, please feel free to ask.
Preloader.as
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question