all groups > flash actionscript > december 2005 >
You're in the

flash actionscript

group:

Newbie Preloader Help, pretty please


Newbie Preloader Help, pretty please shawnA2
12/16/2005 8:30:44 PM
flash actionscript:
Hello, thanks to anyone who can help. I built a video presentation in slide
format from a tutorial. I'm trying to make a seperate pre-loader movie (so it
can be used more than once) that loads the entire presentation swf before it
starts playing and loads it. I think I just need to define the target properly
but everything I've tried doesn't work. Here is the script:

/*
preloader.as
Used to preload movies from frame one. Classes are set to export on frame two
and this is on frame one so it is not a class.
*/

// Declare the loader assets.
var right:MovieClip;
var middle:MovieClip;
var left:MovieClip;
var track:MovieClip;

// Maxiumum width of the middle piece.
var middleMaxWidth:Number;

function init():Void
{
middleMaxWidth = track._width - right._width;

// Monitor the loading progress of the parent movie.
onEnterFrame = function()
{
var bl = _parent.getBytesLoaded();
var bt = _parent.getBytesTotal();

if (bl > 4 && bt > 4 && bl >= bt) // Loading is complete.
{
delete onEnterFrame;
_parent.gotoAndPlay(2);
this.unloadMovie();
}
else
{
middle._width = Math.round(bl / bt * middleMaxWidth);
right._x = middle._x + middle._width;
}
}
}

init();


End Script.

I'm pretty sure that where the _parent is getting the bytes is where I should
define my two movies. The main movie I'm trying to load is called
index_flashNoVideo.swf and the preloader movie itself is just preloader.swf.

Anyone have any ideas?

The action script file is external and is called in the first frame of the
preloader movie using the same preloader animation as on the flash video
gallery tutorial. If that helps any.

Thanks again to anyone who might have any insight on this.
Re: Newbie Preloader Help, pretty please bkm_imon
12/16/2005 11:13:14 PM
I cannot critique your specfiic code below, but I did find another post in this
forum from OOPete that provided the outline and code for creating an external
preloader application that will run to show progress while it loads a second
application .swf file (the presenatation .swf in this case).

With this approach, you would not have to set your classes to export on frame
2, nor have to worry about a preloader directly in your application.

I added to OOPete's work by creating the .fla to go with it, and included a
progress bar component to show the progress of the load.

I posted this approach on my blog site. An in the blog posting, I included a
link to the posting on Macromedia.com where OOPete outlined his approach.

http://blogs.magierski.com/bkm_blog/2005/12/an_actionscript.html

I hope this is an interesting approach and can work for you.

-- bkm
AddThis Social Bookmark Button