Thanks Medyman I searched gotoAndLearn but that didn't pop up I just got a bunch of stuff on simple preloaders.
I adapted what sekasi posted to fix mine for the most part it's still a little rough and could use some work though.
for those interested here is the code I have
Code:
var l:Loader = new Loader(); // loader to load in your movie
var mc:MovieClip = new MovieClip(); // movieClip to draw circle on
var mc_x = stage.stageWidth/2; // x position of circle
var mc_y = stage.stageHeight/2; // y position of circle
var xpos:Number = 0; // x position of line to be drawn
var ypos:Number = 0; // y position of line to be drawn
var angle:Number = 0; // angle of the line
var radius:Number = 50; // radius of circle
var perc:Number = 0; // percent of what is loaded
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress)
l.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete)
l.load(new URLRequest("large.swf"));
addChild(mc);
mc.graphics.moveTo(mc_x,mc_y);
mc.graphics.beginFill(0x00ff00);
function onProgress(e:ProgressEvent):void
{
perc = Math.round((e.bytesLoaded / e.bytesTotal) * 100);
xpos = mc_x + Math.cos(Math.PI/90*angle) * radius;
ypos = mc_y + Math.sin(Math.PI/90*angle) * radius;
angle = Math.round(perc * (1.8));
mc.graphics.lineTo (xpos,ypos);
}
function onComplete(e:Event)
{
//---------draws last segment of circle-----------//
xpos = mc_x + Math.cos(Math.PI/90*angle) * radius;
ypos = mc_y + Math.sin(Math.PI/90*angle) * radius;
angle = Math.round(perc * (1.8));
mc.graphics.lineTo (xpos,ypos);
mc.graphics.endFill();
//------------------------------------------------//
addChildAt(l,0);
removeChild(mc);
}
The one big problem with it right now is that if it preloads more then at T1 speeds the circle begins to get choppy and more polygon like.
The other problem is that t1 and above it doesn't draw the last segment so i had to include the code to draw the last segment in the onComplete
Any one have any ideas on how to improve on this?
Bookmarks