-
Flip Movieclip from center?
Hi guys,
I have a problem flipping a movieclip on the stage!
The movieclip loads images via an XML file. that part works fine.
I have a button (flip_btn) and I have this code for the flip button:
flip_btn.onRelease = function(){
container_mc._xscale=-100;
}
when I click on the flip button it will flip the container_mc.. however it will move it from one side of the stage to another at the same time. so basically it doesn't flip it from the middle/center!
I've tried to change the registration point of the movieclip but that didn't work!
the funny thing is when nothing is loaded in the container_mc, it will flip from the center as it should but as soon as an image has been loaded in it it won't flip correctly!
is there something that I am missing?
what do I have to do to fix this issue?
any help will be much appreciated.
Thanks in advance
-
Just a quick heads up. I solved the issue. here is what I did:
you need another movieclip inside of the movieclip you are rotating. Create another movieclip (call it "container" e.g.), move all of your content inside of the "container" movieclip. Then, move the "container" movie clip so that its center is aligned with the origin of the original movie clip. Now you can rotate the original movieclip - it will be rotating around its origin, and your content (inside the "container") will be rotating around its center.
I hope this will help someone else who comes across this problem.
cheers
-
Prid - Outing
Nice, PalNatter
I am back, guys ... and finally 18 :P
BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS
-
I needed to do a similar thing recently...
If you want to not have to put the movieclip inside another movieclip, which can be quite annoying, you can add the width to the 'x' value of the movieclip when you flip it.
The code should look something like this:
Actionscript Code:
flip_btn.onRelease = function(){ container_mc._xscale = -100; container_mc._x += container_mc._width; }
If you want to flip it back, you'll have to do the reverse (so subtract the width).
Hope that helps!
-
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
|