You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Tom Berry <to...@yopmail.com> on 2013/12/30 05:42:52 UTC

Flex Application Stage Size and Scaling

I am trying to create a Web and Desktop flex application for people who may
have less than perfect vision. I would like to allow the users to magnify
everything on the screen (including text, buttons, images, etc.) if
necessary. I have gotten the magnification step down using the following
code in the main Application

var matrix:Matrix = this.transform.matrix;
var scale:Number = 2;        
matrix.scale(scale, scale);
this.transform.matrix = matrix; // this refers to the main Application

Of course, by doing so, the Flex Application will be too big for the Flash
Player window and only the top left quarter of the application is visible. I
figure the next step is to decrease the Flex Application stage size by 50%
to compensate. For some reasons, I can't figure out how to change the stage
size of the Flex Application so that it only occupies the top left quarter
of the Flash Player window.

Any thoughts? Thanks a lot!



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-Application-Stage-Size-and-Scaling-tp4299.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Flex Application Stage Size and Scaling

Posted by Alex Harui <ah...@adobe.com>.
There is no API to set the stage size for browser/web apps via
ActionScript.  The stage is sized by the HTML wrapper.  In theory, you
could write JavaScript code in the HTML wrapper and call it via
ExternalInterface.

Note that Flash has some built in pan/zoom capabilities on the right-click
menu.  OTOH, I don't remember if Flex turns off these options by default
or not.  You may also need to follow the rules explained here:
http://blogs.adobe.com/aharui/2008/01/flex_and_scalemodes.html

-Alex

On 12/29/13 8:42 PM, "Tom Berry" <to...@yopmail.com> wrote:

>I am trying to create a Web and Desktop flex application for people who
>may
>have less than perfect vision. I would like to allow the users to magnify
>everything on the screen (including text, buttons, images, etc.) if
>necessary. I have gotten the magnification step down using the following
>code in the main Application
>
>var matrix:Matrix = this.transform.matrix;
>var scale:Number = 2;
>matrix.scale(scale, scale);
>this.transform.matrix = matrix; // this refers to the main Application
>
>Of course, by doing so, the Flex Application will be too big for the Flash
>Player window and only the top left quarter of the application is
>visible. I
>figure the next step is to decrease the Flex Application stage size by 50%
>to compensate. For some reasons, I can't figure out how to change the
>stage
>size of the Flex Application so that it only occupies the top left quarter
>of the Flash Player window.
>
>Any thoughts? Thanks a lot!
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Flex-Application-Stage-Size
>-and-Scaling-tp4299.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Flex Application Stage Size and Scaling

Posted by Tom Berry <to...@yopmail.com>.
That is a good idea. Thanks a lot. It's not as elegant as I would have
wanted, but it works.

Once again, thanks for the quick response.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-Application-Stage-Size-and-Scaling-tp4299p4302.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Flex Application Stage Size and Scaling

Posted by Jesse Ward-Karet <jw...@tanium.com>.
Hi Tom,

I added the ability to to zoom using control +/- to my app with the following code. It doesn't properly handle setting the correct zoom level for PopUpManager children that are created later, but that should be easy enough to add. Hope this helps (note, mainCanvas is my top level UI container):

stage.addEventListener(KeyboardEvent.KEY_UP, keyUp);

private function keyUp(event:KeyboardEvent):void
{
	if (event.ctrlKey && ( event.keyCode == Keyboard.EQUAL || event.keyCode == Keyboard.MINUS ))
	{
		zoom( event.keyCode == Keyboard.EQUAL );
	}
}

protected function zoom(increase:Boolean):void
{
	scale(mainCanvas, increase);
	
	var rawChildren:IChildList = FlexGlobals.topLevelApplication.systemManager.rawChildren;
	for ( var i:int = 0; i < rawChildren.numChildren; i++ )
	{
		var childObject:DisplayObject = rawChildren.getChildAt(i);
		if ((childObject is UIComponent) && UIComponent(childObject).isPopUp)
		{
			scale(childObject as UIComponent, increase);
		}
	}
}

private function scale(target:UIComponent, increase:Boolean):void
{
	var inc:Number = .1;
	if (increase && target.scaleX < 2)
	{
		target.scaleX += inc;
		target.scaleY += inc;											
	}
	else if (!increase && target.scaleX > .5 )
	{
		target.scaleX -= inc;
		target.scaleY -= inc;	
	}
}

On Dec 29, 2013, at 8:42 PM, Tom Berry <to...@yopmail.com> wrote:

> I am trying to create a Web and Desktop flex application for people who may
> have less than perfect vision. I would like to allow the users to magnify
> everything on the screen (including text, buttons, images, etc.) if
> necessary. I have gotten the magnification step down using the following
> code in the main Application
> 
> var matrix:Matrix = this.transform.matrix;
> var scale:Number = 2;        
> matrix.scale(scale, scale);
> this.transform.matrix = matrix; // this refers to the main Application
> 
> Of course, by doing so, the Flex Application will be too big for the Flash
> Player window and only the top left quarter of the application is visible. I
> figure the next step is to decrease the Flex Application stage size by 50%
> to compensate. For some reasons, I can't figure out how to change the stage
> size of the Flex Application so that it only occupies the top left quarter
> of the Flash Player window.
> 
> Any thoughts? Thanks a lot!
> 
> 
> 
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Flex-Application-Stage-Size-and-Scaling-tp4299.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.