How Can I Add Rotation
hi ,i would like to know how can i do to add rotation to this script it makes almost the same thing of this page : http://www.intentionallies.co.jp/content_normal.html
but it has no rotation and on that site the mc to bounce and rotate how can i add rotation to this code to make the same effect that the page .
thanks in advance
var cym:MovieClip = this.createEmptyMovieClip("cym", 1002);
//var drag:MovieClip = this.createEmptyMovieClip("drag", 500);
var ejex:Number = 0;
var ejey:Number = 0;
var col:Number = 4;
////////////////GRAVITY VARS///////////////
var xspeed:Number = Math.random()*60-30;
var yspeed:Number = Math.random()*60-30;
var rightedge:Number = 690;
var leftedge:Number = -125;
var topedge:Number = -85;
var bottomedge:Number = 365;
var gravity:Number = 0;
//depends the gravity if the ball goes down
var drag:Number = .95;
//depends the velocity
var bounce:Number = .5;
//depends the bounce
///////////END OF GRAVITY VARS/////////////
var loopgravity:MovieClip = this.createEmptyMovieClip("loopgravity", 500);
//////////GRAVITY FUNCTION////////////////
function draggravity(target:MovieClip):Void {
loopgravity.onEnterFrame = function() {
if (!dragging) {
target._x = target._x+xspeed;
if (target._x+target._width/2>rightedge) {
target._x = rightedge-target._width/2;
xspeed = -xspeed*bounce;
target._rotation +=1
}
if (target._x-target._width/2<leftedge) {
target._x = leftedge+target._width/2;
xspeed = -xspeed*bounce;
}
target._y = target._y+yspeed;
if (target._y+target._height/2>bottomedge) {
target._y = bottomedge-target._height/2;
yspeed = -yspeed*bounce;
}
if (target._y-target._height/2<topedge) {
target._y = topedge+target._height/2;
yspeed = -yspeed*bounce;
}
yspeed = yspeed*drag+gravity;
xspeed = xspeed*drag;
} else {
xspeed = target._x-oldx;
yspeed = target._y-oldy;
oldx = target._x;
oldy = target._y;
}
};
}
//////////// END OF GRAVITY FUNCTION////////////
for (i=0; i<12; i++) {
var fotocym:MovieClip = cym.attachMovie("fotocym", "fotocym"+i, i);
fotocym.holder.loadMovie("CarlayMarco/foto"+i+".jpg");
if (ejex == col) {
ejex = 0;
ejey++;
}
fotocym._x = 170*ejex;
fotocym._y = 130*ejey;
ejex++;
fotocym._rotation = random(90);
fotocym.index = i;
fotocym.onPress = function() {
cym["fotocym"+this.index].swapDepths(1000);
draggravity(cym["fotocym"+this.index]);
startDrag(cym["fotocym"+this.index]);
dragging = true;
trace(cym["fotocym"+this.index]._x)
};
fotocym.onRelease = fotocym.onReleaseOutside=function () {
stopDrag();
dragging = false;
};
}
FlashKit > Flash Help > Flash ActionScript
Posted on: 05-27-2006, 09:33 PM
View Complete Forum Thread with Replies
Sponsored Links:
Rotation Script - Smooth Rotation
I have created a speedometer and on clicking a speed, I can get the needle to rotate around to the speed clicked, using _rotation.
However, the movement is very 'jumpy' and I would like to make it smoother, or better still accelerate/decelerate.
I have tried the following
Quote:
on (release) {
rotation_speed = 0.1;
if (speedo._rotation > -40)
{
do {
rotation_speed = rotation_speed * 1.1;
speedo._rotation = speedo._rotation - rotation_speed;
} while (speedo._rotation > -40);
}
else {
do {
rotation_speed = rotation_speed * 1.1;
speedo._rotation = speedo._rotation + rotation_speed;
} while (speedo._rotation < -40);
}
}
I want to get the needle round to -40, so whilst it is greater rotate is backwards, otherwise rotate forwards, starting with a small rotation and increasing (accelerate).
I found that this was still jumpy. Trying a negative causes Flash warning about script running for too long.
Rotating forwards (else) also overshoots the end position of -40
Any ideas on how to get the needle moving smoothly and finishing on the correct spot??
View Replies !
View Related
Rotation At A Given Rotation Point In AS
Hey ya'll.
I was wondering on exactly how would you make an MC rotate with a given rotation center, using AS, obviously. I'd like to know the math behind it, please.
Using _rotation would make it rotate around the mc's center... i'd like to make it rotate around another center, one defined...
View Replies !
View Related
Rotation 3d
k i made some 3d letters... and they are in flash... i have them set as a mc and i have a button hidden under them.... on the mouse over of the button the mc starts playing, and the letters rotate, now i would like the letters to continue rotating after the mouse leaves, but when the letters return to the orignal state i want them to stop.... but when the mouse is still over the button i want the letters to continue to spin even when they reach the orignal position... Thank you for your time!
View Replies !
View Related
Rotation ......
Anyone can show me step by step how to have a WHEEL
spin clockwise...
I have a picture of a car for example.
With a front and a back wheel.
Both are Movie Clips
Instance is Back_Tire and Front_Tire
Then what ??
How the hell to i get them to spin...clockwise.
I've tried a few ways...cant get them to burn road !!!
View Replies !
View Related
Rotation
Hey, I have what should seem to be a simple problem. I made a movie that has a throwable object in it, that will bounce back off of the walls. Gravity is also thrown in there, and the ball will eventually stop at the bottom of the screen if left alone. My object is a gear. What I want it to do is to rotate according to the xvelocity. Before I go on I have to give credit to Bit-101, as it is more or less his tutorial that it's from.
Anyways, I want the gear to rotate in the direction that it's moving, and like I said, I would like it to be proportional to the actual speed. I have tried a to just add a little code to the ball. _rotation = xvel where xvel is obviously my xvelocity. For some reason that didn't work. All of my script is on the object, which just consists of three frames. The first is just variables for like the leftedge, rightedge, etc, initial velocities. The third is gotoandplay(2); and the second is where all of the script is. If you want to see the gear in action, go to: http://www.mime.eng.utoledo.edu/intro1.swf The gear that I am talking about is the first one that drops at the beginning. Note: you will need the Flash 6 Player to view it correctly.
Thanks in advance for any help
View Replies !
View Related
Rotation Help
I am trying to rotate and object 360 and make it stop. I have included the code I am using below. I have tried entering many different numbers in place of the 180 but they don't work. Any help would be greatly appreciated.
newrot = this._rotation + rotspeed
if (newrot > 180){
gotoAndStop(4);
}
this._rotation = newrot
View Replies !
View Related
3d Rotation
I am trying to rotate a point about y axis. I have written the code as follows in the onmouse release event of a button. I am trying to a movieclip by assigning the rotated point to _x property of the movie clip. THe code is as follows
on (release) {
xyangle = xyangle+10;
// formula for rotating about y axis
//x' = (cos é * x) + (sin é * z)
//y' = y
//z' = -(sin é * x) + (cos é * z)
tmp = -(Math.sin(xyangle*_root.pi180)*x1)+(Math.cos(xyang le*_root.pi180)*z1);
x1 = (Math.cos(xyangle*_root.pi180)*x1)+(Math.sin(xyang le*_root.pi180)*z1);
z1 = tmp;
screenx = ((800/2)*x1)/(z1+100)+(800/2);
screeny = ((600/2)*y1)/(z1+100)+(800/2);
setProperty (_root.test, _x, x1);
setProperty (_root.test, _y, y1);
}
I am declareing the following variables in a frame in main timeline
x1 = 0;
y1 = 0;
z1 = 50;
sin = 0.9848;
cos = 0.1736;
xyangle = 10;
pi180 = 0.01745392;
I feel there is something I am missing because the rotation is not smooth and I am not getting a desired result
View Replies !
View Related
Rotation
Hi
I am using version 5 of Flash.How can I perform rotation in a movie clip?I want the arrow in a meter to rotate as the value changes.
View Replies !
View Related
Rotation
i was wondering how i could keep a layer to have something rotate over and over again at teh end of a movie... or blink really really fast at the end of the movie clip... any ideas??? thanks. i know supposedly you can't loop just a layer with a tween. thanks for the help.
View Replies !
View Related
Is There A Rotation
Ok, I have this circle - divided into 8 "pie slices" - that I rotate/spin at some constant rate.
What I would like to be able to do is once an input event (button, mouse click, etc) happens have the circle slow down and stop exactly say 1.5 rotations (540 degreees) from the point of the rotation it was at when the trigger to stop it was fired.
Now, per the subject line, is there some variable (similar to say the X:Y coords) that tells you what point in a rotation a MC is at? (ie "rotation.status = 245 degrees")
If there is, great..then thats basically all I need.
If not, how the heck could I determine where in the rotation a MC is?
If what Im asking doesnt make any sense...think of the Wheel of Fortune. With the initial spinning being done by your hand. The "event/trigger" being the release. And, the 540 degrees being the "easement"
Help?
Ahhhk!
View Replies !
View Related
Rotation
Hello,
i was working on some functions like moving a MC, Fading a MC but there is one i have a problem:
What i want is this:
1. My MC is stoped.
2. I want to give a command to make it rotate...first he starts to rotate...acelerates and then keeps rotating at a constant speed.
3. When i want i give a command and make it stop. But he stops by desaceleration on not in an instant.
Could someone help me to do this...
I was thinking on a prototype or a function as i will apply this to several MC's.
Thanks,
Miguel
View Replies !
View Related
3d Rotation
http://www.palm.com/products/family.epl
and click on the flash demo under each palm model.
how did they do it? Do we have to import the image of the product or do we have to draw it and then use actionscript for rotating??
advanced thnx!!
View Replies !
View Related
Can't Get Rotation
Hello All,
I am sending the file in question as an attachment. I am trying to get the selected movie clip to rotate. But I can't get it to do it. If on the other hand, I provide the name of a static movie clip, like the square- the alpha and size properties can be changed. Can someone please help. Require urgently.
Thanks,
Shilpi
View Replies !
View Related
3d Rotation
I need help with actionscript.
I want to create a 360 degree rotation of an object using the cursor to rotate left or right when on the object.
I have 15 png images completing the rotation.
Also, I need actionscript. When viewing text in a text box, instead of scroll bars, I would like the text to automatically scroll slowly when the cursor is over the text and to review the text, left click and drag to manually move the text up or down, on release, the text should continue the scroll.
Thankyou for your input. Tracy James tracyjame@aol.com
View Replies !
View Related
Rotation...?
Can somebody help me with this... rotation ?
So the line must go smoothly ... so if you want going to right... then the car rotate... but the drivingrotation (the line) cost time...
View Replies !
View Related
MC Rotation
Hello,
i have a MC on my main timeline.
i also have 2 buttons: one for "play" and one for "stop".
I want to create some actionscript code which does the following to the MC when the "play" button is pressed:
1. Starts rotating the MC increasing its speed from zero to a certain speed.
2. Keeps the MC rotating at that speed until the button "stop" is pressed.
When the "stop" button it's pressed, that MC will decrease it's rotation speed to zero.
Sometime ago i created a function which moves linearly a MC from point A to B with easing...i tryied starting from there but with no sucess...i am having problems in the sequence: acelerate, keep at same speed, desacelerate when "stop" is pressed.
Could someone help me?
My linear moveMC function is the following:
// Begin of Move Function
function myEnterFrame() {
var dx= this.targetX - this._x;
var dy= this.targetY - this._y;
if ((dx > -.1 && dx < .1) && (dy > -.1 && dy < .1)) {
this._x = this.targetX;
this._y = this.targetY;
delete this.onEnterFrame;
} else {
this._x+=dx*this.speed;
this._y+=dy*this.speed;
}
}
function moveMC (clip,targX,targY,v) {
clip.targetX = targX;
clip.targetY = targY;
clip.speed = v;
clip.onEnterFrame = myEnterFrame;
};
// End of Move Function
Hope it will give u some help, or if you prefer just indicate me something from scratch.
Thanks,
Miguel
View Replies !
View Related
Rotation, Rotation, Rotation
Heres the deal i have an mc "hero" which rotates and changes. I have another mc "bullet" which holds the code. The code works fine but the problem is that the hero changes modes and the positions of x and y from which the bullet fires also changes. But when I rotate the hero the bullet does not stay in the correct position.
The code is all kept on the "bullet" mc.
Code:
onClipEvent (load) {
_root.bullet._visible = false;
/:count = /:count+1;
if (_root.heromodes=="mode1") {
xmod = 0;
ymod = -33;
} else if (_root.heromodes=="mode2") {
xmod = 15;
ymod = -34;
} else if (_root.heromodes=="mode3") {
xmod = 5;
ymod = -28;
}
_x = _root.hero._x+xmod;
_y = _root.hero._y+ymod;
speed = 16;
xSpeed = speed*math.sin(_root.hero._rotation*(math.pi/180));
ySpeed = speed*math.cos(_root.hero._rotation*(math.pi/180));
}
onClipEvent (enterFrame) {
_x = _x+xSpeed;
_y = _y-ySpeed;
if (!_root.bounds.hitTest(_x+x, _y+y, true)) {
} else {
this.removeMovieClip();
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
this.duplicateMovieClip(/:count+1,/:count+1);
}
}
I think the problem is in the:
Code:
xSpeed = speed*math.sin(_root.hero._rotation*(math.pi/180));
ySpeed = speed*math.cos(_root.hero._rotation*(math.pi/180));
(I didn't know this was gona be so long,I apologise)
View Replies !
View Related
Cos Rotation Help
I am making a game like pong but it is a circle. The paddle can move around the circle perfectly I want it to always face the center. What should I make the movieclips's rotation be equal to??
heres the code for the paddle movement and the equation I want has the "????"
========================================
onClipEvent (load) {
_root.place = 0;
}
onClipEvent (enterFrame) {
_root.paddle._x = 140*Math.cos(_root.place)+150;
_root.paddle._y = 140*Math.sin(_root.place)+150;
_root.paddle._rotation = ??????????????????????;
if (Key.isDown(Key.LEFT)) {
_root.place = _root.place + (Math.PI/16);
}
if (Key.isDown(Key.RIGHT)) {
_root.place = _root.place - (Math.PI/16);
}
}
==========================================
Any help is appreciated
View Replies !
View Related
3d Rotation
I've tried a couple of forums now with no success. Im no expert but at the same time im sure this is achievable...cos I've seen stuff like this before?!
I have a bit of script which is revolving an object around a central point. All i want is it to be interactive...so that when i move the mouse to the right side of the screen for example (ie. "_xmouse > 250") it orbits right and to the left side of the scrren it rotates left. It would be even cooler if it acted with acceleration... so it moved faster and then obviously slower as you moved the mouse towards the center of the stage. It's just a case of doing something with the variable "speed" and the "_xpositon" i guess??. But i dont know how cos its hard!... any help would be hugely appreciated. If im not making yselkf clear please loet me know..
Thanks...
This is the script I have so far...
onClipEvent(load){
y=100;
speed=5;
radius=100;
xcenter=250;
ycenter=200;
zcenter=100;
angle=0;
fl=150;
}
onClipEvent(enterFrame){
z=Math.sin(angle*Math.PI/180)*radius+zcenter;
scale=fl/(fl+z);
x=Math.cos(angle*Math.PI/180)*radius;
_x=x*scale+xcenter;
_y=y*scale+ycenter;
_xscale= _yscale = scale*100;
angle+=speed;
if(angle>359){
angle-=360;
}
}
View Replies !
View Related
3d Rotation
currently i have ten icons that rotate in response to mouse movement. i also have ten buttons. i want to eventually use the buttons to an effect. i didnt put numbers.. but the top circle is circle number one corresponding to each numbered icon. once a button is pressed i want the numbered icon corresponding to it to rotate and move to the center point. (the red dot in the center of all the icons/ the origin).
heres the link. if this needs more explanation please say so.
thanks.
www.rit.edu/~bei6453/blimp/roster3.html
www.rit.edu/~bei6453/blimp/roster3.fla
and also id like to change the z position/xscale and yscale to appear above all others to further signify it has been selected. so it should get bigger as it nears the origin.
thanks
note: i just left the mouse events on to demonstrate the movement
View Replies !
View Related
Rotation Help
Hello All!!
I kinda need help on a contest wheel I am makin with flash. What I want to do is make it so that you can drag it light or hard and make the speed correspond with it. Love to talk to you on AIM so you can reach me by DJDustman87!!
Thanks in advance!
View Replies !
View Related
Help With Rotation
OK, here is what I want to do. I have a circle with a triangle marker on it. Outside of the circle there are 4 points. When you click on one of the points, the circle rotates around so that the triangle is pointing at the point. Just rotation I don't want the X or Y position of the circle to change. Then when you click on another point it rotates to that one. How can I do this with actionscript. I want to keep the file small. Just the image and the points. Thanks.
View Replies !
View Related
Help With Rotation, Please?
im trying to get this movieclip to face the direction it is moving. cant seem to get it right. here is what script is applied to the frame. code: if (_root.obj. hitTest(_root.bottom)) {
speedy = (speedy)*-1;
_root.obj._rotation -= 90;
}
if (_root.obj. hitTest(_root.top)) {
speedy = (speedy)*-1;
_root.obj._rotation -= 90;
}
if (_root.obj. hitTest(_root.right)) {
speedx = (speedx)*-1;
_root.obj._rotation -= 90;
}
if (_root.obj. hitTest(_root.left)) {
speedx = (speedx)*-1;
_root.obj._rotation -= 90;
}
ill attatch the file also if anybody wants to have a look.
any ideas?
thanks for your time!
View Replies !
View Related
Help With 3D Rotation
Can someone give me an explanation or a really good web tutorial site on how to fully rotate an object on x, y and z axis around a circle? I've been working alot with the rotations recently and sin/cosine, but as soon as I tried delving into 3D this morning my brain just kinda went *Klunk!* and I've been stuck.
If I want to do a standard rotation I use the following:
onClipEvent (load) {
n = 0;
speed = .1;
radius = 75;
diameter = radius*2;
centerX = _parent.ball2._x;
centerY = _parent.ball2._y;
}
onClipEvent (enterFrame) {
n += speed;
this._x = Math.cos(n) * radius +centerX;
this._y = Math.sin(n) * radius +centerY;
}
For rotation just on X and Z Axis I use something like this....
onClipEvent (load) {
n = 0;
speed = .1;
radius = 75;
diameter = radius*2;
centerX = _parent.ball2._x;
centerY = _parent.ball2._y;
}
And for rotation just on Y and Z Axis I use something like this....
onClipEvent (enterFrame) {
n += speed;
this._x = Math.cos(n) * radius +centerX;
this.yscale = ((Math.sin(n) * radius +centerX)-150);
this._xscale = ((yscale/diameter)*100);
this._yscale = ((yscale/diameter)*100);
}
// Y Rotation with Z Depth
onClipEvent (load) {
n = 0;
speed = .1;
radius = 75;
diameter = radius*2;
centerX = _parent.ball2._x;
centerY = _parent.ball2._y;
}
onClipEvent (enterFrame) {
n += speed;
this._y = Math.sin(n) * radius +centerY;
this.xscale = ((Math.cos(n) * radius +centerX)-150);
this._xscale = ((xscale/diameter)*100);
this._yscale = ((xscale/diameter)*100);
}
These parts I got figured out ok but I can't seem to combine them so I can use the X, Y, and Z-Scale axis rotations all together. I'm sure the answers sitting right there but I'm just not seeing it.
Like in the first example for standard rotation, COS calculates X, SIN Calculates Y, so what would calculate Z?
As near as I can tell in order to use all 3 rotations I would need to calculate X, Y, XZ, YZ, ZX and ZY positions? Or maybe my brain has just turned to Jello.
Either way I've been playing with this all day and can't seem to figure it out so I'd really appreciate any help I can get - Thanks!
View Replies !
View Related
360 Rotation VR
I am looking to see if anyone has a sample source or tutorial for a 360 panoramic slider that also goes up and down and zoom in and out as well as just left and right.
HELP!!!
View Replies !
View Related
Rotation Cal
i had atttached a file in that when clicking on button car will rotate +90 how to trace for example when rotation of car occurs from 0 to 90 i want to trace "right side rotated " similarly when car rotates from 0 to -90 trace "left side rotated". need u'r ideas plz.
View Replies !
View Related
Rotation
ok, i understand how an object is made to follow the mouse, but how can you modify this, so it rotates also to the mouse location
ex: having a boat follow the mouse, the boat turns so its always facing the mouse, then slowly follows to the mouse
View Replies !
View Related
Rotation
ok, i understand how an object is made to follow the mouse, but how can you modify this, so it rotates also to the mouse location
ex: having a boat follow the mouse, the boat turns so its always facing the mouse, then slowly follows to the mouse
View Replies !
View Related
Rotation
Hi again
I'm trying to do a counter-clockwise turn that stops at a specific spot with an mc.
this script will only keep it going.
onClipEvent(enterFrame)
{
if (this._rotation < 180)
this._rotation -= 6;
View Replies !
View Related
Rotation
Hi All,
Could someone tell me why this isn't working?
on (rollOver) {
this.startDrag(true);
if (this._y <= 150) {
my_mc._rotation += 180;
}
}
Thanks
View Replies !
View Related
Rotation Help
i downloaded this image viewer and intend to get it to spin vertically insted of horizontally, or on its x axis insted of its y axis. I am not that advanced with actionscript so if anyone could edit the file below and repost it, it would be greatly appreciated.
thank you to all who help
View Replies !
View Related
Rotation
I want a image to rotate in a clockwise direction with a y-axis tilt of approx 75° and i would also like to know how to rotate a ball on its y-axis clockwise,only useing flash.
see attached file
View Replies !
View Related
Rotation
Hi,
i have a circle MC that i want to have rotation when i mouse over it and when i mouse out of it, i want it to stop rotating.
I want the circle to start rotating smoothly, 0,1,2,3,4,5, ect. and when you mouse out of it, i want it to stop rotating smoothly, 100,99,98,97,96,95, ect...
Now, i tried doing this with motion tween, but it's not smooth at all and i can't get it to spin fast enough (even with very high frame rate), also, it jerks and looks really ugly.
I was thinking maybe there is an easier way of making it spin with A/S and have it be more smooth.
I just need the A/S.
Thanks,
Baljinder
View Replies !
View Related
Rotation
I altered a .fla file to rotate pictures around a central domain name, as well as expand the picture size when clicked on.
Is there a way to center the picture stop the rotation when I click on it?
View Replies !
View Related
Rotation
Hi, I've followed a simple code for rotation:
http://www.flashkit.com/tutorials/Ac...-633/index.php
Question: That script rotates it around the corner (0,0). How do I get it to rotate around the centre (75,75)?
Thanks.
View Replies !
View Related
Rotation
Basically, what I want to do is on one keypress, rotate the movie clip 90 degrees. I tried to do this through a recursive method rotate where it would increment 30 degrees each pass. However, it still does not animate (I assume that the movie clip does in fact move 90 degrees). How can I get it to animate the full 90 degrees on one key press? Thanks
Code:
onClipEvent(enterFrame)
{
function rotate(degrees)
{
if(degrees == 90)
break;
else
{
this._rotation+=degrees;
rotate(degrees + 30);
}
}
}
onClipEvent(keyDown)
{
if(Key.isDown(Key.RIGHT))
{
this._x+=5;
rotate(0);
updateAfterEvent();
}
}
View Replies !
View Related
Rotation Help
Hi,
I'm creating a little game. And i've ran into a little problem:
I have 2 MCs. One is called "character1" and the other "enemy1". I want the MC "enemy1" to be facing the MC "character1".
I've tried to copy one of those "follow mouse and set rotation" scripts. Replaced all the _ymouse with enemy1._y and the _xmouse with enemy1._x.
Somehow it doesn't work. It does something very weird with the angle
Does anyone know a script. In the script i'm using now (which doesn't work) it's all weird Math stuff like aTan and PI and stuff like that.
Grtz,
ßeTøñßøøR
View Replies !
View Related
Rotation Help
Okay, so I made this little missile targeting AI:
Here
And as you can see [click to fire a missile], the missile automatically rotate to the new target. I Know why, but what I would like to know, is an efficent, non-laggy script that'll ease it into the rotation.
Any idea? [I've tried using the mx.tweens, some a > _rotation, etc. but rotation goes 0-360, so it makes it act weird...]
Here's my method of getting the rotation:
Code:
//Move the missile in the direction it's rotated to
_x += s*Math.sin((_rotation*Math.PI)/180);
_y -= s*Math.cos((_rotation*Math.PI)/180);
//Get rotation
x = this._x-my_target._x;
y = this._y-my_target._y;
a = -Math.atan2(x, y)/(Math.PI/180);
//Set Rotation
_rotation = a;
All of this is on the missile itself, and under onClipEvent(enterFrame){}
where my_target is the movieclip of it's current target.
Ideas?
View Replies !
View Related
Mc Rotation
I have placed this code on my mc howver it fails to rotate, any ideas please
onClipEvent (load) {
aboutus.onMouseMove = function() {
var dx = _root._xmouse - this._x;
var dy = _root._ymouse - this._y;
var angle = 180 * Math.atan2(dy, dx) / Math.PI;
this._rotation = angle;
updateAfterEvent();
};
}
View Replies !
View Related
Rotation
Quote:
onClipEvent (enterFrame) {
var nRotFind:Number=(180/Math.PI)*(Math.atan2((_ymouse),(_xmouse)));
//_root.Shooter._rotation = nRotFind;
trace (nRotFind);
}
I'm running Flash Mx 2004 Pro (actionscript 2.0). I'm just trying to get a simple mc to rotate in accordance with the mouse. There is only 1 mc (mcShooter, or "Shooter"). When the middle line is commented, the angle traces exactly as it should. However, when I take out the comment the MC twitches frantically and outputs two different values for every frame.
I have a set of code on actionscript 1 that is similar to this and works perfectly (I had to use the difference between _y/xmouse and the y/x values of the mc though.)
I'm guessing that this is just a product of me being used to AS 1.0 or something. Either way, it's really frustrating me.
Thank
Oh, and this code is in the mc, not the frame.
View Replies !
View Related
How To Do 360 Rotation?
How does one do this - go to
http://www.hibore.com/
and click on the XL driver - do they simply take still shots from every angle and then import those into flash? How then the rotation? The scrub bar?
Thanks
KB
View Replies !
View Related
Please Help, Rotation
Hi
I posted here earlier about a big problem, got a reply, and now im stuck again
I Want to be able to rotate a randomly rotated movieclip back to 0 degrees.
I tried and tried, and finally got this code, thats painfully close on succeding (i think)
here it is:
var rot:Number = _root.frame01_mc._rotation
trace(rot);
_root.invisible_mc.onEnterFrame = function () {
while ( rot < 100 ) {
trace(rot);
_root.frame01_mc._rotation = rot;
rot += 1;
}
};
frame01_mc is the randomly rotated movieclip, in this case rotated 5 degrees.
invisible_mc is the container of the code, where the code displayed above is also kept.
frame01 rotates as it should, but it dosent tween between the original and the new rotation, only shifts between, in this case, 5 degrees and 100 degrees.
Please help, spend 2 days on this script now.
Cheers
View Replies !
View Related
Rotation In AS3?
Using this code to cause a movie clip to rotate...
TransitionManager.start(movie_mc, {type:Rotate, direction:Transition.IN, duration:1, easing:Strong.easeInOut, ccw:false, degrees:45});
Obviously, it's taking the clip, immidiately rotating it 45' and then returning it to it's original position over 1 second.
Not quite what I need though, I need the movie clip to rotate from it's original position to 45', then store the rotation of the object in a variable so I can rotate it in different directions after ward.
How would the rotation be done in actionscript 3.0? Possibly matrix?
View Replies !
View Related
|