Skip to main content
Participant
April 19, 2023
Question

Having trouble getting elements to hug the top and bottom of the screen on Mobile devices

  • April 19, 2023
  • 1 reply
  • 159 views

I have stage.scaleMode to "showAll" and trying to calculate the top using stage.stageHeight after the "added" event, but it doesn't seem to work.

 

The relevant bits of code look like this:

//default stage is 768x1024
//
screenwidth = stage.stageHeight;
screenheight = stage.stageHeight;

//hide nav above top edge
public function hidenav(){
     navcontainer.y = -400-(screenheight-1024)/2;
}		

//show nav on top edge		
public function shownav(){
     navcontainer.y = -(screenheight-1024)/2;
}
This topic has been closed for replies.

1 reply

JoãoCésar17023019
Community Expert
Community Expert
April 20, 2023

Hi.

 

You have to take into account the scale of the stage in mobile devices. Please read this answer:
https://community.adobe.com/t5/animate-discussions/apk-shows-different-to-the-emulator-position-of-a-movieclip/m-p/12845823#M352936

 

Regards,

JC