what’s the alternate solution to using an onClipEvent Handler? For example… I know that you would use the following script within a movie clip…
onClipEvent (load) {
}
but what if you wanted to do the same thing only your AS is not inside of the movie clip? Because I created my movie clip with AS instead(createEmptyMovieClip) and need to know how to load some files. I tried the .onLoad, but it’s not the same thing.
[font=courier new]loadMovieNum()[/font] is a top-level function, not a method of the [font=courier new]MovieClip[/font] object. The code should read as follows:
okay… it’s still not working… my code is as follow
// stop the play head
stop();
//create the movie clip to hold the preloader
this.createEmptyMovieClip("preLoader_mc",1);
//put the preloader in the right spot
preLoader_mc._x = 242;
preLoader_mc._y = 212;
//create some variables for the preloader
preLoader_mc.tBytes = this.getBytesTotal();
preLoader_mc.startX = 0;
preLoader_mc.startY = 0;
//create the text field to display the information
preLoader_mc.createTextField("loader_txt", 10,176,-14,50,20);
//create a text format and set some properties
var loadFormat:TextFormat = new TextFormat();
loadFormat.font="verdana";
loadFormat.bold=true;
loadFormat.size=8;
loadFormat.color=0xffffff;
preLoader_mc.loader_txt.setNewTextFormat(loadFormat);
// load external movies
preLoader_mc.loadMovieNum("movie_clips/clip.swf", 50);
preLoader_mc.onEnterFrame = function(){
this.clear();
//create the lineStyle
preLoader_mc.lineStyle(0,0xFFFFFF,100);
//get the amount of loaded bytes
lBytes = _root.getBytesLoaded();
//create the percentage variable
var percentLoaded = Math.floor((lBytes/this.tBytes)*100);
if(lBytes != this.tBytes){
//insert the text into the text field
this.loader_txt.text=percentLoaded+"%";
//start the fill
this.beginFill(0x925080,100);
//draw the loader
this.moveTo(this.startX,this.startY);
this.lineTo(this.startX,this.startY+8);
this.lineTo(this.startX+(percentLoaded*2),this.startY+8);
this.lineTo(this.startX+(percentLoaded*2),this.startY);
this.lineTo(this.startX,this.startY);
this.endFill();
}else{
//go to the second frame
_root.play();
//remove this preloader
this.removeMovieClip();
this.removeTextField();
}
}
the entire script iteslf works… but it’s not loading the external movie.