Skip to main content
jonh15311545
Known Participant
November 13, 2020
Question

Use the data-* attribute to embed custom data

  • November 13, 2020
  • 1 reply
  • 563 views

Is there a way I can assign extra/other data params to movieclips like we can do with html a tags - https://www.w3schools.com/tags/att_global_data.asp

I have.a bunch of movie clip icons where I need to assign each a group of values I can access in an onclick function. For now I just need to do a javasctip alert and show the values when an icon is clicked. For example, I'd like to add something like data-name="Thunderbird", data-level="Expert", data-link="https://mylink.com".

    This topic has been closed for replies.

    1 reply

    Legend
    November 13, 2020

    In Canvas documents movieclips are just JavaScript objects, so you can add whatever properties or methods you want to them.

    jonh15311545
    Known Participant
    November 13, 2020

    Can you point me in direction on code examples, I'm not sure wha to search for to find this. Thanks.

    jonh15311545
    Known Participant
    November 13, 2020

    Found this, but how would I attached the info to a movieclip?

    https://www.dyn-web.com/tutorials/object-literal/properties.php