Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




_rotation Tween Help



Firstly, this is what I have so far. http://sgateweb.com/hockey/rcs.htmlAs you can see, I want the arrow on the wheel to point to the button being moused over. I have that working. My problem is when items on the left are being selected. When you go from on to another on the left, the wheel still rotates clockwise. Is there any way that I can make it find the distance it's going to travel and rotate the shortest way? Even if that way isn't possible, is there any way to stop it from going all the way back around? Any help is appreciated.Thanks.Attach Codeimport mx.transitions.Tween;import mx.transitions.easing.*;barth.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 0, 1, true);};cory.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 10, 1, true);};halecreek.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 21, 1, true);};merriman.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 32, 1, true);};romulus.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 42, 1, true);};wick.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 52, 1, true);};ms.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 242, 1, true);};hs.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 228, 1, true);};burton.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 213, 1, true);};pleasant.onRollOver = function() {new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 201, 1, true);};



Adobe > ActionScript 1 and 2
Posted on: 12/28/2006 03:13:20 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

_rotation Tween Help
Firstly, this is what I have so far. http://sgateweb.com/hockey/rcs.html

As you can see, I want the arrow on the wheel to point to the button being moused over. I have that working.

My problem is when items on the left are being selected. When you go from on to another on the left, the wheel still rotates clockwise. Is there any way that I can make it find the distance it's going to travel and rotate the shortest way? Even if that way isn't possible, is there any way to stop it from going all the way back around? Any help is appreciated.
Thanks.


Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;

barth.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 0, 1, true);
};

cory.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 10, 1, true);
};

halecreek.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 21, 1, true);
};

merriman.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 32, 1, true);
};

romulus.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 42, 1, true);
};

wick.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 52, 1, true);
};

ms.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 242, 1, true);
};

hs.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 228, 1, true);
};

burton.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 213, 1, true);
};

pleasant.onRollOver = function() {
new Tween(rcs, "_rotation", Strong.easeOut, rcs._rotation, 201, 1, true);
};

_rotation Loking Like A Tween
can i make the _rotation property look like a motion tween without using a movie clip?

Assistance With _rotation Property For Tween Class
I know, I know, this is my first post, but I just found out about Kirupa a little while ago, and have really grown to appreciate what I have been learning from the site.

Here's my dilema, does anybody know 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. Thanks.

Flash Rotate And Drag Within Cos(_rotation) Or Sin(_rotation)
Hi all, this is just what should be a simple trigonometry question for you.
I 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;
mc._rotation = r;
valT = Math.cos(r)*w
trace ("valT"+valT)
valR = Math.sin(r)*w
trace ("valR"+valR)
startDrag(mc, false, 0, 0, this._width-valR, this._width);

Does somebody know of a script somewhere which will fix this, PLEASE?

SMART _rotation If _rotation <= X Then _rotation+ _rotation+1
HELLO GREAT FORUM OF THE LEARNED,

i am trying to achieve:
(on key press )a circle that knows its current _rotation and will rotate 1 degree until reaching said degree then stop.

I.E.

second hand that knows on key press only move x degrees from current degree and stop

i think im looking for similar to but with a getproperty and an <= and an else mixed in

