Skip to main content
Participating Frequently
May 5, 2023
Answered

Converting AS to html5 - changing variable within movieclip

  • May 5, 2023
  • 1 reply
  • 460 views

Hello,

I have an old Flash ActionScript game I would like to convert to html5.

In a movieclip, I would change a variable located in the root using:

_root.heroStatus = "movingRight";

How would I do the same in html5?

Thanks

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    One of the ways of doing this is to use the global exportRoot variable that is generated automatically in the publishing process. Like this:

    exportRoot.heroStatus = "movingRight";

     

    I hope this helps.

     

    Regards,

    JC 

    1 reply

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    May 5, 2023

    Hi.

     

    One of the ways of doing this is to use the global exportRoot variable that is generated automatically in the publishing process. Like this:

    exportRoot.heroStatus = "movingRight";

     

    I hope this helps.

     

    Regards,

    JC 

    garydgAuthor
    Participating Frequently
    May 5, 2023

    Thanks! I will try this. Does this only work when I publish, or will it work when I test in Animator too?

     

    kglad
    Community Expert
    Community Expert
    May 5, 2023

    it will work during testing, too.