Sunday, March 28, 2010

Error 1006: removeEventListener in not...

  1. import flash.display.StageScaleMode;
    import flash.display.StageAlign;

  2. stage.scaleMode = StageScaleMode.NO_SCALE;

  3. function loading2(e:Event):void {

  4. ?var total : Number = this.stage.loaderInfo.bytesTotal; //carica il numero di B totali
    ?var loaded : Number = this.stage.loaderInfo.bytesLoaded;//cAarica il numero di B caricati

  5. ?bar.scaleX = loaded/total;
    ?showProgr.text = Math.floor((loaded/total)*100).toString() + ''%'';


  6. ?if (total == loaded) {
    ?play();
    ?this.removeEventListener(Event.ENTER_FRAME, loading2);
    ?}

  7. }

  8. this.addEventListener(Event.ENTER_FRAME, loading2);

  9. skipIntro.addEventListener(MouseEvent.CLICK, function(){
    ?this.removeEventListener(Event.ENTER_FRAME, loading2);
    ?gotoAndPlay(''1'', ''sito'');
    ?});

  10. stop();

It gives me an error 1006 on line17. How is it possible? Why here and not on the 11 too?

Error 1006: removeEventListener in not...

Try not burying the handler function inside the listener...

skipIntro.addEventListener(MouseEvent.CLICK, handleSkip);

function handleSkip(evt:MouseEvent):void {
?this.removeEventListener(Event.ENTER_FRAME, loading2);
?gotoAndPlay(''1'', ''sito'');
}

And that gotoAndPlay(''1'', ''sito''); is questionable in case you have a problem geting to where it's supposed to be going.

No comments:

Post a Comment