Skip to main content
Participant
August 3, 2013
Question

Resizing/moving MovieClips to fit screen problem

  • August 3, 2013
  • 1 reply
  • 759 views

I'd like to make an Android and iOS app with Adobe AIR, but I found a problem I can't solve.

The Flash document size of the app is 800px x 600px, and I'd like to resize MovieClips to fit Android's and iOS' screens, suporting the Retina display on iOS devices.

I tried using StageDisplayState.FULL_SCREEN and StageScaleMode.SHOW_ALL, and this does seem to work with static MovieClips, so the snippet would look something like this:

import flash.system.Capabilities;

import flash.events.Event;

import flash.display.StageScaleMode;

import flash.display.StageDisplayState;

stage.addEventListener(Event.ENTER_FRAME,process);

var difN:Number = (((stage.stageHeight*stage.fullScreenWidth/stage.fullScreenHeight)-stage.stageWidth)/2);

function process(e:Event):void {

          difN = (((stage.stageHeight*stage.fullScreenWidth/stage.fullScreenHeight)-stage.stageWidth)/2);

          stage.scaleMode = StageScaleMode.SHOW_ALL;

}

stage.addEventListener(KeyboardEvent.KEY_UP,useFullScreen);

function useFullScreen(e:KeyboardEvent):void {

          if (e.ctrlKey) {

                    switch (e.keyCode) {

                              case Keyboard.M:

                                        stage.displayState = StageDisplayState.FULL_SCREEN;

                              break;

                              }

                    }

}

obj.x -= difN

However, I'd like to use classic tweens in my application, and this won't work since most of the elements are moving.

I'd like to rescale/move MovieClips so they don't look distorted and every moving item moves correctly, showing all the content and trying to not make any borders. I read this article but it seems like it doesn't support classic tweens: http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html.

Thanks for the help.

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
August 3, 2013

1. scaleMode only has an effect when you embed your swf in an html AND you publish for a percentage.

2. you need to resize your displayobjects using code and/or in the ide.  if you open your document settings panel (modify>document) and change your stage size you are offered some scaling options.  see if any work for you.