Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Flash CS4  Loader

Posted on 2009-04-07
1
Medium Priority
?
1,065 Views
Last Modified: 2013-11-11
Someone have a simple example of the standard loaderbar with % loaded etc for Flash cs4?
0
Comment
Question by:lrbrister
1 Comment
 
LVL 5

Accepted Solution

by:
john_hollings earned 2000 total points
ID: 24095870
The simplest way to load content in AS3 is to have an swf load in your main content swf.  In order to do this you need to ensure that the loader.swf stage is the same size as the main content.swf stage.

Create a new flash AS3 document and add a new layer.  Give the 2 layers the following names:
  text
  actions (lock this layer)

Within the text layer create a dynamic text field and give it an instance name of precent.
On the action layer copy the following code into the actions panel.  I can't take the credit for this code, its a tutorial Lee Brimelow provided on his gotoandlearn web site.

http://www.gotoandlearn.com/play?id=85

Hope this helps.
//Creates an instances of the loader class
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("content.swf"));
 
function loop(e:ProgressEvent):void
{
	var perc:Number = e.bytesLoaded / e.bytesTotal;
	percent.text = Math.ceil(perc*100).toString();
}
 
function done(e:Event):void
{
	removeChildAt(0);
	percent = null;
	addChild(l);
}

Open in new window

0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to how to record live broadcast.
Suggested Courses

972 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