Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Flash CS4  Loader

Posted on 2009-04-07
1
Medium Priority
?
1,064 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

660 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