Skip to main content
Inspiring
February 20, 2022
Question

Symbols (HTML5 Canvas) - Assign Classes?

  • February 20, 2022
  • 2 replies
  • 369 views

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.

    This topic has been closed for replies.

    2 replies

    JoãoCésar17023019
    Community Expert
    Community Expert
    February 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

     

     

    FlatChatAuthor
    Inspiring
    February 21, 2022

    Thanks JC.  Useful information.

     

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

    FlatChatAuthor
    Inspiring
    February 20, 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.

     

    FlatChatAuthor
    Inspiring
    February 20, 2022

    CCC should be CSS...