0
我知道這不能是那麼辛苦,只是不知道爲什麼它不能解僱。as3禁用加載按鈕模式
我有一個「家」按鈕,我想加載禁用,因爲「家」的內容默認加載。
繼承人我的代碼:
import flash.events.Event;
// BUTTON FUNCTIONS FOR SP.
// by SOMDOW
/////////////// VARS ///////////////
var loader:Loader = new Loader();
var defUrlReq = new URLRequest("indexCoontentLoad.swf");
var urlRequest:URLRequest = new URLRequest();
var myLoadedSwf:MovieClip = null;
var swfStage:Stage = this.stage;
/////////////// INITIATE LOADERS ///////////////
loader.load(defUrlReq);
/////////////// START MAIN HANDLER FUNCTION ///////////////
/////IMPORT DEFAULT SWF /////
loader.contentLoaderInfo.addEventListener(Event.INIT, loadedHandler);
function loadedHandler(event:Event){
myLoadedSwf = event.target.content;
addChild(myLoadedSwf);
trace(myLoadedSwf);
myLoadedSwf.gotoAndPlay("intro");
}
//----- END IMPORT DEF SWF -----
///// HOME BUTTON TURNED OFF ON LOAD /////
indexCoontentLoad.addEventListener(Event.INIT, offOnLoad);
function offOnLoad(e:Event):void{
if(myLoadedSwf.currentFrameLabel == "outro"){
indexCoontentLoad.mouseEnabled = false;
trace("lopan");
indexCoontentLoad.removeEventListener(Event.ENTER_FRAME, offOnLoad);
}
}
//----- END IMPORT. -----
///// START LISTENERS AND THEIR FUNCTIONS /////
load1.addEventListener(MouseEvent.CLICK,btn4Loaded);
load2.addEventListener(MouseEvent.CLICK,btn4Loaded);
load3.addEventListener(MouseEvent.CLICK,btn4Loaded);
indexCoontentLoad.addEventListener(MouseEvent.CLICK,btn4Loaded);
//----- END LISTENERS -----
///// test /////
//indexCoontentLoad.addEventListener(Event.ENTER_FRAME,offOnLoad);
/*function btn4Loaded(e:Event):void { //-- START btn4Loaded
if (myLoadedSwf.currentLabel == "outro") {
myLoadedSwf.gotoAndPlay("outro");
trace("STEP 2 -- swf outro playing");
}
*/
//----- test end
///// START BTN FUNCTIONS /////
function btn4Loaded(e:Event):void {
if (e.target == load1 || e.target == load2 || e.target == load3 || e.target == indexCoontentLoad) {
myLoadedSwf.gotoAndPlay("outro");
removeChild(myLoadedSwf);
urlRequest = new URLRequest(e.target.name+".swf");
loader.load(urlRequest);
addChild(myLoadedSwf);
}
if(e.target == load1){
load1.mouseEnabled = false;
load2.mouseEnabled = true;
load3.mouseEnabled = true;
indexCoontentLoad.mouseEnabled = true;
}
if(e.target == load2){
load2.mouseEnabled = false;
load3.mouseEnabled = true;
load1.mouseEnabled = true;
indexCoontentLoad.mouseEnabled = true;
}
if(e.target == load3){
load3.mouseEnabled = false;
load2.mouseEnabled = true;
load1.mouseEnabled = true;
indexCoontentLoad.mouseEnabled = true;
}
if(e.target == indexCoontentLoad){
load3.mouseEnabled = true;
load2.mouseEnabled = true;
load1.mouseEnabled = true;
indexCoontentLoad.mouseEnabled = false;
}
}
//----- END BTN FUNCTIONS
這個上面沒有做任何事情。 「indexCoontentLoad」是一個按鈕。
我也嘗試這樣的:
function indexCoontentLoad(e:Event = null){
//code here
}
然後調用它以後通過indexCoontentLoad();
但是再次沒有。
任何幫助表示讚賞。先謝謝你。
你好馬蒂亞斯,感謝您的時間,是我搞砸說起來,我有這樣的整體功能塊的完整事件集,並試圖別的B4我來到這裏, 。忘記將代碼重新設置爲我所擁有的。但是,我更新了我的帖子以反映我的完整代碼。我嚴重的評論,所以你會發現代碼塊即時通訊試圖執行「家庭按鈕關閉負載」的一部分。即時試圖關閉加載 – somdow
解決它,更新我的代碼。現在我的問題是,如果你點擊相應的按鈕,它會好起來的,但如果你點擊任何按鈕太快,它會加載其他外部swf的ontop。看看我的意思,http://www.somdowprod.net/4testing/flash/tst – somdow