flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Moore <jason.mo...@harksolutions.co.uk>
Subject RE: WindowApplication.as edit / ApplicationDPI scaling bug ?
Date Mon, 08 Dec 2014 10:16:32 GMT
I think your right in identifying a work around, fixing the sdk is proving harder than I hoped
and I'm lacking the familiarity to isolate the issue. Plus it could be a while before I got
anything through the release process.

I've had a play around and I think I've come up with a variation/extension to your solution
that does the job for me.

I still set the applicationDPI  / runtimeDPI and then set the application contentGroup size
to the application system manager screen dimensions. The math is basically as you've described
except I'm using the application contentGroup instead of putting in my own group and I'm letting
the system manager / internals carry out the scaling.

--- extract --

			// Changes the initial size of the application so it appears physically the correct size
according to the device DPI.		
			private function applicationCompleteHandler():void
				this.width /= this.applicationDPI / this.runtimeDPI;
				this.height /= this.applicationDPI / this.runtimeDPI;
			// Sets the application content width and hieght to the application's system managers calculated
screen size.
			protected function resizeHandler(event:ResizeEvent):void
				if (this.systemManager)
					if (this.systemManager.screen)
						this.contentGroup.width = this.systemManager.screen.width;
						this.contentGroup.height = this.systemManager.screen.height;		

--- extract end ---

I think this will do the job or something similar. 

Thanks for the help Lee, I'll post the work around on JIRA.

All the best

Jason :)

-----Original Message-----
From: Subscriptions [mailto:subscriptions@leeburrows.com] 
Sent: 05 December 2014 17:47
To: dev@flex.apache.org
Subject: Re: WindowApplication.as edit / ApplicationDPI scaling bug ?

This code works for me (by scaling a group). I leave it you to determine a suitable calculation
for newScale value. Custom runtimeDPIprovider not needed as default returns 160 (which is

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

             import mx.events.FlexEvent;

             protected function init():void
                 var newScale:Number = 2;
                 grp.scaleX = newScale;
                 grp.scaleY = newScale;

     <s:Group id="grp"
              left="0" right="0" top="0" bottom="0">

         <s:Label id="LeftMarker" left="0" verticalCenter="0" 
text="&lt;--- LEFT" fontSize="24"/>

         <s:Label id="MiddleMarker" horizontalCenter="0" 
verticalCenter="0" text="&gt; &gt; &gt; MIDDLE &lt; &lt; &lt;" 

         <s:Label id="RightMarker" right="0" verticalCenter="0" 
text="RIGHT ---&gt;" fontSize="24"/>



Lee Burrows

On 05/12/2014 17:37, Subscriptions wrote:
> I havent tested it but a possible workaround would be to avoid flex 
> scaling completely and write your own... either set stage.scaleX/Y as 
> appropriate (or maybe you will need to put all your content inside a 
> group and scale the group).
> Having said that, the more i think about it, i'm not sure scaling a 
> desktop app is ideal (even if window cant be resized by user) - but 
> i'm guessing your app is too far into development to change that?
> Lee Burrows
> ActionScripter
> On 05/12/2014 16:54, Jason Moore wrote:
>> Hi All,
>> I submitted a bug to the Jira system around how the application 
>> scaling using applicationDPI for desktop Air Apps seems to be broken.
>> I've included screenshots, example code etc.. so I won't go into 
>> detail here, if you're interested and can help please do have a look.
>> https://issues.apache.org/jira/browse/FLEX-34653
>> Anyway, I've checked out the source... and have been playing around 
>> but I can't seem to get any changes to the WindowedApplication.as
>> (\frameworks\projects\airspark\src\spark\components) to do anything. 
>> Trace statements don't work, I've even put in deliberate errors... to 
>> no effect.  Changes and trace statements in other parts of the 
>> framework such as systemManager.as appear so I know I'm compiling and 
>> using my edited source.
>> Is there something special about the WindowedApplication.as ... is it 
>> overridden somewhere in the build?
>> Any help appreciated.
>> Jason :)

View raw message