Jump to content


  • Posts

  • Joined

  • Last visited


1 Newbie
  1. I'll try that-thank you very much for your help! And yeah, I don't know why I referenced LoaderMax being that I'm Instantiating SWFLoader. My advice: don't get old! L
  2. Greetings from Boise, I'd like to create a single Instance of LoaderMax. I'd like to use that Instance to call one of several .swf's to load, dynamically, via a MouseEvent. myLoader.urlOrRequest = "myURL.swf" throws an 1119: "Access of possibly undefined property urlOrRequest through a reference with static type com.greensock.loading.SWFLoader." What am I missing, please? Thanks ahead of time! case this.palmer_Aerial.eastBuildingAerial: this.removeChild(this.palmer_Aerial); this.removeChild(this.mainTitle); changeLoader.urlOrRequest = "eastBuilding.swf" changeLoader.load(true); break;
  3. Oh-goodness, I don't think you're missing anything. It's much more likely that my comprehension is flawed. I'm trying to establish a rotation point using offsets from the Registration point to gain some understanding into the matter. I don't want to be a high-maintenance subscriber... Am spending a bit of time working out various potentials. Will certainly post it up if I can engineer a solution... Thanks! L
  4. Well, Jack-thanks very much for your very gracious help, but this is one I'm going to have to abandon. I'm just not able to "get it," I guess. Maybe over the New Year when I have some spare time I'll dive in just for grins-and if I do stumble into a solution I'll forward it on... Happy New Year!
  5. Well Jack, I guess we've just run into my own personal brick wall. BTW...I can't find a ShortRotationPlugin syntax for use with the RotateAroundPointPlugin in the documentation-but am not sure it could be used anyway. Here's the code (.fla). Everything works great except the Rotation (lines 72 & 73 below). Would you accept a feature request for a RotateAroundCursorPlugin with a LocalPoint Parameter? Ha! If there's something I'm doing wrong relative to the greensock stuff and it's obvious and no bother, let me know, please. //imports/activations/initializations import com.greensock.TweenLite; import com.greensock.easing.Quad; import com.greensock.plugins.TweenPlugin; import com.greensock.plugins.BlurFilterPlugin; import com.greensock.plugins.MotionblurPlugin; import com.greensock.plugins.ThrowPropsPlugin; import com.greensock.plugins.ShortRotationPlugin; import com.greensock.plugins.TransformMatrixPlugin; import com.greensock.plugins.TransformAroundPointPlugin; import com.greensock.OverwriteManager; import flash.geom.Point; import flash.events.Event; TweenPlugin.activate([blurFilterPlugin, MotionblurPlugin, ThrowPropsPlugin, ShortRotationPlugin, TransformMatrixPlugin, TransformAroundPointPlugin]); OverwriteManager.init(OverwriteManager.AUTO); TweenLite.defaultEase = Quad.easeOut; //dragBounds var dragBoundsWidth:int = 500; var dragBoundsHeight:int = 350; var dragBoundsX:int = 25; var dragBoundsY:int = 25; var dragBoundsRectangle:Rectangle = new Rectangle(dragBoundsX, dragBoundsY, dragBoundsWidth, dragBoundsHeight); //Variables var x1:int; var y1:int; var time1:Number; var time2:Number; var xVelocity:Number; var yVelocity:Number; var throwAngleDegs:Number; var grabPointA:Point = new Point(); var grabPointB:Point = new Point(); var rotatePointLocal:Point = new Point(); var rotatePointGlobal:Point = new Point(); //buttonMode/cursors cardA.buttonMode = true; cardA.addEventListener(MouseEvent.MOUSE_OVER, buttonCursor, false, 0, true); cardA.addEventListener(MouseEvent.MOUSE_OUT, normalCursor, false, 0, true); function buttonCursor(e:MouseEvent):void { Mouse.cursor = MouseCursor.BUTTON; } function normalCursor(e:MouseEvent):void { Mouse.cursor = MouseCursor.AUTO; } //Card Event Listeners & Functions cardA.addEventListener(MouseEvent.MOUSE_DOWN, dragCard, false, 0, true); cardA.addEventListener(MouseEvent.MOUSE_UP, throwCard, false, 0, true); function dragCard(e:MouseEvent):void { TweenLite.killTweensOf(cardA, false); Mouse.cursor = MouseCursor.HAND; x1 = cardA.x; y1 = cardA.y; time1 = getTimer(); grabPointA.x = stage.mouseX; grabPointA.y = stage.mouseY; rotatePointLocal = cardA.globalToLocal(grabPointA); cardA.startDrag(false, dragBoundsRectangle); cardA.addEventListener(Event.ENTER_FRAME, rotateCard, false, 0, true); } function throwCard(e:MouseEvent):void { Mouse.cursor = MouseCursor.AUTO; cardA.stopDrag(); time2 = (getTimer() - time1)/1000; xVelocity = (cardA.x - x1) / time2; yVelocity = (cardA.y - y1) / time2; TweenLite.to(cardA, 2.5, {throwProps:{x: {velocity: xVelocity, max: 400, min: 150}, y: {velocity: yVelocity, max: 300, min: 100}}}); } function rotateCard(e:Event):void { grabPointB.x = stage.mouseX; grabPointB.y = stage.mouseY; throwAngleDegs = (Math.atan2(grabPointB.y - grabPointA.y, grabPointB.x - grabPointA.x) * 180/Math.PI); TweenLite.to(cardA, 0, {transformAroundPoint: {point: rotatePointLocal, pointIsLocal: true, rotation: -throwAngleDegs}, onComplete: stopAnimation}); } function stopAnimation (e:Event):void { cardA.removeEventListener(Event.ENTER_FRAME, rotateCard); }
  6. Jack, I've found a couple of examples of the behaviors I'd like to TweenLite/TweenMax. Here's the first example: http://www.myflashxml.com/dynamic_photo_gallery/friction/index.html In that first example there is an elasticity that may or may not be necessary. Here's another example: http://www.sideroller.com/wck/ In the second example, the top Flash Window is a Box2D demo. The first demo has a bunch of shapes on Stage, which you can Click & Drag-they exhibit similar physics. The Object follows the Cursor as it should via startDrag(), but the Object responds to the Point at which the Cursor clicks and when it is drug, it simulates inertia: it aligns along the motion of the drag. Also, I do apologize for activating a Plugin twice in my code earlier...I'm sure this obligates me to purchase two GreenSock memberships! Ha!
  7. Well, if the code I threw out there does actually do what you want (I threw it together in a rush...my apologies) you could get by without TransformAroundCenterPlugin by just ensuring that any Shapes you build do have their Registration Point in the Center and just TweenLite'ing them as an Object without the Plugin. Good luck!
  8. Greetings from Beautiful Boise, UbiAssassin! I created a circular shape and converted it to a MovieClip, put an Instance on the Stage and named that instance buttonA. The Symbol's Registration Point is in the center. Here's the code I came up with: import com.greensock.TweenLite; import com.greensock.easing.Quad; import com.greensock.plugins.TweenPlugin; import com.greensock.plugins.TransformAroundPointPlugin; import com.greensock.OverwriteManager; TweenPlugin.activate([TransformAroundPointPlugin]); OverwriteManager.init(OverwriteManager.AUTO); TweenLite.defaultEase = Quad.easeOut; TweenPlugin.activate([TransformAroundPointPlugin]); var buttonDistance:Number; var cursorDistance:Number = 100; var buttonPoint:Point = new Point(buttonA.x, buttonA.y); var mousePoint:Point = new Point(mouseX, mouseY); var homePointButtonA:Point = new Point(stage.stageWidth / 2, stage.stageHeight / 2); stage.addEventListener(MouseEvent.MOUSE_MOVE, animateButton, false, 0, false); function animateButton(e:MouseEvent):void { buttonPoint.x = buttonA.x; buttonPoint.y = buttonA.y; mousePoint.x = mouseX; mousePoint.y = mouseY; buttonDistance = Point.distance(buttonPoint, mousePoint); trace(buttonDistance); trace(cursorDistance); if (buttonDistance <= cursorDistance) { TweenLite.to(buttonA, 1, {transformAroundPoint: {point: mousePoint}, x: mouseX, y:mouseY}); }else if (buttonDistance > cursorDistance) { TweenLite.to(buttonA, 3, {transformAroundPint: {point: buttonPoint}, x: homePointButtonA.x, y: homePointButtonA.y}); } My rationale is that I would create an Array out of Button Instances and use it to assign the MouseEvent.MOUSE_MOVE Listener. All I've done is tell the buttonA Instance to react to the Cursor when the Cursor gets within a certain distance (I used the flash.geom.Point.distance() Method to do that). That distance is var = cursorDistance. The way it's set up, at 24fps, one can easily "jerk" the Cursor out of range so that the buttonA Instance returns to the Stage center (homePointButtonA). This is purely coincidental-it would behave differently if the frame rate or other parameters were different. The way it's set up now feels about right...and I know that's pretty sloppy... So, if the Cursor gets within a certain distance the buttonA Instance will follow it, and when the Cursor gets a bit out of range, the buttonA Instance goes home. Just me and a concept-I'm not a motion expert by any measure. Good luck with your project!
  9. Looking around-just a thought in pseudocode: angleDegs = atan2(mouseY - cardY, mouseX - cardX); var angleRads = angleDegs * Math.PI/180 TweenLite.to (card, .5, {rotation: angleDegs}); I'll look more into RotateAroundPointPlugin in a bit. Any advice welcome. Thanks! Leo
  10. Greetings from Beautiful Boise! I have some playing card (rectangular) MovieClips on the Stage. I want to startDrag() them via MOUSE_DOWN, and stopDrag() them via MOUSE_UP, measuring the speed of the motion and decaying it via ThrowPropsPlugin. Easy enough, and that's complete/fully functional. But what I'd also like to do is have the rectangle respond to the direction of motion by rotating around the mouseX and mouseY point so that it is drug behind the cursor until MOUSE_UP. I have tried the RotateAroundPointPlugin and cannot seem to configure it properly. I can trace() the proper x and y (the local x & y of the Rectangle MC vice the global x & y on the Stage), and I can get appropriate atan2() traces as well...but the doggone rectangle won't rotate properly when being drug. I've got all of the physics for the drag & throw successfully coded, but cannot recognize a way to get the rectangle to properly follow the cursor. Any thoughts or suggestions...? Thanks! Leo //Variables var x1:int; var y1:int; var time1:Number; var time2:Number; var xVelocity:Number; var yVelocity:Number; var throwAngleDegs:Number; var grabPoint:Point = new Point(); var rotatePoint:Point = new Point(); //Card Event Listeners & Functions cardA.addEventListener(MouseEvent.MOUSE_DOWN, dragCard, false, 0, true); cardA.addEventListener(MouseEvent.MOUSE_UP, throwCard, false, 0, true); //Dragging Function function dragCard(e:MouseEvent):void { Mouse.cursor = MouseCursor.HAND; TweenLite.killTweensOf(cardA); this.addChild(cardA); x1 = cardA.x; y1 = cardA.y; time1 = getTimer() cardA.startDrag(false, dragBoundsRectangle); rotateCard(); } //Throwing Function function throwCard(e:MouseEvent):void { Mouse.cursor = MouseCursor.AUTO; cardA.stopDrag(); time2 = (getTimer() - time1)/1000; xVelocity = (cardA.x - x1) / time2; yVelocity = (cardA.y - y1) / time2; TweenLite.to(cardA, 3, {throwProps:{x: {velocity: xVelocity, max: 400, min: 150}, y: {velocity: yVelocity, max: 300, min: 100}}}); } function rotateCard():void { throwAngleDegs = (Math.atan2(y1 - mouseY, x1 - mouseX) * 180/Math.PI); //Find the cursor "grab point" in the card (rectangle) Object... grabPoint.x = mouseX; grabPoint.y = mouseY; //Establish a point of rotation based on the cursor's "grab point" in the card (rectangle)... rotatePoint = cardA.globalToLocal(grabPoint); //Tween the rotation so that the card (rectangle) "follows" the drag. This will then be adapted into an //ENTER_FRAME so that it constantly updates during dragging... TweenLite.to(cardA, .2, {transformAroundPoint: {point: cardA.globalToLocal(rotatePoint), rotation: throwAngleDegs}}); }
  11. Ha! OK, I uncovered the problem. Evidently Jack has snookied into my office and named a Movie Clip in my Library "Matrix" with linkage "Matrix" as well. I don't know why someone would do such a thing, and I'm sure there's some sort of law against it. Probably some sort of naming convention violation. It couldn't possibly by my own stoopidity. All fixed! Thanks!
  12. Thank you very, very much Carl. I had tried the pointIsLocal: true parameter but had some other issues that were compounded by my being dumber than dirt. I've got 'er working now. Happy!
  13. Greetings from Beautiful Boise! I have a Sprite in which are several other Sprites as Children. The Parent Sprite is quite large: about 3500 Pixels square, and I have scaled it down (.2) to fit into a relatively small area on my Stage. My goal is to, via a ComboBox Selection, enlarge the Parent Sprite to a scaleX = scaleY = 1 (apologies, I'm not using the GreenSock ScalePlugIn on this) while simultaneously moving the Parent Sprite so that the Child is "zoomed in to." In other words, I have a large aerial photograph of a golf course that is scaled down, and I wish to scale it up and zoom into a hole simultaneously. I am scaling it via the TransformAroundPointPlugin (it's center point)... Using two TweenMax tweens is not working: The scaling works well but the tween to the Hole Point (x, y) uses the intial value of the Point prior to the Scale Up and I can't figure out how to get around that. I've looked at the OverwriteManager but that doesn't seem to be a solution in this case...or perhaps I'm missing something. Any suggestions on how to produce such a functionality? Thanks!