Skip to main content
Inspiring
May 21, 2021
Question

problem mc responsive

  • May 21, 2021
  • 2 replies
  • 321 views

Hello. I have problems with this code to make it responsive: what I want is for a mc (back_mc) that is below the stage to stay below the stage, always at the same distance from the bottom of the stage, measure what the along the stage. This is the code I have used:

 

controladores_mc.back_mc.y = stage.stageHeight-70;

 

Curiously, it works well when I debug it on the computer, but the mc is not visible on the mobile ... it is very strange. I appreciate the help.

    This topic has been closed for replies.

    2 replies

    Community Expert
    May 23, 2021

    Try code snippets.

     

    Inspiring
    May 23, 2021

    I have succeeded.

    hen I tried to place the mc it in the middle of the stage with stage.stageHeight / 2, and stage.Stagewidth / 2, it was seen but not in the middle, but in an area very low on the right ... I have calculated with a ruler of three (the only mathematics that I handle) and I got this formula:

    drivers_mc.back_mc.y = (56 * stage.stageHeight) / 100;

    which is valid for my situation. but reposition the mc a few cm higher than the size of the stage (low) .... I have to try it on other mobiles, but I think it will work. Thanks to those who have responded.

    The truth is, I have no idea about using canvas. I'm with as3 and I don't know if both languages can be used at the same time. All the best.

    chenjil43641795
    Legend
    May 22, 2021

    Tested:

    let back_mcx = (canvas.width -70) / stage.scaleX
    let back_mcy = (canvas.height-70) / stage.scaleX

    controladores_mc.back_mc.x = back_mcx

    controladores_mc.back_mc.y =back_mcy

    Inspiring
    May 22, 2021

    Thank you very much for the reply.

    The compiler returns me the following error:

     

    1071: Syntax error: A definition keyword (such as function) was expected after the let attribute, not back_mcx.