ActionScript 2.0 :: Rotate About A Point Using ._rotation Method?
Apr 1, 2007Is it possible to make a movie clip rotate about the center point of it using the ._rotation method?
View 1 RepliesIs it possible to make a movie clip rotate about the center point of it using the ._rotation method?
View 1 RepliesI have a project which will allow the user to upload an image, drag it within a certain area, and rotate it.The trouble is, that the user is allowed to rotate the image. When they do, then because the area is defined by the width of the rotated image, then the image will not go as far as it's boundary,or it will cross over it's boundary.I have searched the web for a solution, and have found nothing.I am currently thinking it has something to do with Math.cos() or Math.sin()Here is my current code(which doesn't work):
r = mc._rotation;
mc._rotation = 0;
w = mc.clip._width;
h = mc.clip._height;
[code]....
i know how to use the _rotation on a mc, but how can i let it rotate slowly
[AS]
onClipEvent(enterFrame) {
rnd = parseInt(Math.random() * 2);
if(rnd == 0) {[code].....
this way it only flips to another degree, but you can't see it go round...
im tryin to rotate this movieclip of a starfield but when i use _rotation i get this flickering effect every second or two of rotation see [URL] left and right keys change rotation hold down a key and you will see what i mean ,is there a way to prevent this flickering here is the code i used
[Code]...
The 3D rotation properties (rotationX, rotationY, rotationZ) all revolve around the objects registration point. Is there any trick to change where the rotation center is?
View 7 RepliesWhen motion tweening is it possible to have an object move from point A to B and also have it rotate at certain points?
View 2 RepliesI'm trying to rotate a point in my Canvas from a given point (center). In my MouseDown handler, I save the point where user click (oldPos), and in my MouseMove handler, I'm doing this:
private function onMouseMove(event:MouseEvent):void
{
// Where the user pointer right now
[code]......
i dont know the math to have a mc rotate around a central point by constricting to an arc..i have a circle and i want a mc to follow around the edge depending on the mouse position relative to the center of the circle...
View 2 RepliesI have a triangular symbol that I want to rotate on a transformation point (the pointy tip). The effect is supposed to be like Hollywood searchlights panning around (see pic below). I've done basic rotations with actionscript before, but a transformation point wasn't involved. How is this done? Is the transformation point determined manually on the stage or with actionscript?
View 1 RepliesI need to make a MovieClip rotate around it's center point to the left or right depending on mouse drag. I got some basic semblance of what i want going, but it's pretty hackish. Normally i calculate the angle and such but i only really need to use the distance the mouse travels and apply it to the movieclip and for flavor add some nice easing when you let go.
public function Main()
{
var wereld:MainScreen = new MainScreen();
addChild( wereld );
[Code]....
This is one of the threads that was deleted. I've come up with the same problem: how do you go about dragging an object around a fixed point (rotation)?
I can do a normal drag & drop, but with this i don't even know where to start
How can i rotate a dynamic loaded picture around a point i define?
Now my pictures are rotating around the upper left corner, but thats wrong, i need it to rotate around the center.
how to make a MC point (rotate) to where the mouse was clicked on stage ?
View 1 RepliesI found the function:
rotateAroundExternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number)
to rotate an object around an external point. The top of the object will always point at the center point which is exactly what I want.
It works fine but its possible to rotate it in an oval instead of in a perfect circle...I think it should be something with the angleDegrees Parameter but im not sure what to do with it. I also tried to set up an own matrix but I failed. Any right direction to orbit an object in an oval, and where the top of the object always point at the rotation center?
The Rotations3DUtility is writed by myselft to make any DisplayObject rotate by its horizontal center, but the effect isn't perfect.[code]...
View 2 RepliesI'm trying to make a MC rotate on it's axis (registration point)...I want it to rotate both clockwise and counter-clockwise at random speeds and random degrees of rotation. For example...CW fast 90 degrees...then CCW slower for 150 degrees...then CW really fast for 270 degrees...etc..etc..
View 9 RepliesI wrote a collision detection class that works off using BitmapData.hitTest. Basically, every update, the .draw method is called and then two BitmapData's are hitTest'ed against each other to see if there is a collision.It works pretty well, however if I start rotating the source MovieClip I use for the BitmapData, the transformations don't get registered in the draw method. So what I did was pass through a Matrix in the draw method. That works. But here's the actual issue. If I output the BitmapData to a Bitmap on the stage, I see that Bitmap is, in fact, rotating, but now it's exceeding the bounds (width and height) of the BitmapData. Which is cropping / clipping the image of the source MovieClip.
UPDATE: Basically, when the Bitmap clone of the MovieClip rotates outside the positive co-ordinate space, it doesn't get drawn. It rotates outside the bounds of the BitmapData set width and height. I can multiply the bounds by 2, and then center the bitmap inside the set bounds, but then the origin point is never fixed and the object is always being moved around. Works pretty well, but makes aligning the object to any specific point impossible.Here's my isolated test code. It requires you to have a MovieClip on the stage named "iTest". I used a fairly vertical arrow shape (higher than it is wide) so I could keep track of rotations visually accentuate the clipping problem:
var rotateTimer:Timer = new Timer(10);
function rotateObject_init():void
{
[code].....
I can't work out how to create a temporary copy of a 3D point class on which I'll perform some calculations which I don't want to effect the original. In C++ it's called deep copying. How do you do it in actionscript?
[Code]...
I'm very very new on ActionScript 3.0 development for Blackberry Playbook.
I'm working with Double Sided 3D Plane in FP10 and I'm having troubles with this code:
package
{
import flash.display.Sprite;
import flash.events.Event;
[Code]....
I just recently been using a lot of prototype javascript stuff, and was wondering there was anything like the "bind" method, for use in AS3. It's proved quite useful to be able to look both at the event.target as well as the class object the handler function might be associated with.
View 5 RepliesI am trying to make my character look as he is walking around on the stage. I can make him, but what do I to make move his arms and legs? Also, I want the character walking animation when one of the keys is pressed, and stop walking when that same key is released. I have looked and looked with google and I can't seem to find the answer
View 3 Repliesfor examlple i have box. height=16 and widht=100 the problem is when i apply rotation on that movie clip it changes its height and widht. is there any way to control that? or any one can tell me using what formula it reduce the height and widht when we apply rotation on it??
View 3 RepliesFrom what I have gathered, _rotation uses radians?Basically, my initial goal was to make a movieclip rotate towards the mouse. I'm not very good at trigonometry.Using the help files I found atan2 which seemed to be what I needed. A little fiddling got me to this code:
var xDist:Number;
var yDist:Number;
var angle:Number;
onMouseMove = function () {
[code].....
However,the _rotation is opposite what is expected. This is not a problem as I can just flip the movieclip. But really what im here to ask is, please ecplain this code for me? I don't correctly understand how atan2 works.. and why it needs to be *60.Basically: How to get a movieclip to rotate towards the mouse.. and why does the code work, I want to learn trigonometry.
I'm having a problem determining if the angle created between two movie clips (which I've calculated with Math.atan2) is within +/-35 degrees of movie clip b's rotation.
View 3 Replieshow would i write this _parent[vehiclename1][vehiclename2]._rotation, it doesn't like the two breackets next to each other need quick reply.
View 3 RepliesSo far i have done:
[Code]....
Which is currently very glitchy it will not look at the mouse directly instead it will just continuosly rotate trying to find it, is there any way to fix this? The game... I have tried several different methods... Is it because it does not know how to face the mouse and what part of him to use to face it, if so how can i fix it?
if there is a way to use the _rotation property with the Tweening class to make a movie clip continually to rotate from it's current position instead of starting back at the original position and doing the same rotation again.
I'm trying to make an movie object rotate 90 degrees by clicking on a button and then when you click the button again, the movie rotates 90 more degrees. I don't want it to start over and do that same 90 degree rotation with the Tween class.
how do i change an object's _rotation based on the xy coordinates of another object (so it is facing it)?
View 3 RepliesI found the tutorial on duplicating movieclips, especially the line-by-line translation of the code. how to communicate with those clips�specifically to make them draggable and also to change the _rotation with Key.Right, Key.Left.
View 7 RepliesI am having some dificulty making a path for this enemy i'm trying to create... cause i want him to rotate + move, then stop, then shoot, then rotate back and move off screen... Its easier if you see it.. you can download the swf file in the zipped archive to demonstrate what i mean. I did it there with tweens. Anyway.. i tried and make it but i'm a little stuck on the stopping part... you can also see what i did in the fla file attatched...
View 1 Replies