Hi Ruel,
I know i said yesterday i will post the preloader code but it was impossible, and considering that tomorrow i will go on summer vacations (remember is summer here in Chile) it wouldn't be cool to post it in two more weeks.
First here is the code of the preloader.
import flash.display.*;
// Set up the loader object
var request
:URLRequest =
new URLRequest("megazine/megazine.swf");
// File path is relative to this preloader
loader.
contentLoaderInfo.
addEventListener(ProgressEvent.
PROGRESS, loadProgress
);
loader.
contentLoaderInfo.
addEventListener(Event.
COMPLETE, loadComplete
);
// Update the percentage display
{
var percentLoaded
:Number = event.
bytesLoaded / event.
bytesTotal;
percentLoaded =
Math.
round(percentLoaded
* 100);
this.percentLoaded.
text =
String(uint(percentLoaded
)) + "%";
}
// Load complete, hide the animating graphic and text
function loadComplete
(event
:Event):void {
trace("Load Complete");
this.rotatingOrb.visible = false;
this.percentLoaded.visible = false;
loader.content["fitToStage"] = true;
}
loader.load(request);
this.addChild(loader);
As you can see just a simple preloader, the key features here are 2.
- First is the last statement of the
Load Complete function. As Florian taught me, without setting the loader content to fit the stage it just doesn't works.
- Second are lines 3 and 5, this is important because otherwise this will go out of proportions, and if you are using images in the pages they could pixelate. Later i'll get back to this.
The xml code of the mz3 file doesn't need to be discussed (at least i think so, let me know if you want it too, but is the standard mz3 file that you will find in the Wiki).
The html code is important because i don't use the example method to embed the swf file, i use the old fashion way, and has worked fine this far. That is why i said in a prior post that it was a little tricky.
First this is the code of the head section of the html page
<script src="script/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
html, body {
height: 100%;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
</style>
The first part is basically the file that makes any swf works.
The second part is what makes the preloader fill the entire screen (no matter what resolution you have), because of this key feature two of the actionscript is important, because the stage of the preloader fills the entire screen, but the content of the child in the preloader doesn't.
Then the rest of the code in the <body> tag of the html.
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','100%','height','100%','src','megazine/Copia de externalpreloader','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','align','Middle','movie','megazine/Copia de externalpreloader' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="100%" height="100%">
<param name="movie" value="megazine/Copia de externalpreloader.swf" />
<param name="quality" value="high" />
<param name="align" value="Middle" />
<embed src="megazine/Copia de externalpreloader.swf" width="100%" height="100%" align="Middle" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>
</object>
</noscript>
The most important thing here is to establish that the width and height of the preloader are 100%, and of course replace the swf name with yours.
So as you can see this is not the work of someone who knows a great deal of actionscript or embedding swf objects, i just transformed the example that you can download and turn it into a simple web page, nothing more than that, an that is why the most experienced guys here could help us polishing it.
Kind Regards,
Rodrigo.