Copy link to clipboard
Copied
Hi! im working with this code:
var page_body = document.getElementsByTagName("body")[0];
page_body.style.backgroundColor = "#000000";
var page_canvas = document.getElementsByTagName("canvas")[0];
stageWidth = page_canvas.width;
stageHeight = page_canvas.height;
var r = this;
function onResize() {
if(page_canvas.width <= 700) {
//page_body.style.backgroundColor = "#000000";
r.Contents.gotoAndStop(1);
lib.properties = {width: 750, height: 1097};
}
else{
//page_body.style.backgroundColor = "#000000";
r.Contents.gotoAndStop(0);
lib.properties = {width: 1358, height: 601};
}
}
window.onresize = function () {
onResize();
}
onResize();
The idea of ​​this code is that when you see the main scene, if the width of the browser is less than 700px changes the size of the canvas of the document, and at the same time a frame changes to show a new layout, but it seems that it does not work correctly, they can Help me find what I am wrong at?
Have something to add?