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

Symbols (HTML5 Canvas) - Assign Classes?

Engaged ,
Feb 19, 2022 Feb 19, 2022

Is it possible in HTML Canvas movies to assign classes to symbols?  

 

I can see this is possible in ActionScript movies through the Symbol Properties panel > ActtionScript Linkage to enter a class.  But in HTML5 Canvas movies, that area is disabled.

337
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
Engaged ,
Feb 19, 2022 Feb 19, 2022

By class, I'm referinng to CCC and JQuery type classes, so that I can reference a number of symbols without having to use seperate IDs.

 

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
Engaged ,
Feb 19, 2022 Feb 19, 2022

CCC should be CSS...

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
Community Expert ,
Feb 20, 2022 Feb 20, 2022

Hi.

 

If you're talking about components, you can use the className or classList properties to manipulate the class names.

 

Or you can just use the classes that Animate generates automatically for the components based on their types. For example:

Button  -> ui-button

CheckBox -> ui-checkbox

ComboBox -> ui-combobox

 

So if you want to select all combo boxes, you can write:

stage.on("drawend", function()
{
    console.log(document.querySelectorAll(".ui-combobox"));
}, this, true);

 

I hope this helps.

 

Regards,

JC

 

 

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
Engaged ,
Feb 20, 2022 Feb 20, 2022

Thanks JC.  Useful information.

 

However, my question was about classes for symbols (e.g. graphic, buttons etc),  not components.

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
Engaged ,
Feb 21, 2022 Feb 21, 2022

Any chance on an answer to this?

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
Engaged ,
Feb 21, 2022 Feb 21, 2022

If symbols can't have classes (as opposed to IDs...) because they are part of Canvas, and not in the DOM, then is there a way that.  For example, to refer as elements of an array, or something else?

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
Engaged ,
Feb 21, 2022 Feb 21, 2022
LATEST

If Animate HTML5 Canvas is using CreateJS, there seems to be an addClass method.  Can I use this to ssign classes to symbols?

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