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

Resize event not working properly on android

Explorer ,
Oct 05, 2018 Oct 05, 2018

I'm currently working on a responsive design for an android app. I wrote a resize event listener and tested it while setting the target to flash player so I could change the window size while testing. It worked properly, it also worked properly when testing it with the target set to AIR for Android. However when I installed the app on my own android device (samsung galaxy s7) several parts are misplaced.

Since it's working while testing I assume that I have written the actual event listener right but I don't understand why some items are misplaced on an actual device.

I have three different if statements in my resize listener, the other two works fine (two different settings for a portrait format) but only the landscape one is not working. It's quite a lot of code for the entire resize event so I'll just add the part of the code that covers the landscape setting. I have added "import flash.display.StageScaleMode;" and "import flash.display.StageAlign;", scaleMode is set to "NO_SCALE" and align is set to "TOP_LEFT"

else if (swfWidth > swfHeight * 1.16) {

Panels2color.visible = true;

Panels2.visible = true;

Background.height = swfHeight;

Background.scaleX = Background.scaleY;

Background.x = Panels2.width + (Background.width * 0.5) + ((stage.stageWidth - Panels2.width - Background.width) * 0.5);

Background.y = stage.stageHeight / 2;

Character.scaleY = Background.scaleY;

Character.scaleX = Character.scaleY;

Character.x = Panels2.width + (Background.width * 0.5) + ((stage.stageWidth - Panels2.width - Background.width) * 0.5);

Character.y = stage.stageHeight / 2;

Panels2color.scaleX = Background.scaleX;

Panels2color.scaleY = Panels2color.scaleX;

Panels2color.x = (Panels2color.width * 0.5) + ((stage.stageWidth - Panels2.width - Background.width) * 0.5);

Panels2color.y = (stage.stageHeight * 0.22) + Panels2color.height;

Panels2.scaleX = Background.scaleX;

Panels2.scaleY = Panels2.scaleX;

Panels2.x = (Panels2color.width * 0.5) + ((stage.stageWidth - Panels2.width - Background.width) * 0.5);

Panels2.y = (stage.stageHeight * 0.22);

Landscapemenu.scaleX = Background.scaleX;

Landscapemenu.scaleY = Landscapemenu.scaleX;

Landscapemenu.x = (Panels2color.width * 0.5) + ((stage.stageWidth - Panels2.width - Background.width) * 0.5);

Landscapemenu.y = 0;

Landscapemenu.visible = true;

Panels3landscape.visible = true;

Panels1landscape.visible = true;

Panels3.visible = false;

Panels1.visible = false;

Panels2.Gotocolors.visible = false;

Panels2color.Gotoitems.visible = false;

Panels3landscape.scaleY = Background.scaleY;

Panels3landscape.scaleX = Panels3landscape.scaleY;

Panels3landscape.x = (Panels2color.width * 0.5) + ((stage.stageWidth - Panels2.width - Background.width) * 0.5) - (Panels2color.width * 0.42);

Panels3landscape.y = Landscapemenu.height * 0.845;

Panels1landscape.scaleY = Background.scaleY;

Panels1landscape.scaleX = Panels1landscape.scaleY;

Panels1landscape.x = (Panels2color.width * 0.5) + ((stage.stageWidth - Panels2.width - Background.width) * 0.5) - (Panels2color.width * 0.485);

Panels1landscape.y = Landscapemenu.height * 0.065;

}

Does anyone know what's wrong? I'll add photos that shows what I'm writing about and to make sense of the code I pointed out what parts have what instance name as well as where the registration point is, although since it's working properly when testing I have a hard time seeing that the actual resize event code is what's wrong...afawaw.png

sgesgse.png
Screenshot_20181005-210821_Nature Spirit Creator.jpg

Screenshot_20181005-210821_Nature Spirit CreatorPOINTS.png

TOPICS
ActionScript
256
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