Skip to main content
Perfect_Nemus
Known Participant
June 18, 2009
Question

Movieclip Reverse playing

  • June 18, 2009
  • 2 replies
  • 702 views

So I have this mc:

this.slidingMenu

it's a mc of a ring shaped menu, which turn around when 2 button get clicked. When the button on the right, mc goes forward until stop(), when the button on the left mc goes reverse until the stop().

In the first case i use gotoanplay, and everything goes fine (thanks Ned ).

For the second I use prevFrame, like this:

Header 1
function navRWD(){
            if (slidingMenu.currentFrame == 1)
            {
                slidingMenu.gotoAndStop(78);
                slidingMenu.prevFrame();
            }
            else
            {
                slidingMenu.prevFrame();
            }
               
        }

function rwd(): void
{
        slidingMenu.addEventListener(Event.ENTER_FRAME, navRWD());
        //slidingMenu.removeEventListener(Event.ENTER_FRAME, navRWD());   
}

this.n_anim.nBtn.addEventListener(MouseEvent.CLICK, function()
{
      rwd();
}
);

It works only 1 frame for click and get this error:

TypeError: Error #2007: parameter value must be different from null.
    at flash.events::EventDispatcher/addEventListener()
    at intro_sito_fla::MainTimeline/rwd()
    at MethodInfo-4()

Any idea?

This topic has been closed for replies.

2 replies

Perfect_Nemus
Known Participant
June 19, 2009

Here it is the solution:

i forgot to deactive EnterFrame event. So whatever i do in the stage, this event would call its own function.

Pay attentio to event, always deactive it guys

Known Participant
June 18, 2009

well you first need to add the events being passed to your method

function navRWD(e:Event = null){
            if (slidingMenu.currentFrame == 1)
            {
                slidingMenu.gotoAndStop(78);
                slidingMenu.prevFrame();
            }
            else
            {
                slidingMenu.prevFrame();
            }
               
        }

function rwd(): void
{
        slidingMenu.addEventListener(Event.ENTER_FRAME, navRWD());
        //slidingMenu.removeEventListener(Event.ENTER_FRAME, navRWD());   
}

this.n_anim.nBtn.addEventListener(MouseEvent.CLICK, function()
{
      rwd();
}
);

Perfect_Nemus
Known Participant
June 19, 2009

Ok, so now left button works greatly, but right button stops working after left button has been clicked:

it let me see instruction of the left btn (trace etc).

It's like a conflict between the two listener..

// Dichiaro la variabile che conterrà l'etichetta di destinazione
var etichetta:String = "home";
var i:int = 1;
var endFrame:int;
var cLabel:String;
var allLabels:Array = slidingMenu.currentLabels;

function navFWD(e:Event){
    trace("i " + i);
    trace("endFrame " + endFrame);
    i = slidingMenu.currentFrame + 20;
    slidingMenu.play();

     cLabel = slidingMenu.currentLabel;
    trace("etichetta " + cLabel)
}

this.s_anim.sBtn.addEventListener(MouseEvent.CLICK, navFWD);

function navRWD(e:Event){
            i = slidingMenu.currentFrame;
            trace("i " + i);
            trace("endFrame " + endFrame);
            trace("etichetta " + cLabel);
            if ((i == 1) && (endFrame == 61)){
                i = endFrame + 20;
            }
            if(i > endFrame){
                if (i == 81)
                {
                    slidingMenu.gotoAndStop(80);
                    slidingMenu.prevFrame();
                }
                else
                {
                    slidingMenu.prevFrame();
                }
            }
        }

function rwd(): void
{
        slidingMenu.addEventListener(Event.ENTER_FRAME, navRWD);
        //slidingMenu.removeEventListener(Event.ENTER_FRAME, navRWD());  
}

this.n_anim.nBtn.addEventListener(MouseEvent.CLICK, function()
{
      i = slidingMenu.currentFrame;
     
      if(i == 1){
          endFrame = i + 60;
      }else{
              endFrame = i - 20;
      }
      rwd();
}
);

Messaggio modificato da Perfect_Nemus