Skip to main content
Inspiring
Mar 29, 2022 11:04 PM UTC
Answered

apk shows different to the emulator (position of a movieclip)

Good Morning!. I am making an app in animate for android. I put a movieclip with this code so that it appears at the bottom in the center (the mc pruebaPie has the position at the bottom right,you can see it on the screenshot screenshot 😞

 

pruebaPie.x = stage.stageWidth;
pruebaPie.y = stage.stageHeight;

 

in debugging it works perfectly, but in the apk file the movieclip doesn't come out!!!

 

I appreciate the help very much. 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
    Mar 30, 2022 12:33 AM UTC

    Hi.

     

    In mobile devices, the stage usually is scaled so you have to take this change into account.

     

    I usually store the scale when the app runs like this:

    var scale:Number = stage.stageHeight / 720; // 720 is the height of the stage set in the IDE

     

    And then if I need to get the full width I do like this:

    var fullWidth:Number = stage.stageWidth / scale;

     

    I have a sample here:

    https://github.com/joao-cesar/adobe/tree/master/animate%20cc/as3/responsive_app_game_structure

     

    I hope this helps.

     

    Regards,

    JC

    7 replies

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    Mar 30, 2022 12:33 AM UTC

    Hi.

     

    In mobile devices, the stage usually is scaled so you have to take this change into account.

     

    I usually store the scale when the app runs like this:

    var scale:Number = stage.stageHeight / 720; // 720 is the height of the stage set in the IDE

     

    And then if I need to get the full width I do like this:

    var fullWidth:Number = stage.stageWidth / scale;

     

    I have a sample here:

    https://github.com/joao-cesar/adobe/tree/master/animate%20cc/as3/responsive_app_game_structure

     

    I hope this helps.

     

    Regards,

    JC

    Translate
    Inspiring
    Apr 3, 2022 10:24 PM UTC

    Hello. Your contribution has been of great help to me, thank you very much! I have understood perfectly how to place objects in space. Fantastic!
    Thank you very much again

    Translate
    JoãoCésar17023019
    Community Expert
    Community Expert
    Apr 4, 2022 9:47 AM UTC

    Awesome, Joaquin!

     

    You're welcome!

    Translate