Skip to main content
Participant
August 31, 2021
Answered

JavaScript. How to spawn movie clip on a specific spawnpoint?

Is this possible in this program? Just I can't find something like object spawning in documentation

    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
    August 31, 2021

    Hi.

     

    In the HTML5 Canvas document, go to the Library, select the desired symbol and give it a linkage name.

     

    Then add this code at say frame 0 of the main timeline:

    var player = new lib.Player(); // Player is the linkage name in the Library
    player.x = 275;
    player.y = 200;
    this.addChild(player);

     

    I hope this helps.

     

    Regards,

    JC

    1 reply

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    August 31, 2021

    Hi.

     

    In the HTML5 Canvas document, go to the Library, select the desired symbol and give it a linkage name.

     

    Then add this code at say frame 0 of the main timeline:

    var player = new lib.Player(); // Player is the linkage name in the Library
    player.x = 275;
    player.y = 200;
    this.addChild(player);

     

    I hope this helps.

     

    Regards,

    JC

    Translate