3 Replies Latest reply on May 3, 2016 1:09 PM by arlinh39963375

    Resize stage to fit browser in Animate CC HTML5 Canvas

    arlinh39963375

      Hello! I'm really hoping someone can help me with this.

       

      In the HTML5 option in Animate CC, I'm looking to have the stage resize to fit whatever screen/browser size it happens to be viewed in. BUT:

       

      1. I don't want the content on the stage to scale with he stage resize.
      2. I do want the content to maintain its position on the stage with regards to its assigned coordinates.

       

      Below is the code I have so far for assigning coordinates for movie clips, which works perfectly:

       

      ------------------------------

      var r = this;

      var w = stage.canvas.width;

      var h = stage.canvas.height;

       

      r.an0.x = w/2;

      r.an0.y = h/2;

       

      r.an1.x = 40;

      r.an1.y = 40;

       

      r.an2.x = w - 40;

      r.an2.y = 40;

       

      r.an3.x = 130;

      r.an3.y = h-40;

       

      r.an4.x = w-40;

      r.an4.y = h-40;

      ------------------------------

       

      (the "an1-an4" are names of movie clips on the stage). Now, if I could just get the stage to fill the whole browser and the content to maintain its position and original size on the resize, that would be golden. I used to be able to do this no problem in Actionscript 2.0/3.0 but just can't seem to get a handle on it in the Javascript/HTML5 environment. ANY HELP would be GREATLY appreciated!

       

      Best!

      ALH