Scale a movie clip dynamically using JS (canvas document)
Hello all,
I am coming back to Animate CC after using Flash many years ago. Currently, I'm playing with a fullscreen page based on Joseph Labrecque's excellent demo.
Original from Joseph: http://inflagrantedelicto.memoryspiral.com/2016/02/responsive-scaling-in-animate-cc/
My example: http://iantompkins.com/animate/responsive3.html
So far, I have managed to modify the published html so that the canvas size is changed the width and height of the window when the page loads. Joseph's code does a good job pinning the movie clips to certain places in the window.
What I need now is to be able to change the width and height of a movie clip at different window sizes, much like breakpoints on a responsive site. You can see in my example that I have added a translucent white box. Ideally, I would like this box to be the size of the window, and I would load content into it when a button is clicked. Is there a way to alter a movie clip's dimensions with javascript?
I have tried something like this on frame 1, where "win1" is the instance name of the white box, but this was honestly just a shot in the dark:
var r = this;
var objw = stage.canvas.width;
var objh = stage.canvas.height;
r.win1.width = objw;
r.win1.height = objh;
Any ideas on what I could try next?
