开发者

AS3 Access of undefined property

First of all I am completely new to AS3. I want to create a simple website, with 3 buttons.

Once you click on the button, content should a开发者_如何学Cppear next to it. But i have trouble programming even one button.

Here is the script:

stop();
photography_btn.addEventListener(MouseEvent.CLICK, photoclick);
function photoclick(event:MouseEvent) {
   gotoAndPlay("photography");
}

But Flash says: 1120: Access of undenfined property photography_btn. I have looked everywhere on the internet for the past two days, but since I am so new at this, other people's solutions don't really help me.

Also, I integrated a stop action, but the script won't stop! I have put the actions on the first frame.

Please, I need some help, getting really desperate otherwise...

Thank you!! Jennifer


ok, I solved it. forgot to give it an instance name ... grrr ;)

however, i have read on some websites that the stop(); only works on the first frame of the timeline. what do i do with the other frames?


Where is your code being placed?

It might just be that you need to add "this" to your calls:

this.stop(); 
this.photography_btn.addEventListener(MouseEvent.CLICK, photoclick);
function photoclick(event:MouseEvent) { this.gotoAndPlay("photography"); }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