Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

1061:call to a possibly undefined method addEventListener through a reference with static type class

New Here ,
Jan 17, 2013 Jan 17, 2013

i have used the code snippets to move from keyframe 1 to 2 with this code it is a button.




/* Stop at This Frame

The Flash timeline will stop/pause at the frame where you insert this code.

Can also be used to stop/pause the timeline of movieclips.

*/

stop();

/* Click to Go to Frame and Stop

Clicking on the specified symbol instance moves the playhead to the specified frame in the timeline and stops the movie.

Can be used on the main timeline or on movie clip timelines.

Instructions:

1. Replace the number 5 in the code below with the frame number you would like the playhead to move to when the symbol instance is clicked.

*/

Playbtn.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_6);

function fl_ClickToGoToAndStopAtFrame_6(event:MouseEvent):void

{


gotoAndStop(2);

}

but i get this error, can anyone help?

the error i get if i change the name in the code to the class name instead

1120:Access of undefined property Playbutton

(the instance name is Playbtn)

Thanks for your concern!

TOPICS
ActionScript
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 17, 2013 Jan 17, 2013

As I said, it is not an uncommon error to start mixing up naming between "btn" and "button"... you've already demonstrated doing it between your first two postings.  If "Playbutton" is the class name, then you cannot assign an event listener to it as you just showed in response 3

Translate
Community Expert ,
Jan 17, 2013 Jan 17, 2013

there's code, other than what you showed, causing at least the 1120 error.

use movie explorer to find all your code.

also, click file>publish settings>swf and tick "permit debugging" to see the line number (and frame) triggering the error messages.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2013 Jan 17, 2013

Playbutton.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndStopAtFrame_6);

the problem is with this line for 1120

and where is movie explorer?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2013 Jan 17, 2013

As I said, it is not an uncommon error to start mixing up naming between "btn" and "button"... you've already demonstrated doing it between your first two postings.  If "Playbutton" is the class name, then you cannot assign an event listener to it as you just showed in response 3

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2013 Jan 17, 2013
LATEST

Thanks alot ned!! now i have to figure out 1120 error

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2013 Jan 17, 2013

The error is indicating you are trying to assign a method to a Class object rather than a button or movieclip object.  Where is the name "Playbtn" assigned to the button in question?  In the library, do you see that name to the far right of the button under the AS Linkage heading?

If Playbutton is coming up as an undefined property, then it exists somewhere in your code.  It is not an uncommon error to start mixing up naming between "btn" and "button" for object names.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2013 Jan 17, 2013

Playbtn is the instance name
Playbutton is the Class name and the top one in properties

So which error is easier to fix, im still not sure which is the better error if their is such a thing

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 17, 2013 Jan 17, 2013
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines