Solved

Flash CS4  Loader

Posted on 2009-04-07
1
1,058 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 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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.

776 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