This is a real mystery to me; I’m not sure what I’m doing wrong.
I not even sure whether this is a Flash problem or an Actioscript problem.
The following actionscript is supposed to load an external swf:
[FONT=Helvetica]//create clips to hold your content[/FONT]
[FONT=Helvetica]this.createEmptyMovieClip(“progressBar_mc”, 0);[/FONT]
[FONT=Helvetica]progressBar_mc.createEmptyMovieClip(“bar_mc”, 1);[/FONT]
[FONT=Helvetica]progressBar_mc.createEmptyMovieClip(“stroke_mc”, 2);[/FONT]
[FONT=Helvetica]//use drawing methods to create a progress bar[/FONT]
[FONT=Helvetica]with (progressBar_mc.stroke_mc) {[/FONT]
[FONT=Helvetica] lineStyle(0, 0x000000);[/FONT]
[FONT=Helvetica] moveTo(0, 0);[/FONT]
[FONT=Helvetica] lineTo(100, 0);[/FONT]
[FONT=Helvetica] lineTo(100, 10);[/FONT]
[FONT=Helvetica] lineTo(0, 10);[/FONT]
[FONT=Helvetica] lineTo(0, 0);[/FONT]
[FONT=Helvetica]}[/FONT]
[FONT=Helvetica]with (progressBar_mc.bar_mc) {[/FONT]
[FONT=Helvetica] beginFill(0xC0C0C0, 100);[/FONT]
[FONT=Helvetica] moveTo(0, 0);[/FONT]
[FONT=Helvetica] lineTo(100, 0);[/FONT]
[FONT=Helvetica] lineTo(100, 10);[/FONT]
[FONT=Helvetica] lineTo(0, 10);[/FONT]
[FONT=Helvetica] lineTo(0, 0);[/FONT]
[FONT=Helvetica] endFill();[/FONT]
[FONT=Helvetica] _xscale = 0;[/FONT]
[FONT=Helvetica]}[/FONT]
[FONT=Helvetica]progressBar_mc._x = (Stage.width - progressBar_mc._width) / 2;[/FONT]
[FONT=Helvetica]progressBar_mc._y = (Stage.height - progressBar_mc._height) / 2;[/FONT]
[FONT=Helvetica]// load progress[/FONT]
[FONT=Helvetica]var mclListener:Object = new Object();[/FONT]
[FONT=Helvetica]mclListener.onLoadStart = function(target_mc:MovieClip) {[/FONT]
[FONT=Helvetica] progressBar_mc.bar_mc._xscale = 0;[/FONT]
[FONT=Helvetica]};[/FONT]
[FONT=Helvetica]mclListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {[/FONT]
[FONT=Helvetica] progressBar_mc.bar_mc._xscale = Math.round(bytesLoaded/bytesTotal100);[/FONT]*
[FONT=Helvetica]};[/FONT]
[FONT=Helvetica]mclListener.onLoadComplete = function(target_mc:MovieClip) {[/FONT]
[FONT=Helvetica] progressBar_mc.removeMovieClip();[/FONT]
[FONT=Helvetica]};[/FONT]
[FONT=Helvetica]mclListener.onLoadInit = function(target_mc:MovieClip) {[/FONT]
[FONT=Helvetica] target_mc._height = 400;[/FONT]
[FONT=Helvetica] target_mc._width = 325;[/FONT]
[FONT=Helvetica]};[/FONT]
[FONT=Helvetica]//Create a clip to hold the image.[/FONT]
[FONT=Helvetica]this.createEmptyMovieClip(“image_mc”, 100);[/FONT]
[FONT=Helvetica]var image_mcl:MovieClipLoader = new MovieClipLoader();[/FONT]
[FONT=Helvetica]image_mcl.addListener(mclListener);[/FONT]
[FONT=Helvetica]/ Load the image into the clip.[/FONT]*
*[FONT=Helvetica]You can change the following URL to a SWF or another image file. /[/FONT]
[FONT=Helvetica]image_mcl.loadClip(“http://www.mysite.com/myflash.swf”, image_mc);[/FONT]
But whenever it loads, it load distorted, in terms of proportions for ome reason.
I’ve used this preloader for other files and it works fine.
Can anyone help me?
P.S. And yes, the height and width I used in the actionscript are the actual dimensions of the file.