Sergio
Sergio

Reputation: 628

Error #1009 when jumping to the next frame

I'm getting a TypeError: Error #1009 when jumping to the next frame.

This code is in frame 3:

this.addEventListener(Event.ENTER_FRAME,activate);


function activate(event:Event)
{
  if (fname.length > 2 && sname.length > 2 && cname.length > 1)
  {
    bt_Send.alpha = 1.0;
    bt_Send.enabled = true;
    enableIt = true;
  }
  else
  {
    bt_Send.alpha = 0.05;
    bt_Send.enabled = false;
    enableIt = false;
   }
}

When I click the "next" button, the movie jumps to frame 4. After the button is clicked appears the TypeError: Error #1009 at new_cics_fla::MainTimeline/activate()

In the frame 4 are no mention to the function "activate".

The movie runs normally, but I'd like to know why I'm getting this message.

Thanks in advance.

Cheers, Sergio

Upvotes: 0

Views: 120

Answers (1)

net.uk.sweet
net.uk.sweet

Reputation: 12431

It sounds like your enterFrame is continuing to execute but the properties the activate method acts on are not available in the frame you've sent the playhead to.

Try removing the enterFrame in the method which handles clicks on your next button:

function nextClick(event:MouseEvent):void 
{
    // Clean up the enterFrame
    this.removeEventListener(Event.ENTER_FRAME,activate);

    // Now advance to the next frame
    this.gotoAndPlay(4);
}

Upvotes: 1

Related Questions