ActionScript 3.0 :: Tween Rotation 180 Degrees On Each Button Click

Mar 30, 2011

I have set up a motion tween using the flash tween class to rotate an image 180 degrees. However, if I should want to work wit hthe image from that point (say click the button again and have it rotate another 180 degrees back to its original position) I can't. It will simply run the tween again because my function specifies to go from 0 to 180. How I can use the tween class to rotate this image 180 degrees on each button click?

Code is below:
import fl.transitions.*;
import fl.transitions.easing.*;
import fl.transitions.Tween;
rotation1_btn.addEventListener(MouseEvent.CLICK, rotateThePicture);
function rotateThePicture(event:MouseEvent) {
//IMG11_mc.rotation += 180;
var PicRotation:Tween= new Tween(IMG11_mc, "rotation", Strong.easeInOut, 0, 180, 5, true);
};

View 2 Replies


Similar Posts:


ActionScript 1/2 :: Inconsistent Rotation - 270 Degrees Of Rotation Disappear?

Apr 21, 2009

Program A has a cannon that aims to line up with where-ever the mouse is pointing, in 360 degrees, and fires when the mouse is is clicked. Program B has an eye instead of a cannon that should in theory do similar functions when the capslock key is toggled, but instead only has a 90 degree range of motion from the Right of the eye toward the bottom (quadrant 4 only). Where did the ther 270 degrees of rotation disappear to?

[Code]...

View 4 Replies

ActionScript 3.0 :: Rotate Wheel 90 Degrees With Button Click?

Mar 30, 2009

Flash CS3 Actionscript 3.0

Most of them have been random "wheel of fortune" type projects and those get me close, but most of them are in AS 2.0 and don't hit exactly what Im looking for.

So here is what I need:

A wheel with 4 sections and a button.

When you press the button, the Wheel rotates 90 degrees, easing into the rotation and easing out of the rotation.

Sounds simple right? Well, I got the easing part down and the code i have is designed to rotate 180 degrees. However, the trouble is that, my wheel code only works once, and only rotates the wheel once. Im having trouble making the code keep track of the wheel position and rotate from the position that it left off at.

Ultimately what will happen is, each of the 4 sections will trigger a sound loop. So each of the 4 sections will also have a hitTest function, but that is not my concern right now. I just want the rotation mechanism down pat. Here is my messy, overcomplicated code for your consideration (again, designed to rotate 180 degrees for simplicity but I need 90 degrees):

var i:int = .01;
var s:int = 10;
//add event listener for my_btn
my_btn.addEventListener(MouseEvent.CLICK, wheelRotate);

[Code].....

View 11 Replies

ActionScript 3.0 :: Rotation Troubleshoot: Where Is 270 Degrees?

Oct 19, 2010

I am rotating an object by incrementing in 90 degrees,however after 180degrees it rotates to -90...then it can't quite make it's mind up if it should go to -180, or 0, which should be the same thing? (except it messes up my if statements down the line)(by that I mean, sometimes it will go back to 0, and sometimes it will switch to -180??)Where is 270, and for that case, 360?

View 2 Replies

Professional :: Rotating Mc 360 Degrees Using The 3D Rotation Tool

Nov 30, 2010

I'm new to Flash and I'm having trouble rotating my mc 360 degrees using the 3D Rotation Tool. I can rotate it 180 degrees, right side coming forward, but when I attempt to rotate it back to its original position, it doesn't continue the rotation in the same direction (right side coming forward). So instead of apearing to rotate completely, it looks like it rotates half way, stops, and rotates back (left side comes forwards). Probably an easy solution, but as I said, I'm new.

View 9 Replies

ActionScript 3 :: Calculating Degrees For MovieClip Rotation

Sep 6, 2011

I've a movieclip representing an arrow (with registration point in its middle). When I click a button, the arrow must point to a certain movieclip on stage. I use this code to execute the Tween:
TweenLite.to(arrow_clip,1,{rotation:degrees});
But I can't understand how to calculate the degrees. I tried the following with no luck:
var degrees =Math.atan2((clip.y-arrow_clip.y),(clip.x-arrow_clip.x))*(180/Math.PI);
I found the following is working but I can't completely understand why:
var degrees = -(Math.atan2(arrow_clip.x-clip.x, arrow_clip.y-clip.y))*(180/Math.PI);

