Hello! Its been a while since Ive posted (although not sure I know more!)…
Ive used a tutorial to create an AS3-ish preloader, which loads my external file just fine - except it plays automatically & replaces the original content. I want the external file to load into an MC, with a button (poss inside the external file?) to then goto the next frame of the external file, kind of like an “enter” button - since the original file has a body of explanatory text. (I dont have it up live yet).
Im using the code below to preload & display the external (newtest.swf), & I also “understand” the old AS2 code I used to use (target_mc/container) type one, but I dont know how to cobble the two together? - any advice would be gratefully received - Ive visited every tute site I know of, but cant find something to do as I need!
var myUrlReq:URLRequest = new URLRequest("newtest.swf");
var myLoader:Loader = new Loader();
myLoader.load(myUrlReq);
myLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);
var myPreloader:Preloader = new Preloader();
function showPreloader(event:Event):void {
addChild(myPreloader);
myPreloader.x = 650;
myPreloader.y = 380;
}
function showProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
myPreloader.loading_txt.text = "Loading - " + Math.round(percentLoaded * 100) + "%";
myPreloader.rectbar_mc.width = 50 * percentLoaded;
}
function showContent(event:Event):void {
removeChild(myPreloader);
addChild(myLoader);
}
Hopefully, Ive used the correct bit to add code!!! - sorry if not! I did try just creating an instance then experimenting with where to stick the code & playing with the myLoader bit, but no luck, :doh:
Thanks in advance, scotia