Jump to content
Search Community

How to keep handler not scale?

zrfting test
Moderator Tag

Recommended Posts

Hi

I have a sprite in UIComponent.

When the UIComponent 's  Scale change. TransformManager 's handler changed also.

 

How to keep handler not scale?

 

post-17718-0-57803000-1387719338_thumb.png

post-17718-0-54046700-1387719353_thumb.png

			public var manager:TransformManager = new TransformManager();
			
			protected function initApp(event:FlexEvent):void
			{
				var sprite:Sprite = new Sprite();
				sprite.graphics.beginFill(0xffdd00);
				sprite.graphics.drawRect(0,0,100,100);
				cont.addChild(sprite);
				
				var clipItem:TransformItem = manager.addItem(sprite);
			}
			
			protected function resizehandler(event:Event):void
			{
				cont.scaleX = nativeWindow.width/200;
				cont.scaleY = nativeWindow.height/200;
			}
			
			protected function cont_creationCompleteHandler(event:FlexEvent):void
			{
				nativeWindow.addEventListener(Event.RESIZE,resizehandler);
				
			}
		]]>
	</fx:Script>
	<mx:UIComponent id="cont" width="200" height="200" creationComplete="cont_creationCompleteHandler(event)"/>
Link to comment
Share on other sites

That's just how Flash works - if you scale a parent, its children also scale. I suppose you could counteract that manually by listening for a scale events and then do the math to invert the scale on the handles. So, for example, if the parent's scale is 2, the handles would be 1/2. If it's 4, the handles would be 1/4. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...