PDA

View Full Version : prevFrame won't stop firing



bigdaddykraven
November 25th, 2008, 01:11 PM
At least that is what I think the problem is. I have a banner I'm working on for work with a picture of the US and when you roll over the states that we have affiliations in, the state will grow and then using prevFrame, when you roll out, it will shrink again. However, after it shrinks, I can't get the thing to grow again.

So I assume that prevFrame won't stop firing back and this is causing the issue.

Here's the code:


stop();

ohioBttn.addEventListener(MouseEvent.MOUSE_OVER, ohioOver);
ohioBttn.addEventListener(MouseEvent.MOUSE_OUT, ohioOut);


/*ncBttn.addEventListener(MouseEvent.MOUSE_OVER, ncOver);
ncBttn.addEventListener(MouseEvent.MOUSE_OUT, ncOut);

pennBttn.addEventListener(MouseEvent.MOUSE_OVER, pennOver);
pennBttn.addEventListener(MouseEvent.MOUSE_OUT, pennOut);

indBttn.addEventListener(MouseEvent.MOUSE_OVER, indOver);
indBttn.addEventListener(MouseEvent.MOUSE_OUT, indOut);*/

function ohioReverse(e:Event):void
{
ohioBttn.prevFrame();
}

function ohioOver(eventObject:MouseEvent) {
stateName.text = "Ohio";
stateInfo.text = "Production Facility";
ohioBttn.gotoAndPlay(2);
}

function ohioOut(eventObject:MouseEvent) {
stateName.text = "I'm Interactive!";
stateInfo.text = "Roll Over the Map for Information!";
ohioBttn.addEventListener(Event.ENTER_FRAME, ohioReverse);
}I've been looking at different code all morning so I'm sure I'm mising something small. I'd attach the file but its too large. Thanks in advance everyone.

Iamthejuggler
November 25th, 2008, 01:19 PM
prevFrame won't stop firing till you remove the enter frame listener.

bigdaddykraven
November 25th, 2008, 03:02 PM
I figured that was the case but couldn't think of what to do with it.

Edit: Forgot to say thanks. My head was out of it and I just needed lunch I think.

Iamthejuggler
November 25th, 2008, 04:33 PM
I assume you have a function where you are trying to reverse the animation so that the banner grows again? If so add the line:

ohioBttn.removeEventListener(Event.ENTER_FRAME, ohioReverse);

bigdaddykraven
December 10th, 2008, 07:55 PM
Sorry I didn't respond to this but my boss is keeping me pretty busy :)

Anyway, yes the remove event listener did work and I appreciate all the help everyone!