AC3 Errors 1119 1120 on my button scripting?
I'm am super new at this, and this is my first time ever using Adobe. I get the "joy" of doing a project in my school using The CS4 Suite. I was playing around and using this book to help me get a button to start an action. I have tried many different codings, but this one gets me the least amount of errors. This is what I have so far:
var isPlaying = false;
this.myButton.addEventListener(MouseEvent.MOUSE_DOWN, onButtonClicked);
this.myButton.onButtonClicked = function(){
gotoAndPlay(5);
}
Line 3, Error 1119: Access of undefined property onButtonClicked. Line 5, Error 1120: Ac开发者_运维百科cess of possibly undefined property onButtonClicked through a reference with static type ...What am I doing wrong?
The function called by the event should not be set like that. The code that you have is more like Javascript than ActionScript.
var isPlaying = false;
this.myButton.addEventListener(MouseEvent.CLICK, onButtonClicked);
function onButtonClicked(event:MouseEvent):void {
gotoAndPlay(5);
}
Also, try to read documentation, more info on:
http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00000376.html
精彩评论