Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A
Accepted Solution

Display Automatically Scaled In Simulator?

i've suddenly begun to experience an automatic scaling problem with debugging on the PlayBook Simulator from Flash Builder 4.

 

a clean install of the simulator image didn't help.

 

attached is an image of 2 QNX LabelButton components.  the coordinate of the top button is (suppose to be) x:20, y:20, and it goes without saying that the buttons are huge. 

 

any ideas?

 

Screen shot 2011-01-12 at 7.04.57 AM.png

 


PlayBook Applications:
Drop Swatch
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Display Automatically Scaled In Simulator?

I've had strangeness like that when I did various things, including leaving out the height and width arguments in the [SWF] metadata tag before my main class, leaving the SWF tag off entirely, and mucking around with stage.scaleMode in inappropriate ways. 

 

Any chance you've done something like that?


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Display Automatically Scaled In Simulator?

ouf!  i've been working with Flash Professional so much that i've completely forgot about setting the SWF metadata tag.  thanks!


PlayBook Applications:
Drop Swatch
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Display Automatically Scaled In Simulator?

to make my application more portable and more futureproof, i've been setting the stage properties during initialization instead of hard coding height and width properties in SWF metadata:

 

package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;

[SWF(backgroundColor="#000000")]
public class Main extends Sprite
{
	public function Main()
	{
	stage.scaleMode = StageScaleMode.NO_SCALE;
	stage.align = StageAlign.TOP_LEFT;
	stage.frameRate = 60;

	init();
	}

	...

instead of:

 

[SWF(width="1024", height="600", frameRate="60", backgroundColor="#000000")]

this way i can target any screen and use the stage.stageWidth, stage.stageHeight and other calls to appropriately scale and/or position my display assets at runtime.

 

 


PlayBook Applications:
Drop Swatch
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Display Automatically Scaled In Simulator?

I do the same now, though I have been either leaving frameRate out entirely (as it defaults to 24 with Flash), or leaving it in the SWF() statement if my code is never going to change it.

 

I experimented with removing the backgroundColor property from there as well, but was unable to figure out what property on the stage or anything else would replace it.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A

Re: Display Automatically Scaled In Simulator?

 


peter9477 wrote:

 

I experimented with removing the backgroundColor property from there as well, but was unable to figure out what property on the stage or anything else would replace it.


yeah, it's very strange that the Stage class doesn't have a backgroundColor property - or at least a public, documented one.

 


PlayBook Applications:
Drop Swatch
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Display Automatically Scaled In Simulator?

It does have the opaqueBackground property, but that did nothing for me.  Might have been me, not AIR.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Developer
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Display Automatically Scaled In Simulator?

Oh, right... that's documented as one of the not-implemented properties of stage, so of course it doesn't work.


Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!