Skip to main content
Participating Frequently
May 5, 2023 2:29 PM UTC
Answered

Converting AS to html5 - changing variable within movieclip

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 is closed to new replies. Start a new post to keep the conversation going.
    JoãoCésar17023019
    JoãoCésar17023019Correct answer
    Community Expert
    May 5, 2023 2:45 PM UTC

    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 

    4 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    May 5, 2023 2:45 PM UTC

    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 

    Translate
    garydgAuthor
    Participating Frequently
    May 5, 2023 3:04 PM UTC

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

     

    Translate
    kglad
    Community Expert
    Community Expert
    May 5, 2023 3:09 PM UTC

    it will work during testing, too.

    Translate