You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Jason Moore <ja...@harksolutions.co.uk> on 2014/12/05 17:54:40 UTC

WindowApplication.as edit / ApplicationDPI scaling bug ?

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 :)

Re: WindowApplication.as edit / ApplicationDPI scaling bug ?

Posted by Alex Harui <ah...@adobe.com>.

On 12/5/14, 8:54 AM, "Jason Moore" <ja...@harksolutions.co.uk> wrote:

>
>Is there something special about the WindowedApplication.as ... is it
>overridden somewhere in the build?

Can you provide more details on your workflow?  Are you using an IDE or
Ant? You change WindowedApplication.as in what folder?  How do you point
to that folder?  What compiler options are you using to do that? Etc.

Normally, setting source-path to point to the right place should make that
override the SWCs.

-Alex


RE: WindowApplication.as edit / ApplicationDPI scaling bug ?

Posted by Jason Moore <ja...@harksolutions.co.uk>.
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 fine)

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
                        xmlns:mx="library://ns.adobe.com/flex/mx"
                        applicationDPI="160"
                        creationComplete="init()">

     <fx:Script>
         <![CDATA[
             import mx.events.FlexEvent;

             protected function init():void
             {
                 var newScale:Number = 2;
                 grp.scaleX = newScale;
                 grp.scaleY = newScale;
             }
         ]]>
     </fx:Script>

     <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;" 
fontSize="24"/>

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

     </s:Group>

</s:WindowedApplication>

Lee Burrows
ActionScripter

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 :)
>>
>
>


Re: WindowApplication.as edit / ApplicationDPI scaling bug ?

Posted by Subscriptions <su...@leeburrows.com>.
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 fine)

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
                        xmlns:mx="library://ns.adobe.com/flex/mx"
                        applicationDPI="160"
                        creationComplete="init()">

     <fx:Script>
         <![CDATA[
             import mx.events.FlexEvent;

             protected function init():void
             {
                 var newScale:Number = 2;
                 grp.scaleX = newScale;
                 grp.scaleY = newScale;
             }
         ]]>
     </fx:Script>

     <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;" 
fontSize="24"/>

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

     </s:Group>

</s:WindowedApplication>

Lee Burrows
ActionScripter

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 :)
>>
>
>


Re: WindowApplication.as edit / ApplicationDPI scaling bug ?

Posted by Subscriptions <su...@leeburrows.com>.
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 :)
>