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 <[email protected]> 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.