Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by bhoffmann

  1. I am trying to round off rotations to the neatest 90 degrees and then scale the transform items to fit to the left or right side of the stage. I know how to round off the rotations, but I can't seem to get the positioning and the scaling right (because the x and y values change after the rotation). Here is the code I am using:P private function rotateAroundCenter (ob:*, angleDegrees:Number, ptRotationPoint:Point):void { var m:Matrix=ob.transform.matrix; m.tx -= ptRotationPoint.x; m.ty -= ptRotationPoint.y; m.rotate (angleDegrees*(Math.PI/180)); m.tx += ptRotationPoint.x; m.ty += ptRotationPoint.y; ob.transform.matrix=m; } private function scaleToFit($side) { var itemAbsRotation:Number = Math.abs(tItem.targetObject.rotation); var rotateNum:Number = 0; var ptRotation:Point = new Point(_currRollOver.width/2, _currRollOver.height/2); if(itemAbsRotation > 0 && itemAbsRotation < 135) { rotateNum = roundToNearest(90, itemAbsRotation); }else if(itemAbsRotation > 134 && itemAbsRotation < 213) { rotateNum = roundToNearest(180, itemAbsRotation); }else if(itemAbsRotation > 213 && itemAbsRotation < 45) { rotateNum = 0; } rotateAroundCenter(_currRollOver.targetObject, rotateNum,ptRotation); if(imgInfo.type == "COLOR") { pX = _mainAppStage.x; pY = _mainAppStage.y; if($which == "left") { _currRollOver.width = _mainAppStage.width/2; _currRollOver.height = _mainAppStage.height; _currRollOver.x = pX; _currRollOver.y = pY; }else if($which == "right") { _currRollOver.width = _mainAppStage.width/2; _currRollOver.height = _mainAppStage.height; if(mirrorOffset == false) { _currRollOver.x = _mainAppStage.width/2 + _currRollOver.width/2 + 2; _currRollOver.y = _mainAppStage.y; }else { _currRollOver.x = _mainAppStage.width + _currRollOver.width/2; _currRollOver.y = _mainAppStage.y; } } }
  2. I would like to know what you think is the best way to go about this: I have a design canvas where users can add images, rotate, scale, etc. Once they are finished their design I want to "render" everything at a larger scale (for print purposes). I am doing this by taking the transform manager and applying it to a new (hidden) object with all the same objects from the previous one in it. Now, let's say I want to scale the entire canvas up by 2.5... is there a simple way to do this? Right now I am trying to loop through all the items and scale them. but that doesn't work exactly as I thought. Some of the x & y values are off.
  3. Is there a way for me to mirror an image ( scaleX * -1) while still maintaining the same x,y coordinates? If the item is at 0,0 and is 150px wide and I multiply scaleX * -1, the items x value is then 150,0. I want to mirror the image, but keep it in place, and not have the xy coordinates change. Maybe I'm thinking about this the wrong way, but any suggestions would be helpful.
  4. Well, I am trying to do just that. 1. I call applySavedXML(). 2. I loop through the transformanager to find any objects that might be missing their target object 3. I add an MC to those items with the name that I find in the xml No Dice. Do I need to call it twice? I feel like I need to call it first to be able to first figure out what is missing, then maybe a second time after the item has been added?
  5. I have set up undo functionality where I save transformmanager xmls into an array, then when the user clicks 'undo' it just applies the previous xml using applySavedXML(). This works great, but it gets a little tricky when I undo an item after I have deleted an image or textfield. A gray box appears in the transformitem. I have managed to load back in the image into the correct transformitem but I am having a problem with text. When I bring the textfield back in I can still see the gray box. The textfield is being added to a movieclip that is then added to the targetObject of the transformItem. Any way I can make the gray box dissapear? I tried looping through the children of the transformItem and all I could find was the movieClip I added.
  6. Ok I fixed it. The problem was putting a display object inside of a container inside of a transform object. As soon as I put a bitmap inside of a container inside of a tItem, it stopped dissapearing.
  7. The TF manager is a great, great tool, but I am having a weird problem. I created a little menu that allows me to crop an image, and then once it is cropped it creates a new transform manager item with the cropped image, and deletes the old one. This is all well and good, works fine until I roll off the stage. Like if I roll my mouse cursor over the browser bar, the image completely dissapears. This doesn't happen to the item right after I cropped it. Not sure what is causing this, or even how I would test this. Anyone else run into a similar problem or know what might be going on here? Even if it's a direction to look in, the help would be great. Thanks.