Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
attaboy

Managing the center point[SOLVED]

Recommended Posts

I have a MC that can be viewed here http://www.jimslounge.com/erikMay27/testBio4.swf It rotates around center as I wanted it to do. When I added a scrolling text field I get this http://www.jimslounge.com/erikMay27/testBio5.swf the center of the MC changes as the 800 px high text field scrolls. I was wondering if there was anyway I could transformAroundCenter using the center of the MC as it was before adding the TextField.

 

import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import com.droolpigs.*;

TweenPlugin.activate([TransformAroundPointPlugin, TransformAroundCenterPlugin, ShortRotationPlugin]);

var textAS:TextAutoScroll = new TextAutoScroll("bio.txt", 30, 420, 700, 800);
var bio:Bio2 = new Bio2();
bio.scaleX =.001;
bio.scaleY =.001;
bio.x=450;
bio.y=400;
bio.addChild(textAS);

// dragdrop stuff
		bio.addEventListener(MouseEvent.MOUSE_DOWN, drag);
		bio.addEventListener(MouseEvent.MOUSE_UP, drop);

	load_btn.addEventListener(MouseEvent.CLICK, loadAbout);
	unload_btn.addEventListener(MouseEvent.CLICK, unloadAbout);

	function drag(e:MouseEvent):void {
		e.currentTarget.startDrag();
	}

	function drop(e:MouseEvent):void {
		e.currentTarget.stopDrag();
	}

function loadAbout(e:MouseEvent):void {
addChild(bio);

TweenLite.to(bio, 3, {transformAroundCenter:{x:450, y:400, scaleX:1, scaleY:1, delay:1}, rotation:1440, ease:Back.easeOut, easeParams:[.7]});
}

function unloadAbout(e:MouseEvent):void {
if(bio){
TweenLite.to(bio, 2.5, {transformAroundCenter:{x:450, y:400, scaleX:.001, scaleY:.001}, rotation:-1440, onComplete:removeit});
}
}

function removeit():void {
removeChild(bio);
} 

Link to comment
Share on other sites

Well, when you add the scrolling text, it affects the height obviously so the way around that would be to use transformAroundPoint instead of transformAroundCenter - that way, you can define the exact custom point around which the transformations occur. By the way, the most recent version of TransformAroundPointPlugin recognizes a new "pointIsLocal" special property (Boolean) that allows you to define the point in the target's local coordinate system (as though it's INSIDE the target). The ASDocs have been updated too.

Link to comment
Share on other sites

I replaced the first line of code below with what I thought would work but nothing happens I press the button and nothing not even a error message.

 

//TweenLite.to(bio, 3, {transformAroundCenter:{x:450, y:400, scaleX:1, scaleY:1, delay:1}, rotation:1440, ease:Back.easeOut, easeParams:[.7]});
TweenLite.to(bio, 3, {transformAroundPoint:{point:new Point(383,307), scaleX:1, scaleY:1, rotation:1440, pointIsLocal:true}, ease:Back.easeOut, easeParams:[.7]});

Link to comment
Share on other sites

I found out why I didn't see anything. It wasn't scaling so I set the scale to 1 when I instantiated. It isn't working as I expected but I might be able to figure it out on my own.

Link to comment
Share on other sites

I didn't quite understand your latest comment - is it working now? Don't forget to activate the plugin first.

Link to comment
Share on other sites

It didn't scale up but I haven't tried to fix that yet and I can't get pointIsLocal to work I downloaded the latest version but I already have it v11 I looked in the transformAroundPoint class but didn't see a pointIsLocal method. Isn't v11 the latest version?

Link to comment
Share on other sites

AhHa not all v11 are the same. The one I just downloaded has pointIsLocal now I just have to get the thing to scale up.

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