Jump to content
Search Community

use selectedTargetObjects to fit item to widow

Dcoo test
Moderator Tag

Recommended Posts

It seems I can use "manager.selectedTargetObjects" to change dropShadowFilter, color, opacity and so many other things.
but I cant seem to get it to resize an item. when i click my button, the bitmap inside the holder resizes and snaps back when you click on the item again. but if i was to put a drop shadow on the same way it works on the holder..

shot1b.png
 
shot2b.png
 
 
 
 
 
Any help would be most appreciated.
 
 
 
 
fit_in.buttonMode = true;
 
fit_in.addEventListener(MouseEvent.CLICK, fitwindow);
 
 
function fitwindow(e: MouseEvent): void {
 
var myh = stage.stageHeight - 57.7;
var myw = stage.stageWidth; 
 
var items: Array = manager.selectedTargetObjects;
 
    
 var stageCenter_x:Number = stage.stageWidth/2;
 var stageCenter_y:Number = stage.stageHeight/2;
 
        
 var picCenter_x:Number = items.width/2;
 var picCenter_y:Number = items.height/2;
 
        
      items.x = stageCenter_x - picCenter_x;
      items.y = stageCenter_y - picCenter_y;
 
 
 
for (var i: int = 0; i < items.length; i++) {
TweenLite.to(items.target, 0.75,{x:picCenter_x, y:picCenter_y, width:myw, height:myh});
}
 
 
}

Link to comment
Share on other sites

Are you saying that you're manually changing the size/position/rotation of elements instead of going THROUGH TransformManager? If so, yes, that'd cause things to get out of calibration but you should be able to call the TransformManager's updateSelection() method to force it to redraw the selection properly. 

 

I'd actually recommend going through TransformManager to make any of those changes. For example, instead of changing the target's x/y/width/height, change the TransformItem's properties itself. That'll ensure that things stay in sync. 

Link to comment
Share on other sites

  • 2 weeks later...

Are you saying that you're manually changing the size/position/rotation of elements instead of going THROUGH TransformManager? If so, yes, that'd cause things to get out of calibration but you should be able to call the TransformManager's updateSelection() method to force it to redraw the selection properly. 

 

I'd actually recommend going through TransformManager to make any of those changes. For example, instead of changing the target's x/y/width/height, change the TransformItem's properties itself. That'll ensure that things stay in sync. 

I'm not sure how to change the TransformItem's properties since there dynamically created clones? and also not sure how to use the updateSelection method, but I'm defiantly not doing it right here: ( I've used the name of my Transfommanager )

for (var i: int = 0; i < items.length; i++) {TweenLite.to(items[i].target, 0.75,{x:picCenter_x,, width:myw, height:mph});
manager.updateSelection();


}
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...