Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Animate Responsive Site Problem

Community Beginner ,
Feb 17, 2020 Feb 17, 2020

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?

TOPICS
Code , How to
105
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation