Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change fixed point of motion

Status
Not open for further replies.

myatia

Programmer
Nov 21, 2002
232
When doing a shape tween, how do you change the fixed point of motion? What I'm looking to do is have a rectangle grow vertically, with its base remaining at the same point. With what I have now, the rectangle gets bigger, but it grows on each end. Does any body have any ideas to fix it? My ActionScript is at the bottom, if it helps.

Thanks,

Misty

Code:
onClipEvent(enterFrame) {
	
  function growBar() {
     var h = getProperty(_root.thisBar, _height);
     setProperty(_root.thisBar, _height, h + 1);
     setProperty(_root.thisBar, _y, 300);
   }

   _root.frame = 0;
   _root.intervalID = setInterval(growBar(), 50);
}
 
sounds like it might be a registration point problem

i assume you placed a rectangle on the stage then converted it to a movie clip. when you do that you can set the registration point. i suspect the reg. pt. for your bar was in the middle (default). this would cause it to grow at both ends with the above code.
try making the bar again with a different reg point.
 
Is the registration point the little white circle that can be moved around when you're working with the free transform tool (sorry I'm so inarticulate here)? I put that circle on the bottom of the rectangle for both the movie clip instance, and inside the movie clip itself, and nothing changed. I added the following lines to my code

Code:
//y coordinate I'd like the base to be at
var rectBase = 250;

// After changing the height, set the 
// y coord. of the base
var newY = rectBase - 0.5 * _root.thisBar._height;
setProperty(_root.thisBar, _y, newY);

and that solved the problem, but I'd still like to know how to do it the other way. Thanks,

Misty
 
glad that worked and my suggestion was just that ..a suggestion.

to get at the ref point draw a rectangle (i dont know of a way to access the reg point by actionscript) hit f8 to select movie clip,button, whatever then you will see to the right a box allowing you to select the reg point for the object
 
Thanks! I knew I had to do something like that, but I couldn't remember where to change it.

Misty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top