hi
[LEFT] I need to load some swfs inside a movieclip with preloader.So on the stage I have some movieclips (linked to “product1” class) which will act as buttons to load particular swf, a holder mc and a dynamic textfield(named-“percent”) for preloading stuff.My problem is how to reffer “percent” text field from the “product1” class?
[/LEFT]
my code is like this…
package
{
import flash.display.;
import flash.events.;
import flash.net.;
import caurina.transitions.;
import flash.text.*;
public class Product1 extends MovieClip
{
public function Product1()
{
this.addEventListener(MouseEvent.CLICK,tick1);
this.addEventListener(MouseEvent.ROLL_OVER,over);
this.addEventListener(MouseEvent.ROLL_OUT,out);
this.buttonMode=true;
}
function over(e:MouseEvent):void
{
Tweener.addTween(MovieClip(this).bullet_mc,{rotationX:360,time:1});
Tweener.addTween(MovieClip(this).bullet_mc,{x:-20,time:.5});
}
function out(e:MouseEvent):void
{
Tweener.addTween(MovieClip(this).bullet_mc,{rotationX:0,time:1});
Tweener.addTween(MovieClip(this).bullet_mc,{x:-10,time:.5,transition:"easeInOutBounce"});
}
function tick1(e:MouseEvent)
{
var mc_loader = new Loader();
mc_loader.load(new URLRequest(e.target.name+"_big.swf"));
mc_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
mc_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
MovieClip(this.parent).holder_mc.addChild(mc_loader);
}
function loop(e:ProgressEvent)
{
var perc:Number;
perc =e.bytesLoaded / e.bytesTotal;
/[SIZE=2]**[COLOR=Red]/I am stucking at this position, now how to reffer "percent" from here??[/COLOR]**[/SIZE]
percent.text = Math.round(perc*100).toString();
addChild(percent);
}
function done(e:Event):void
{
removeChild(percent);
}
}
thanks in advance