Skip to main content
cleca
Participant
April 7, 2012
Answered

flash pro & flash builder : difference in resolution

  • April 7, 2012
  • 1 reply
  • 1633 views

I have already developed with flash pro for Android (Actionscript 3 - android 2.3.3 - Air 2.6). I'm trying to use Flash Builder (to have more developper's functionnalities).

But with the same code (an example from Véronique Brossier Book) I can't obtain the same result.

With flash pro, my three sprites are at 150, 350 and 550 pixels from the top.

With flash builder, they are at above 350, 550 and 750.

I'have the same result on my device (Galaxy Note) or emulated one.

In flash pro I can specify height & width of the stage. I have not found same parameters in flash builder.

What could be wrong in my process ?

the main code is here :

     public  function FirstApp() {

            // constructor code

            var callButton:Sprite=createSprite(0xFF3300,100, 100);

            callButton.addEventListener(MouseEvent.CLICK, callMe);

            addChild(callButton);

           

            var textButton:Sprite=createSprite(0x0099FF,100, 200);

            textButton.addEventListener(MouseEvent.CLICK, textMe);

            addChild(textButton);

           

            var mailButton:Sprite=createSprite(0x00FF11,100, 300);

            mailButton.addEventListener(MouseEvent.CLICK, mailMe);

            addChild(mailButton);

        }

       

        function createSprite(hue:int, xPos:int, yPos:int):Sprite {

            var tmp:Sprite = new Sprite();

            tmp.graphics.beginFill(hue, 1);

            tmp.graphics.drawRect(xPos, yPos, 200, 100);

            tmp.graphics.endFill();

            tmp.x = xPos;

            tmp.y = yPos;

            return tmp;           

        }

This topic has been closed for replies.
Correct answer

Thank you Colin for the link. But the indication for using meta data such as doesn't change anything to my problem (they indicate to put the line : : [SWF(width="480", height="800", backgroundColor="#ffffff", frameRate="30")] just before the main class definition).

So I will calculate by myself the dimension, based on device capabilities.

Thank you for your help.


Yes it is better to calculate the dimensions depending on device capabilies to account for devices with different sizes and for different screen orientation portrait/landscape.

>>I try to play with the value of StageScaleMode with no success. I would like to obtain same result as in Flash pro. In flash pro I specified the width and height of my stage and I asked a "full screen" application in paramaters. So, wathever device I use, the application had the same look.

Do you know if there is a way, in flash builder, to get this behavior ?

The default StageScaleMode is SHOW_ALL in which case if the device's screen doesnot match the stage size you specify in FlashPro, the content would be scaled up or down so as to show all the stage contents. This may show borders if the aspect ratio of stage is not the same as aspect ratio of device screen.

If you set it to StageScaleMode.NO_SCALE none of your content would be scaled which is why you are seeing small sprites.

To make it look like Flash Pro, in the SWF meta data tag enter the height and width same as Flash Pro Document width and height.

set align to top left as you already did but leave the StageScaleMode to SHOW_ALL.

1 reply

Inspiring
April 7, 2012

Hello Cleca,

I am Véronique Brossier so I think I can answer your question

There is nothing wrong with your process.

There is indeed a difference using Flash Builder. It seems to not calculate positions from the top left (it was not an issue when I wrote the book).

Add the following code:

import flash.display.StageAlign;

import flash.display.StageScaleMode;

// before creating the sprites

stage.align = StageAlign.TOP_LEFT;

stage.scaleMode = StageScaleMode.NO_SCALE;

It should now position your sprites correctly. Let me know if you still see problems.

p.s. You may want to try use a more recent version of AIR. 3.3 is now in the labs. Most of the book content is still up-to-date except the chapter about hardware acceleration. Also, note that the majority of the material (camera is a bit different) is applicable to use for AIR for iOS.

cleca
clecaAuthor
Participant
April 8, 2012

Yeah :-) it's a nice surprise having an answer from the author of my bdeside book !

I appreciate the level of detail. It's a very good stuff for such programmer as I am that wants to come to Android with flash.

So, I take your code in my project :

// before creating the sprites

stage.align = StageAlign.TOP_LEFT;

stage.scaleMode = StageScaleMode.NO_SCALE;

It corrects the position regarding top-left corner. But I loose the scale mode. So on my Galaxy Note (800x1280) the three sprites are very little.

I try to play with the value of StageScaleMode with no success. I would like to obtain same result as in Flash pro. In flash pro I specified the width and height of my stage and I asked a "full screen" application in paramaters. So, wathever device I use, the application had the same look.

Do you know if there is a way, in flash builder, to get this behavior ?

I have installed and configured flash builder to use AIR 3.3. The problem is the same.

best regards

Colin Holgate
Inspiring
April 8, 2012

I don't use Flash Builder, but I think you have three choices. You can work in Flash Pro and just use Flash Builder as the code editor, you can make a swf in Flash Pro that become part of the Flash Builder ActionScript project, or you can embed a line in the document class that creates the stage parameters.

Look at the discussion on this page:

http://board.flashkit.com/board/showthread.php?t=761945