0
我有一個.swf加載一個外部.swf文件,這是遊戲。有沒有辦法將兩個swfs結合成一個?這是瑞士法郎加載外部遊戲的代碼:如何將外部.swf預加載器與實際的.swf結合起來?
import flash.display.*;
import flash.net.*;
import flash.events.*;
var array:Array = new Array ("Loading Bugs..","Everyone hates loading screens..","Lovely day, isn't it?",
"Want instant updates? Follow us on Twitter!", "A game where you can kill bugs, pretty cool...huh?"); //create an array of possible strings
var randomIndex:int = Math.floor (Math.random() * array.length); //generate a random integer between 0 and the length of the array
loading_txt.text = array [ randomIndex ]; //put the random string in your text field
var myRequest:URLRequest = new URLRequest("insectGame.swf");
var myLoader:Loader = new Loader();
myLoader.load(myRequest);
function showProgress(evt:ProgressEvent):void
{
txtPreloader.text = Math.round((evt.bytesLoaded/evt.bytesTotal)*100) + "%";
mcPreloaderBar.width = Math.round(evt.bytesLoaded/evt.bytesTotal * 200);
}
function showLoaded(evt:Event):void
{
myLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,showLoaded);
removeChild(txtPreloader);
removeChild(mcPreloaderBar);
removeChild(mcPreloaderFrame);
removeChild(Mosquito);
removeChild(loading_txt);
mcPreloaderBar = null;
mcPreloaderFrame = null;
txtPreloader = null;
loading_txt = null;
addChild(myLoader);
}
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showLoaded);