Skip to main content
Known Participant
October 28, 2010
Answered

Error #1006 from a Button function(HELP!)

  • October 28, 2010
  • 1 reply
  • 3114 views

I created a button and it calls up a MoveClip.

When the MovieClip is played, it contains several layers which tweens into a panel of information located on frame (10).

Attached to that panel of information is a button.

In my ActionScript layer inside the MovieClip on frame (10), I write code for the button to invoke the MovieClip to play through.

Here is the code:

stop();

//import classes so we can have them in our movie
import flash.display.*;
import flash.events.*;
import flash.display.MovieClip;
import flash.display.Sprite;


faucet_mc.addEventListener(MouseEvent.CLICK, faucetCLICK);
function faucetCLICK (event:MouseEvent): void {
faucet_mc.gotoAndPlay(nextFrame);

}

When I hit the button on the right side of teh panel, I get an error message in my output panel:

TypeError: Error #1006: gotoAndPlay is not a function.
    at test1_fla::faucet_mc_2/faucetCLICK()[test1_fla.faucet_mc_2::frame10:12]

My goal is to have the MovieClip to play through by fading out the panel of information that ends at frame (18)

and have the MoveClip to start back or stop back at frame (1)

I do not understand why my error message says that gotoAnd Play is not a function.

How can I get this to work?

This topic has been closed for replies.
Correct answer kglad

I may have resolved the problem. I took the MovieClip instance name off of the beginning of gotoAndPlay and it seemed to work

stop();

//import classes so we can have them in our movie

import flash.display.*;

import flash.events.*;

import flash.display.MovieClip;

import flash.display.Sprite;

f_btn_mc.addEventListener(MouseEvent.CLICK, faucetCLICK);

function faucetCLICK (event:MouseEvent): void {

gotoAndPlay("faucet_end");

}

Thank you for your assistance.


you're welcome.

please mark this thread as answered.

1 reply

kglad
Community Expert
Community Expert
October 28, 2010

nextFrame needs to be a frame label or number.

pawmunkeyAuthor
Known Participant
October 28, 2010

I labeled the frame for the button to advance to movie forward as faucet_end

faucet_mc.addEventListener(MouseEvent.CLICK, faucetCLICK);
function faucetCLICK (event:MouseEvent): void {
faucet_mc.gotoAndPlay("faucet_end");
}

and I get a new error message

1061: Call to possibly undefined method gotoAndPlay through a reference with a static type Class

1061: Call to possibly undefined method addEventListener through a reference with a static type Class

Can I run two instances in the same MoveiClip?

I read something where i have to add the ysntax parent within my code.

Can anyone assist me with that?

Thank you.........

kglad
Community Expert
Community Expert
October 28, 2010

if the error messages are related to your displayed code, faucet_mc is a class name.  it should be an instance name only.