Jump to content
Search Community

transformAroundPoint

chefkeifer test
Moderator Tag

Recommended Posts

I am trying to tween something that turns like a clock hand would do(quarter rotation and then back to the original spot, not wanting to do a full rotation ) the rotation registration point is not exactly on the edge but slightly in where the screw would be on a clock. when i use the rotationZ and have the registration in the middle left....the MC does not move the quarter way on the point i want, but it does return to the same position when it goes back...I was going to use the transformAroundPoint but how do you find the right coordinates to use in your MC..using the demo doesnt give the right coordinates..

Link to comment
Share on other sites

If it's a static clip in the Flash IDE, you could simply draw a rectangle and drag it until its edge is exactly on the spot you want and look at the coordinates in the Flash IDE (properties panel or info panel). Or if it's dynamic, you could just set up a CLICK listener so that when you click, it does a trace() and reports the mouseX and mouseY. Then just click on that spot.

 

Just a few ideas off the top of my head.

Link to comment
Share on other sites

did the trace and transformAroundPoint does not seem to be what i am looking for.

 

here is my project..the handle is supposed to be rotating on that point. but i cant get it to turn on that point...

www.keifersdesign.com

 

and here is the code

//*****====================================================*****
var contentLoader:Loader = new Loader();
contentLoader.contentLoaderInfo.addEventListener("progress", looping);
contentLoader.contentLoaderInfo.addEventListener("complete", fadeIn);
//*****====================================================***** 
var swf:MovieClip;
var destX:Number = 14;
var destY:Number = 100;
//*****====================================================*****
var defaultSWF:URLRequest = new URLRequest("home.swf");
//*****====================================================*****
contentLoader.load(defaultSWF);
addChild(contentLoader);
			TweenMax.to(door_left, 1, {x:"-525"});
			TweenMax.allTo([latch,door_right], 1, {x:"525"});
			TweenMax.to(contentLoader, 0, {alpha:0});
       		TweenMax.to(contentLoader, 0, {x:destX, y:destY});
	        TweenMax.to(contentLoader, 1, {alpha:1});
//*****====================================================***** 
function looping(e:ProgressEvent):void {
       	var perc:Number = Math.round(e.bytesLoaded / e.bytesTotal);
		TweenMax.to(door_left.handle, 1, {rotationZ:perc * 100});
	}
//*****====================================================*****		
function clicked(event:MouseEvent):void{
       	transLoad(event.target.name + ".swf");
	}
//*****====================================================*****		
function transLoad(url:String):void{
       	if(contentLoader.content){
			setChildIndex(door_right,numChildren - 1);
			setChildIndex(door_left,numChildren - 1);
			setChildIndex(latch,numChildren - 1);
			var closeThis:TimelineMax = new TimelineMax();
				closeThis.insert(TweenMax.to(door_left, 1, {x:"525"}));
				closeThis.insertMultiple(TweenMax.allTo([latch,door_right], 1, {x:"-525"}));
				closeThis.append(TweenMax.to(door_left.handle, 1, {rotationZ:0, ease:Sine.easeIn}));
				closeThis.insert(TweenMax.to(contentLoader, 1, {alpha:0,onComplete:transIn, onCompleteParams: [url], delay:3}));
       	} else {
               transIn(url);
      }}
//*****====================================================*****
function transIn(url:String):void{
		addChild(contentLoader);
		var doorEnter:TimelineMax = new TimelineMax({delay:1});
			doorEnter.insert(TweenMax.to(door_left, 1, {x:"-525"}));
			doorEnter.insertMultiple(TweenMax.allTo([latch,door_right], 1, {x:"525"}));
		setChildIndex(door_right,numChildren - 1);
		setChildIndex(door_left,numChildren - 1);
		setChildIndex(latch,numChildren - 1);
       	contentLoader.load(new URLRequest(url));
	}
//*****====================================================*****		
function fadeIn(event:Event):void{
		setChildIndex(door_right,numChildren - 1);
		setChildIndex(door_left,numChildren - 1);
		setChildIndex(latch,numChildren - 1);
		var contentIn:TimelineMax = new TimelineMax();
			contentIn.append(TweenMax.to(door_left.handle, 1, {rotationZ:-80}))
			contentIn.append(TweenMax.to(contentLoader, 0, {alpha:0}));
       		contentIn.append(TweenMax.to(contentLoader, 0, {x:destX, y:destY}));
	        contentIn.append(TweenMax.to(contentLoader, 1, {alpha:1}));
	}
//*****====================================================*****
door_left.handle.addEventListener(MouseEvent.CLICK, traced);
function traced(event:MouseEvent):void{
trace(mouseX, mouseY);
}

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