-
object NOT scaling from center...why?
hey guys,
i am using the prototype function to create the "elastic" effect for a movieclip but the problem i am experiencing is that the movieclip is not growing/shrinking from the center registration point. instead it is scaling from the top left.
here is the code i have on the first and only frame of my main movie:
Code:
movieclip.prototype.elastic = function(newSize, springLength, elasticity) {
xScale = (xScale * springLength) + (newSize - this._xscale) * elasticity;
yScale = (yScale * springLength) + (newSize - this._yscale) * elasticity;
this._xscale += xScale;
this._yscale += yScale;
};
myMC.onEnterFrame = function() {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
elastic(150, 0.85, 0.1);
}
else{
elastic(100, 0.85, 0.1);
}
};
then i just have a movieclip that is a basic square (registered and aligned to the center) and is called "myMC".
ths elastic effect works, it just pops out from the top left instead of the center.
does anyone know why this is happening?
for the record, i am exporting this as flash player 6.
Last edited by jgordon; 06-05-2004 at 12:18 AM.
-
someone has to know why this is happening...anybody???
-
Perhaps the objects that are in your movie clip do not share the center point with the parent movie clip.
I suggest you first use the align toolbar and center everything you want centered (even the subobjects). Say if it still doesn't scale right.
-
did that already - no luck!
-
Strange, I have scaled movie clips quite a lot of times - it always stretched them from the base control point.
Can you attach the .fla file onto the next post? I hope I can help you with that...
-
ah...i figured it out!
i was doing everything correct but i experimented and realized that the scale effect was being applied to the entire movie not just the CLIP. i simply had to add "this" in front of the function in the onRollOver and onRollOut parts of the script. that solved everything.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|