View 3 Replies

Flash :: Flex - 3D - AS3 - Convert Degrees Of Rotation To Visible Height

Nov 5, 2009

I need to know what the visible height of a display object will be after I change it's rotationX value. I have an application that allows users to lay out a floor in 3D space. I want the size of the floor to automatically stretch after a 3D rotation so that it always covers a certain area. EDIT: I guess what I am really trying to do is convert degrees to pixels.

On a 2D plane say 100 x 100 pixels, a -10 degree change on rotationX means that the plane has a gap at the top where it is no longer visible. I want to know how many pixels this gap will be so that I can stretch the plane. In Flex, the value for the display objects height property remains the same both before and after applying the rotation, which may in fact be a bug.

EDIT 2: There must be a general math formula to work this out rather than something Flash/Flex specific. When viewing an object in 3D space, if the object rotates backwards (top of object somersaults away from the viewer), what would the new visible height be based on degrees of rotation? This could be in pixels, metres, cubits or whatever.

View 5 Replies

ActionScript 2.0 :: Rotate Stick 45 Degrees When Click It?

Mar 17, 2009

i have a stick id like to drag and rotate. ive followed a nice tutorial for it, and it works fine but i only want to rotate my stick 45 degrees when i click it. the tutorial i followed only alows my to rotate 180 degrees ??this is the code ive used