onClipEvent (keyDown) {
if (Key.isDown(Key.LEFT)) {
this._rotation = this._rotation-10;
}
}
onClipEvent (keyDown) {
if (Key.isDown(Key.RIGHT)) {
this._rotation = this._rotation+10;
}

thanks in advance

_rotation Bug?
Ok Try this.

Create a Dynamic Label. Just a text field with a variable attached to it.

Create another MovieClip.

Now attach a few of the labels you created to that movie clip with something in the variable.

All the Labels on the movieclip should show up fine. You might have to add another frame to the MovieClip to get the Labels to read the change of their variable, but this should work.

NOW do this.

MovieClip._rotation = 1;

All the Labels in that movie clip disapear! What the F is that??

_rotation
Afternoon FlashKit! Im stumped on what seems to be a fairly simple problem. I want to make a .swf of a MC that does nothing but rotates constantly when accessed. now I only want to do this with code. and I found the _rotation handle but cant seem to get it to apply properly to my situation. any help would be greatly appreciated. thanks a mill
~geoff

heres kinda what Im thinking...

Code:
function Spinning() {
spin._rotation += 10;
}
with spin being the MC

_rotation Help
Hey if someone with the "know-how" could visit my site www.toddbeaz.com there i have a unique, ringlike menu system. Now I just cannot figure out how to SLOW it down to a stop when you rollover one of the buttons.

My friends complain the ring goes to fast to click.. but if it were too slow then you'd never get around to the other buttons.

its complicated because those buttons have a motion tween to rotate with the ring itself. all of them together is a movie symbol with the tweened ring/buttons nested in it.

someone please help!

-Todd

_rotation ?
Ive this problem with rotating an object.
What I want to do is rotate an object to
108 degrees than rotate it back to 72 degrees.

So what I did was:

onClipEvent (load) {

// set speed
rotationSpeed = 2;

}

onClipEvent (enterFrame) {
// start the motion
_rotation += rotationSpeed;

// rotate back when gone to far.
if (_rotationSpeed >= 108) {
rotationSpeed *= -1;

// stop at 72 degrees
if (_rotation == 72) {
_rotationSpeed = 0;
}
}
}

Atleast thats what I thought would work. but the
stupid thingie rotates to 108 degrees, then rotates
back the other way BUT DOESNT STOP AT 72 DGREES!!!!!

what am I doing wrong?

Mc ._rotation
I'm creating a mc from a small coloured square, what I want it to do is continuosly rotate and scale whilst the user has the cursor over it. Would the code below be correct for what I want?
code: function rotateMe = (theClip, degrees, xScale, yScale)
on(rollOver){
theClip._rotation = degrees;
theClip._xscale = percentage;
theClip._yscale = percentage;
}
When the user removers the cursor I want the clip to return to its original position, how do I do that? Is it something like:
code: function original = (theClip, width, height)
on(rollOut){
theClip._width = pixels;
theClip._height = pixels;
}

Thannks for any help in advance

_rotation Help
hi, I'm stuck here. I made some sort car-type thing that rotates and junk. I made it so that when the points inside (about 6 MCs that are on corners and sides ect) hit the background MC, it should do stuff. it works, but when I rotate the object, it doesn't do the collisions right (it does the collisions the way it would when it ISNT rotating)

so I need a way to make the _rotation of the _parent MC factor into the hitTest of the MCs inside

any help would be great

this is what it looks like inside in the 6 inside MCs:


Quote:




if (_parent._parent.wall.hitTest(_x+_parent._x, _y+_parent._y, true)) {
gotoAndStop(2);
} else {
gotoAndStop(1);
}

_rotation
When I use _rotation, it skips a little. I really don't know how to describe it, so I'll just post the example...
http://www.deviantart.com/deviation/54005131/
Well, that's what it looks like. The movement with the arrow keys and slashing (press space inside of the flash) work, but the rotation doesn't look right. I'm using the current code...
code:
onClipEvent(enterFrame) {
if (Key.isDown(Key.UP)) {
this._y -= 1;
this._rotation = 270
}
if (Key.isDown(Key.DOWN)) {
this._y += 1;
_root.gotoAndStop(3);
this._rotation = 90
}
if (Key.isDown(Key.LEFT)) {
this._x -= 1;
_root.gotoAndStop(2);
this._rotation = 180
}
if (Key.isDown(Key.RIGHT)) {
this._x += 1;
this._rotation = 0
}
if(Key.isDown(Key.SPACE)) {
this.play();
}
}

As you can see if you looked at the .swf, it kind of turns around the wrong center. Can anyone tell me how to fix this?
Using Flash 8

_rotation ,maybe ..
ok here is my 1st post ..

i have a mc and i would like to rotate it like a volume dial on a radio turn it to the right and let go and it stays there,turn it to the left and it stays there ..no volume at all just the script to make this (_rotate )
so basically .10 20 30 are the numbers located left top and right
on a circle ..when i click on number 10 i want to be able to drag it to where the 30 mark is on the right ..i think you get my point ..check the attached file ..
cheers


**************edit ********************
anyone with some advice??

Help With _rotation
Hi,

onClipEvent (enterFrame) {
_root.rings._rotation += 5;
}

Thats the script I learnt recently. I am trying to make a rotating menu. The buttons rotate inside the movie clip named rings. I just want to have control over the rotation, such that when the user rollsover the buttons present in the movieClip "rings", the movieclip stops rotating. I couldnt figure out how.. can someone please guide.

rgds.

_rotation ,maybe ..
ok here is my 1st post ..

i have a mc and i would like to rotate it like a volume dial on a radio turn it to the right and let go and it stays there,turn it to the left and it stays there ..no volume at all just the script to make this (_rotate )
so basically .10 20 30 are the numbers located left top and right
on a circle ..when i click on number 10 i want to be able to drag it to where the 30 mark is on the right ..i think you get my point ..check the attached file ..
cheers


**************edit ********************
anyone with some advice??

_rotation
it's possible to change the rotation center of a MovieClip on the fly?

_rotation Between -15 And 15°
hello,

I'm building an image gallery in flash.
http://www.bettyfordclinic.be/test/index2.htm

Everything is generated through xml.



But that aside, I want my thumbs to have a random rotation.

_root["thumb"+k]._rotation = Math.random()*-15; is what I use now.
But this turns them all in an angle between 0 and -15°

What I want is to rotate them between -15 and 15°

Any help on this?

_rotation
Last edited by Nasier : 2003-10-22 at 03:11.
























_rotation ?
Ive this problem with rotating an object.
What I want to do is rotate an object to
108 degrees than rotate it back to 72 degrees.

So what I did was:

onClipEvent (load) {

ActionScript Code:
// set speed
rotationSpeed = 2;
 
}
 
onClipEvent (enterFrame) {
// start the motion
_rotation += rotationSpeed;
 
// rotate back when gone to far.
if (_rotation >= 108) {
rotationSpeed *= -1;
 
// stop at 72 degrees
if (_rotation == 72) {
_rotationSpeed = 0;
}
}
}

Atleast thats what I thought would work. but the
stupid thingie rotates to 108 degrees, then rotates
back the other way BUT DOESNT STOP AT 72 DGREES!!!!!

what am I doing wrong?

_rotation Help
Hey, I've been having this problem, and I cant come up with a resonable answer and I was wondering If I could pick at your guys brains.

Im trying to make a cradle effect where I have an object rotate from 0 degrees to 90 degrees and back again. Once I roll over, I want it to go from its current position weather is 27 degrees, 78 degrees or 90, and have it come back down to 0 and sit there, until the mouse leaves. I've attached my current code - I also linked a demo file to my webspace if you wish to download and take a look. Thank you to whom ever can help!

Code:

function btnName() {
   var resetSpin = 10;
   btn.onRollOver = function() {
      globe.onEnterFrame = function() {
         if (this._rotation == 90) {
            resetSpin = -10;
            //this._rotation == 0;
         }
         if (this._rotation == 0) {
            x = 0;
         }
         this._rotation = this._rotation+resetSpin;
      };
   };
}
function globeSpin() {
   var halfSpin = 1;
   globe.onEnterFrame = function() {
      if (this._rotation == 90) {
         halfSpin = -1;
      }
      if (this._rotation == 0) {
         halfSpin = 1;
      }
      this._rotation = this._rotation+halfSpin;
   };
}
globeSpin();
btnName();



file: http://www.teksunstudios.com/_misc/rotation.zip

_rotation Question
hi
instead of asking a question i'll just try as hard as i can to describe what i'm doing
so bare with me thanks
my screen: 500 x 500
on each corner there is a button (so 4 buttons in all)
there is an arrow in the middle of the movie
there is ONE MC.
When you press one of the 4 buttons, the MC will move OVER the button pressed
so basically this part is easy rite?
ex. press top right button, the MC moves to the top right part. Then when you press top left button, the MC moves to the top left part, FROM the top right location. (not suddenly move though. Like gradually move)
now....my rotation problem
in the center of the movie, i have an arrow. I want the arrow to follow the MC where ever it goes. I know you can do this using vary advanced scripting and stuff
if it's not a problem i'd love to see the code
but the easier way i want is like.....instead of having the arrow follow the MC, i just want the arrow to rotate and point towards the button that was pressed. (i prefer this cuz i'll be able to understand the cod)
THANKS!!!

SetProperty _rotation
I'm trying to learn how to use the setProperty _rotation actionscripting to rotate movie clips. There is a flashkit tutorial located at:

http://flashkit.com/tutorials/Action...33/index.shtml

Either it doesn't work or (more likely) I'm just not getting what's being said, though it seems very straight forward.

Could someone take a couple of minutes to verify if the tut is correct? If it is, I'd like to have someone look at my .fla of this tut to see where I'm off base.

Thanks,

Kevin

TextField._rotation Bug?
Hi all,

I'm trying to create some dynamic text with actionscript and I want it to be rotated 90°. The problem is that when I add the line to do this, the text is no longer visible. I've tried embeding the fonts as well and the same thing happens. Bellow is my code:

// y axis title
this.createTextField("yTitle", 4, 150, 0, 300, 20);
with (this.yTitle) {
embedFonts = true;
type = "dynamic";
selectable = false;
border = false;
text = this.parameters.yAxisTitle;
setTextFormat(axisTitleStyle);
_rotation = 90;
}

Any help greatfully recieved. Thanks

_rotation Property
I am trying to use setInterval animate a movieclip rotating it in 45 degree intervals. Is there a way to rotate a movie clip relative to its current state of rotation rather than its original state? If I rotate a mc 45 degrees using:

setProperty(movie_clip, _rotation, 45)

all is well. However if I repeat the process, it doesn't change because it is already rotated 45 degrees and needs to be given a value of 90 in order to rotate a further 45 degrees. I have tried getting the current _rotation property and just adding 45. This seems to work but as soon as the movie clip gets to 270 degrees of rotation, for some unknown reason, the _rotation property jumps to
-135. Is it possible this is a bug or am I just doing something wrong?

_rotation Animated
When I use _rotation +=1: it seems animated, but how will i make it animated like that, just only moving 11,25 degrees?

using mx

_rotation In Flash
i was wondering what _rotation rotates the mc around? where is the axis of rotation? You see, i have a tank, and i want the barrel to move up and down. Now i assumed that the barrel would rotate around it's middle if i didnt do anything, so i made a circle to rotate around. (you'll see in the included .fla) How do i make the circle rotate around itself?

_rotation Problem
Hi
I have been using _rotation in a movie as follows:
Line.onEnterFrame = function ()
{
if (this._rotation < 122)
{
this._rotation += 5.833333
}
};
This works well until I want the movie clip Line to rotate more than 180 degrees (for 20 frames) and then stop.
If I put say <182 in the above code the movie clip rotates continuously.
I am sure there is an answer related to how Flash geometry works, but I don't seem to be able to come up with it.
Or should I be using a different approach?
I would appreciate any ideas.
Regards

OnEnterFrame And _rotation
ok, check this out..

if you try to programatically rotate a movie clip by increasing the _rotation value within an onEnterFrame function the _rotation value will change to -180 an begin decreasing after it increases past 180!

How can you work around this problem?

-Pez

Help Adding _rotation
I am using some simple code to change the movement(direction) of a clip...when it reaches either side of my movie stage


Code:
if(_x+_width/2>rightedge) {
_x=rightedge-_width/2;
xspeed=-xspeed*bounce;
}

if(_x-_width/2<leftedge) {
_x=leftedge+_width/2;
xspeed=-xspeed*bounce;
}
what I need to do is..have this clip rotate either CW or CCW depending on which way it is "moving" (left or right)


any ideas??

this is "frame dependent" code..where if has a frame after this code frame that "refreshes" the movement code...and iterates another increment.

thanks.

p.s. and no _rotation when not moving.

I have tried to set a variable in the IF statements above such as rotate ="CW";

then another if() statment checking to see what the value of "rotate" is and either + or - 5 to the _rotation...didnt work..

I didn get it to work..but ONLY would incrmeent by five...when it hit the wall and re-directed

finally got to it to switch the _rotation (some old cryptic way)..no clue whay simple code wasnt working...

http://www.dmstudios.net/FAAM_websit...ow_bounce.html

.fla:
http://www.dmstudios.net/FAAM_websit...row_bounce.fla

is a quick test I whipped up.. the problem NOT...is there is a funny "bounce" going on now that I have added the "rotation"....why??

_rotation And Dimensions
Ok, this is really making me go crazy !!

I create a circle, convert it to an MC and then rotate it by increments of 15, after each increments I output the _width of the object and it's not always the same, it's like if flash is rotating the bouding box and get the dimension from it.

Thanks

[F8] _rotation And StopDrag
I have a long rectangle (long horizontally) that, when clicked, rotates 90 degrees. All the code in the onRelease worked fine until i put the _rotation line in the onPress event. Now my hit test and stopdrag dont work.

Whats up with that?

My Code:


Code:
ath_pt_mc.onPress=function(){
this.startDrag();
this._rotation += 90;

}

ath_pt_mc.onRelease=function(){
stopDrag();
if(this.hitTest(ath_part_target_mc)){
this._visible = false;
bar_ath_pt_increment_mc.gotoAndPlay("c1");
}else{
this._x = 40;
this._y = 91;
}
}
Thanks!

_rotation Question
If I had an object that I wanted to rotate or say cradle back and forth, how would I do this through AS

Resetting A _rotation
Hey,

Im have an object roating back and forth and when I roll over a btn, Im wanting it to spin to its original state. Here is the code if anyone wouldnt mind taking a look that would be ideal! Also Im sorry if its a little messy... Im not the greatest writer yet.


PHP Code:



function btnName() {
    var resetSpin = 10;
    btn.onRollOver = function() {
        globe.onEnterFrame = function() {
            if (this._rotation == 90) {
                resetSpin = -10;
                //this._rotation == 0;
            }
            if (this._rotation == 0) {
                resetSpin = 0;
            }
            this._rotation = this._rotation+resetSpin;
        };
    };
}
function globeSpin() {
    var halfSpin = 1;
    globe.onEnterFrame = function() {
        if (this._rotation == 90) {
            halfSpin = -1;
        }
        if (this._rotation == 0) {
            halfSpin = 1;
        }
        this._rotation = this._rotation+halfSpin;
    };
}
globeSpin();
btnName(); 

Game Help(if _rotation(min, Max))?
Hi. Ok I´m making a game where if the mouse angle from the player is some angle then the player graphic would play the frame of the appropriate angle.
For Example: if the mouse is 45°degrees from player, then the Player_graphic MC would play that frame.... I was wondering if it is possible to something like if _rotation is between some angles(Min Max) then player.gotoAndStop("angleFrame"); This is a bit hard to explain, but the main point is What is the command for MIN and Max for _rotation?


Code:
onEnterFrame = function() {
if ((player._rotation //hmmm? is MIN and MAX possible?)) {
player_graphic.gotoAndStop("90_b");
}

}
Can anyone help me?

_rotation Nav Issues
Hello All,

I have a circle movieclip that needs to rotate to certain destinations depending on buttons pressed in the navigation. Everything works fine, except when you go from green to cyan and vice versa, it does a full 360 rotation instead of just moving to the destination. I just can't figure out why. Any help greatly appreciated...I've attached the file...

_rotation Angle?
Thanks everyone for your help. Much appreciated. Au revoir.

Help Needed For _rotation
Hi all....urgent help needed.
I am having a simple line as a MC. And am rotatiing it thru a button by using _rotation. But my problem lies that with every additional click the rotation should increase by 2 ,next click by 4, next by 6 and next by 8.
I am little confused here.
Plz help

Thanks

_rotation Value Problem
I have tried to make a movieclip rotate in relation to the position of the mouse and this was solved by finding a script as follows:

function rotateTowards (clip, targetX, targetY) {
// Create a point object that stores the x and y coordinates of
// the clip relative to its parent's registration point
var clipPoint = {x:clip._x, y:clip._y};

// Convert local clip coordinates to global (Stage) coordinates
clip._parent.localToGlobal(clipPoint);

// Measure the distance between the registration
// point of the clip and the target point
var deltaX = targetX - clipPoint.x;
var deltaY = targetY - clipPoint.y;

// Calculate the angle of the line from the registration point
// of this clip to the mouse
var rotationRadian = Math.atan2(deltaY, deltaX);

// Convert the radian version of the angle to degrees
var rotationAngle = radiansToDegrees(rotationRadian);

// Update the rotation of this clip to point to the mouse
clip._rotation = rotationAngle;
}
function radiansToDegrees(radians) {
return (radians/Math.PI) * 180;
}

//The movieclip then has the following code attached:
onClipEvent (enterFrame) {
_root.rotateTowards(this, _root._xmouse, _root._ymouse);
}

This works very well, but I wanted to put a delay on the rotation, i.e. the rotation should follow slowly after having moved the mouse to give a more smooth feel.

To do this I tried calculating the difference between the rotation and then dividing by 16 and assigning this number to the _rotation property and it works fine UNTIL: The value passes the gap from 180 to -180 degrees or -180 degrees. The movieclip suddendly spins the other way around (as it is apparently closer to spin counter-clockwise than clock-wise...)

What is the workaround for this?

- Morten

_rotation In Actionscript
Ok probaly a simple answer to this.

I am having trouble rotating a movie clip, I can rotate it from actionscript but it rotates from the center point of he MC. I want the MC to rotate from the left, so its like a clockhand!

Any ideas?

Problems With _rotation
Hi! I'm new with flash and i'm having trouble with this _rotation tag. I'm trying to rotate image when user press either left or right keys but when that happens the whole program slows down about a half speed. Why is this happening? My code is here:








Attach Code

var id:Number;

function rotate() {

if (img._rotation >= -90) {
if (Key.isDown(Key.LEFT)) img._rotation--;
}

if (img._rotation <= 90) {
if (Key.isDown(Key.RIGHT)) img._rotation++;
}

updateAfterEvent();
}

var keyObject:Object = new Object();

keyObject.onKeyDown = function() :Void {
if (intervalID == null) id = setInterval(liike, 10);
}

keyObject.onKeyUp = function() :Void {
if (id != null) {
clearInterval(id);
id = null;
}
}

Key.addListener(keyObject);

























Edited: 01/05/2008 at 03:08:23 AM by Prosaunoja

_rotation Causes Gfx Problems
Hi 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
http://www.mn001c7645.pwp.blueyonder...rcerotate.html
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:
onClipEvent(load)
{
speed = 0.001;
angle ++;
}

onClipEvent(enterFrame)
{
if (Key.isDown(Key.UP))
{
xx = math.cos(_rotation*Math.PI/180)*speed;
yy = math.sin(_rotation*Math.PI/180)*speed;
this._x += xx;
this._y += yy;
}
if (Key.isDown(Key.LEFT))
{
this._rotation -= angle;
key_down = 1;
}
else if (Key.isDown(Key.RIGHT))
{
key_down = 1;
this._rotation += angle;
}
}

Porblem With _rotation
hi, i just joined the forum and now i have a question,
Im working on something thats pretty enojing, this is the problem, im trying to create a cirkel with on the border a round button that works as a slider.
When i slide the slider around the the rotation is being displayed in a tekstbox, ok so far so good. NOW the real problem the slider has to slide along the cirkel for 2 times and has to give the rotation value in degress until the rotation stops at 720 degrees/.

To make it clear: when you spin a cirkel 2 times and show the degrees it spinned than it wil only display 0-180-270-360 then it pops right back @ 0 i need it to go to 720 degrees. Please help grts and thnx

_rotation Help Needed
Hey, I've been having this problem, and I cant come up with a resonable answer and I was wondering If I could pick at your guys brains.

Im trying to make a cradle effect where I have an object rotate from 0 degrees to 90 degrees and back again. Once I roll over, I want it to go from its current position weather is 27 degrees, 78 degrees or 90, and have it come back down to 0 and sit there, until the mouse leaves. I've attached my current code - I also linked a demo file to my webspace if you wish to download and take a look. Thank you to whom ever can help!


PHP Code:



function globeSpin() {    var halfSpin = 1;    globe.onEnterFrame = function() {        if (this._rotation == 90) {            halfSpin = -1;        }        if (this._rotation == 0) {            halfSpin = 1;        }        this._rotation = this._rotation+halfSpin;    };}function btnName() {    var resetSpin = -10;    btn.onRollOver = function() {        globe.onEnterFrame = function() {            if (this._rotation == 90) {                resetSpin = -10;                //this._rotation == 0;            }            if (this._rotation == 0) {                //I think this is where it may be messing up                      resetSpin = stop();            }            this._rotation = this._rotation+resetSpin;        };    };}globeSpin();btnName(); 

_rotation Distortion
Hi!

ever since i started to rotate images in flash, i have not been happy with the weird distortion that occurs, yet the other day i saw a site that rotate bitmap images flawlessly. --> http://wstudio.elanskis.com

i was curious if anyone has found a way to emulate this trick

this is what i always get --> http://www.uncommonsense.com/troy/index.swf

thanks,

_rotation Easing With AS
Hi, everyone!

onClipEvent (load) {
targetx = 34;
delay = 8;
}
onClipEvent (enterFrame) {
distx = targetx-_x;
disty = targety-_y;

_x += distx/delay;
_y += disty/delay;
}

This is the code used for manipulating the background image using buttons with defined x and y; I want to add the rotation as well, and it does rotate the image, since I've defined the individual rotations within buttons' script, but I cannot get it to delay; it instantly jumps to the given rotation, and then already rotated delays to the given x and y. Any ideas? Thx!

_rotation Troubles
I have a tree movieclip that when clicked, will duplicate itself and the duplicated movieclip will be dragged, using this code:


Code:
onClipEvent (load) {
var i = 0;
if (this._name != "tree") {
startDrag("", true);
}
}
on (press) {
if (this._name == "tree") {
this.duplicateMovieClip("treedup"+i, _root.getNextHighestDepth());
i++;
} else {
startDrag("", true);
}
}
on (releaseOutside) {
stopDrag();
}
on (release) {
stopDrag();
}
Then, I want, when the thing is being dragged, for the user to be able to press the left or right button and it rotates. I have used this code:


Code:
onClipEvent (load) {
var i = 0;
if (this._name != "tree") {
startDrag("", true);
var transformable = true;
}
}
on (press) {
if (this._name == "tree") {
this.duplicateMovieClip("treedup"+i, _root.getNextHighestDepth());
i++;
} else {
startDrag("", true);
this.transformable = true;
}
}
on (releaseOutside) {
stopDrag();
this.transformable = false;
}
on (release) {
stopDrag();
this.transformable = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
if (transformable == true) {
this._rotation -= 90;
}
}
if (Key.isDown(Key.RIGHT)) {
if (transformable == true) {
this._rotation += 90;
}
}
}
BUt it only rotates when i am moving the mouse? Can anyone help please?

_rotation Direction To L And R
Hi
thanks for your time.

problem :

There is one wheel that Rotating using script.

when mouse moving to left , the wheel have to rotate TO LEFTward and

when mouse moving to right , the wheel have to rotate TO RIGHTward .

Here i am attaching FLA , please have a look and Help!

Nasih

_rotation Causes Gfx Problems
Hi 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
http://www.mn001c7645.pwp.blueyonder...rcerotate.html
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:
onClipEvent(load)
{
speed = 0.001;
angle ++;
}

onClipEvent(enterFrame)
{
if (Key.isDown(Key.UP))
{
xx = math.cos(_rotation*Math.PI/180)*speed;
yy = math.sin(_rotation*Math.PI/180)*speed;
this._x += xx;
this._y += yy;
}
if (Key.isDown(Key.LEFT))
{
this._rotation -= angle;
key_down = 1;
}
else if (Key.isDown(Key.RIGHT))
{
key_down = 1;
this._rotation += angle;
}
}

Porblem With _rotation
hi, i just joined the forum and now i have a question,
Im working on something thats pretty enojing, this is the problem, im trying to create a cirkel with on the border a round button that works as a slider.
When i slide the slider around the the rotation is being displayed in a tekstbox, ok so far so good. NOW the real problem the slider has to slide along the cirkel for 2 times and has to give the rotation value in degress until the rotation stops at 720 degrees/.

To make it clear: when you spin a cirkel 2 times and show the degrees it spinned than it wil only display 0-180-270-360 then it pops right back @ 0 i need it to go to 720 degrees. Please help grts and thnx

_rotation Question
I am trying to get a drawn movie clip to rotate to match the movement of the mouse.  Here's a silly example that demonstrates what I'm trying to do (without pasting my whole actionscript module):


movieclip.prototype.drawexample = function(sx,sy,fx,fy){
  var angle = Math.atan2(sy-fy,sx-fx)*(180/Math.PI);
  if (this.Depth == undefined) {
        this.Depth = this.getDepth();
  }
  var t = this.createEmptyMovieClip  ("somesymbol"+this.Depth+"_mc", this.Depth);
  t.moveto(sx,sy);
  t.lineto(15,0);  // draw a line along the x-axis
  t._rotation = angle;  // rotate the line to the mouse pos
}

_root.onMouseMove = function(){
  clip.unloadMovie();
  clip = drawexample(0,0,_root._mousex,_root.mousey);
}

Shouldn't the clip rotate to the mouse position?  

Copyright © 2005-08 www.BigResource.com, All rights reserved