Skip to main content
EricLabonte
Participating Frequently
May 11, 2023
Question

Cannot create an addEventListener to movieclip in frame 3 (HTML5 Canvas)

  • May 11, 2023
  • 1 reply
  • 581 views

On the main timeline, I have different interfaces to a game I am creating. They are all placed on different keyframes.

On frame 3 (which is a keyframe) of main timeline, I have 9 different buttons. On this frame, I have code to create EventListeners for these buttons, but I receive the error of "undefined".

I believe that the code is being executed before the buttons are actually created on the canvas.

Is there an "on loaded" or "on complete" event that I can assign to the frame, so that I can execute code once every object in the frame is created on the canvas?

Thanks for your help.

This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
May 11, 2023

Hi.


[EDITED: now that I saw in the title that it is the HTML5 Canvas document.]

 

Are the buttons components?

Please let us know.

Regards,
JC

EricLabonte
Participating Frequently
May 11, 2023

I am using HTML5 Canvas document, and the buttons are not components. They are objects of the type "Button". To help clarify, I draw a circle and use the "create symbole" of the type "Button".

 

JoãoCésar17023019
Community Expert
Community Expert
May 11, 2023

Got it.

 

Can you show us a screenshot of your code and a screenshot of the frame that has the buttons?