Code:
handle.grip.onPress = function() {
handle.onMouseMove = function() {

[code].....

View 3 Replies

Actionscript 3 :: 360 Rotation Degrees To 2d Object From 3d Papervision Object

Mar 11, 2010

I have a papervision camera of which turns using keyboard input, I have a radar of which I would like to orientate to direction when the camera turns.I have it all working apart from mapping my (camera) DisplayObject3D.rotationY to RadarInterface.rotation correctly.The camera (or any 3d object) works with values I'm finding hard:Clockwise: 0 to 89, 89 to 0, -0 to -89, -89 to -0 doing a complete 360.So if I were to turn 180 degrees I'd go from 0 to 90 and back down to 0 again.

View 1 Replies

ActionScript 2.0 :: When Click Button The Moviclip Mc To Tween To A Different Color?

Jun 27, 2005

i have a movieclip named mc. it has a color of

r=255
b=0
g=0
a=70%

i have 3 buttons that when i click i need the moviclip mc to tween to a different color. so when i click button a i want it to tween to the new color:

r=255
b=255
g=0
a=70%

if i click button b it tweens from this new color to a different color:
r=51
b=102
g=204
a=70%

etc. etc.

View 2 Replies

ActionScript 3.0 :: Motion Tween - Moving MovieClip On Button Click

Aug 18, 2011

There is a movie clip "card" created dynamically through the code. I have a class, and I instanced it and add it to the stage. I need to move the movie clip on the button click, so I created a motion tween and export it to the code. Then I wrote a function and asign it to the button through the event listener. But the movie clip doesn't move. The event fires, but nothing happens.

Code examples:
1. Instance of a movie clip
var card:MovieClip = new Panic();
card.x=456.20;
card.y=77.30;
card.width=285;
card.height=355;
card.n = "IME";
[Code] .....

View 1 Replies

ActionScript 2.0 :: XML Thumbnails And Can't Click On The Button Till The Tween Is Finished

Dec 12, 2007

created the gallery and made thumbnails vertical everything works fine except my tween for the thumbnails. i need help disabling the hit_up and hit_down buttons for the amount of time the tween is going on so someone can't click on the button till the tween is finished.

[Code]...

View 5 Replies

ActionScript 3.0 :: Tween Color Of Movieclip Object From ColorA To ColorB When Click A Button

Jun 16, 2009

I have a movieclip object and I want to tween the color of this object from colorA to colorB when I click a button. What is the best way of doing this, is it possible to do it with the tween class? As far as I can see its not possible to tween a tint with the Tween class?

View 2 Replies

ActionScript 2.0 :: Tween Class Button - User Click On The Top Rectangle And It Moves To Reveal The One Underneath It

Sep 20, 2007

i am creating a simple set of a few rectangles stacked on top of eachother (going to be like a stack of postcards) and i want to have the user click on the top rectangle and it moves to reveal the one underneath it. i have it all set up to work except i can't think of a way to stop it from being clickable after it's been moved to the side and the 2nd rectangle is revealed. does this make any sense? here is my code:

[Code]...

View 2 Replies

ActionScript 3.0 :: Rotation Using The Tween Class?

Feb 1, 2010

Quote:
import fl.transitions.Tween;
import fl.transitions.easing.*;

[code].....

View 2 Replies

ActionScript 2.0 :: Ease On A Rotation Tween

Dec 18, 2006

I am very new to actionscript and I want to make an object rotate 360degrees. I could do it with keyframes, but I want the rotation to ease in. I _KNOW_ it's possible to set up the object to rotate with an ease using actionscript.

View 1 Replies

Motion Tween With Rotation Dropping On Y Axis

Oct 21, 2009

Is there a way to prevent a motion tween w/ rotation from dropping on the Y axis? Basically I used Free Transform to change the angle of a line, but it always lowers itself on the Y axis when I insert a motion tween in it.

View 1 Replies

Professional :: Motion Tween/ Rotation Issue In Flash CS4?

Jun 11, 2010

I'm using flash CS4 and I'm trying to create a motion tween with a rotation (several actually) and every once and a while Flash decides to screw up my tween and I don't know how to fix it. So i have an arm(symbol) with the rotation point set at the elbow... after I've already moved it and rotated it a few times without an issue, I try to rotate it about 20 degrees and all of the sudden my arm is randomly doing a 360 degree spin. I can't seem to fix this!

View 2 Replies

ActionScript 2.0 :: Use The Tween Class To First Rotate An Object And Then After The Rotation Is Finished?

Mar 21, 2006

I am trying to use the Tween class to first rotate an object and then after the rotation is finished, use a new tween to move the object off the screen. Here is my code:

[Code]...

The trace runs, just as expected, right after the first Tween completes. But the second Tween doesn't work. What am I doing wrong?

View 1 Replies

ActionScript 3.0 :: Rotation Around Internal Point On Click?

Sep 24, 2010

greetings, first of all sorry for my english. This question will probably looks more difficult than it is.

I have movieclip which I want to rotate around internal point few angles with click on certain button, and I manage to do it, but I want to see motion, or even put ease not only to immediately pop up in the place.

Code:
import flash.geom.Matrix;
import fl.motion.*;

[Code]...

View 5 Replies

Actionscript 3.0 :: Click And Zoom 3D Carousel - Rotation Modification

Jun 22, 2009

I was working with the sample code from the Click and Zoom 3D Carouse tutorial and was wondering if anybody figured out a way to have full rotation?

When the demo tutorial files first load the first image is the energy drink. The last is the cat. When you click on the cat first, the carousel, rotates all the way around to it rather than just one slot back. Similary, when at the cat (the last image) and clicking on the energy drink (the first), it rotates all the way around back rather than just one slot forward.

How do you make it rotate seamlessly both ways?

View 1 Replies

ActionScript 1/2 :: Click A Button On 2 Different Ways Shift Click Or Ctrl Click?

May 12, 2010

Lets say i have a button on frame 1. And if you press it normal, you ll get to frame 2. But then if you click it on another way, you ll get to frame 3. How do i do that easy?! With another way i mean like shift click or ctrl click or is it an easier way?

View 3 Replies

ActionScript 3.0 :: MovieClip Button: Shape Tween Vs Motion Tween

May 1, 2009

my movieclip button was working perfectly as a motion tween. Can you use shape tweens as movie clip buttons? I just made that change, and kept my code:

[Code]....

View 1 Replies

ActionScript 3.0 :: Click On The First Button Loads Ok But When Click On Second Still Showing The First Movie Clip In The Back

Dec 14, 2011

I have read all threads and can not find a solution but i am not somebody with a lots of knowledge about actionscript so here is my problem i am using this script .

[code]....

the problem is that when i click on the first button loads ok but when click on second still showing the first movie clip in the back ,,,,, i have try everything without luck ,,,, i guess i need to keep reading but will like to find an answer to this situation ,

View 3 Replies

Actionscript 3.0 :: If Function - When Click On The Button Takes To Another Page Without Showing The Click Animation

Sep 11, 2010

I created a movieclip animation that only activates when i rollover the movieclip button. I further extended the frames and created another frame animation that i active only when user clicks the button. So i have a roll over/out animation and click animation in the same movieclip in the same layer. Now the problem is that when i click on the button, its supposed to take me to another page, and it does, unfortunately without the click animation. That means after i click on the button its supposed to first finish the click animation and then go to another page. But when i click, it takes me to another page without showing the click animation

SO I tried the If function, but i seem to make a mistake somewhere and i dont know what to do. Now there is no error in script, but onw there is a problem in link, the button finishes the click animation but it does not go to the tarrgeted"about" frame. here's the code

[Code]...

View 1 Replies

Flex :: Menu Control - Click A Button And A Menu Is Displayed. Click That Button A Second Time And Hide That Menu?

Jun 20, 2010

Basically, I have a button and on click it displays a menu. I want to click that menu a second time and the menu closes. Currently, every time you click the button, the menu reopens. I pasted the Flex livedoc example below. If you click the button, the menu keeps reopening.Now, I rigged it up by setting a var to open and closed, so when clicking the button it does a check. However, if you click away from the screen, the HIDE event gets dispatched, and the menu closes. This messed up the open close var being set.

How could I make this Flex example below show the menu on button click, and then on a second button click, it closes the menu? Take into affect that if you click away from the menu, it closes it.Also, I played around with the MOUSE_DOWN_OUTSIDE event for the button and set the preventDefault, and the FlexMouseEvent event.cancelable is set to false.Changing to a PopUpMenuButton is not an option. I have to much skinning involved.Here is the Flex example:

<mx:Script>
<![CDATA[
// Import the Menu control.
import mx.controls.Menu;

[code]....

View 1 Replies

ActionScript 2.0 :: CS3 Movieclip Button - Click To Play, Click To Stop?

Jun 21, 2010

I am building a flash interface and I would like a menu where it is hidden to begin with (just a tab). You click the tab to expand it, and click again to collapse it. I've made a movieclip with animation of the menu opening up and closing, but I can't seem to work out how I'd go about making the movieclip open and close properly.

View 4 Replies

Actionscript 2.0 :: Counter Click Button That Can Storage Every Click On A Txt File?

May 18, 2011

I need a counter click button that can storage every click on a txt file or something..

View 1 Replies

ActionScript 3.0 :: During Tween, Stop Ability To Click?

Jan 26, 2010

I have code that growsUp and growsDown an object using a rollOver and rollOut.

I want to remove the ability to click on this object whilst it is either growing up or growing down.

Here is my code:

Code:
var rewind:Boolean = false;
guitarButton.addEventListener(MouseEvent.ROLL_OVER,growUP);
guitarButton.addEventListener(MouseEvent.ROLL_OUT,growDown);
//on rollOver, makes the Guitar either grow up or down, respectively

[Code].....

View 4 Replies

ActionScript 1/2 :: Click Button To Play And Click To Reverse?

Nov 12, 2009

I have a test button i would like to have play a movie where a graphic expands. Once stopped, I would like to be able to click that same button and have the graphic go backwards. I would prefer to have timeline reverse, rather than lengthen the timeline of the mc because then i have to line up the start and end, and if one changes, i have to remember to change the other.

btn_test.onRelease = function(){  if (_root.adinstance._currentframe != 1) {  while(_root.adinstance._currentframe != 1) {  _root.adinstance.prevFrame();  else {    _root.adinstance.play();  }}

[code].....

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved