Dial animation with buttons

I have a simple game with a dial and a needle. I have made two "right" and "wrong" buttons. Simply, I need to be able to make the needle move forward when the "right" buttons is clicked, and backward when the "wrong" button is clicked, regardless of the needle position on the dial. What would be the simplist way to accomplish this? I am a beginner with Actionscript, and I've tried all I know to do. Thanks for any reply.

Showing what you've tried to do will help.  You essentially just need to change the rotation value of the needle depending on the button selected...
objectName.rotation += someValue;
Where some value is either a positive or a negative number representing degrees.  In that example line, AS3 (rotation) is used.  In AS2 it would be _rotation.

Similar Messages

  • Tween fade animation with buttons

    Hi, can anyone help me!
    I have four movie clips with instance names of "purple_ob", "green_ob", "orange_ob" and "blue_ob"
    and four buttons "purple_but", "green_but", "orange_but" and "blue_but"
    I want to have the movie clips automatically fade from one to another continually with a 5 second pause inbetween, but then if the user clicks one of the four buttons it will fade the relevant movieclip in. Then if nothing else is pressed the fading will carry on working through the four images in a loop.
    So far I have the movie clips fading on a button press but how do I implement the automatic fading from one MC to another?
    I've added the code below into the first frame of my scene
    //My actionscript 2.0 code
    import mx.transitions.Tween;
    import mx.transitions.easing;
    purple_but.onPress = function() {
    purple_ob.alpha = 0;
    purple_ob._x = 0;
    purple_ob._y = 0;
    var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
    var alphaTween2:Tween = new Tween(purple_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
    var currentPage:String = purple_ob;
    purple_ob.swapDepths(thedepth += 1);
    green_but.onPress = function() {
    green_ob.alpha = 0;
    green_ob._x = 0;
    green_ob._y = 0;
    var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
    var alphaTween2:Tween = new Tween(green_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
    var currentPage:String = green_ob;
    green_ob.swapDepths(thedepth += 1);
    orange_but.onPress = function() {
    orange_ob.alpha = 0;
    orange_ob._x = 0;
    orange_ob._y = 0;
    var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
    var alphaTween2:Tween = new Tween(orange_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
    var currentPage:String = orange_ob;
    orange_ob.swapDepths(thedepth += 1);
    blue_but.onPress = function() {
    blue_ob.alpha = 0;
    blue_ob._x = 0;
    blue_ob._y = 0;
    var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
    var alphaTween2:Tween = new Tween(blue_ob, "_alpha", Strong.easeIn, 0, 100, 15, false);
    var currentPage:String = blue_ob;
    blue_ob.swapDepths(thedepth += 1);

    Perfect!
    I removed the 'swapdepth' and it works perfectly now.
    thank you so much for your help, Ned!!!
    Below is the final code
    import mx.transitions.Tween;
    import mx.transitions.easing;
    var ob_array = new Array(purple_ob, green_ob, orange_ob, blue_ob);
    var ob_count = 0;
    var currentPage = purple_ob;
    var intervalID = setInterval(fadeOBs, 3000); // adjust the 3000 (3 secs) as desired
    green_ob._alpha = 0;
    orange_ob._alpha = 0;
    blue_ob._alpha = 0;
    purple_ob._x = 0;
    purple_ob._y = 0;
    green_ob._x = 0;
    green_ob._y = 0;
    orange_ob._x = 0;
    orange_ob._y = 0;
    blue_ob._x = 0;
    blue_ob._y = 0;
    function fadeOBs(){
          clearInterval(intervalID);
          intervalID = setInterval(fadeOBs, 3000);
          ob_count += 1;
          if(ob_count >= ob_array.length){
                ob_count = 0;
          var alphaTween:Tween = new Tween(currentPage, "_alpha", Strong.easeIn, 100, 0, 15, false);
          var alphaTween2:Tween = new Tween(ob_array[ob_count], "_alpha", Strong.easeIn, 0, 100, 15, false);
          currentPage = ob_array[ob_count];
    //Uncomment the line below if you want to increase the MC's depth
          //ob_array[ob_count].swapDepths(thedepth += 1);
    purple_but.onPress = function() {
          ob_count = -1; // one less than this
          fadeOBs();
    green_but.onPress = function() {
          ob_count = 0; // one less than this
          fadeOBs();
    orange_but.onPress = function() {
          ob_count = 1; // one less than this
          fadeOBs();
    blue_but.onPress = function() {
          ob_count = 2; // one less than this
          fadeOBs();

  • Help with Reverse Animation On Button

    The buttons are animated with a movie clip inside each button
    and the movie clip plays on rollover, however I need this same
    movie clip inside the buttons to play reversed, when the cursor is
    moved away from the button.
    I know how to do this with an instance but I already made
    each button and fooled around a thousand times with the animation
    and I do not wish to start over again!
    I have only experimented with this type of action script
    before and I must say I am a little lost =(
    Can anyone help me as to how I would go about doing this ?
    Any coding would help.
    I know there is a simple way of doing it with action script,
    but I have no more time to fool around and I need your assistance
    =P
    If you could supply the code it would help me out.
    (I can modify it to work with my page and my buttons)
    Just need something to work off of.
    Maybe a code I can put on the button, or whatever you can
    come up with.
    For future reference,
    thanks

    Without knowing the details of what you have created, or the
    code you have attempted to use, the best I can offer at the moment
    is to say you need to have the reverse playing code of the
    movieclip get triggered by the mouse out event and not stop
    stepping back down the timeline until the _currentframe value
    reaches 1. If another mouse over should occur, then it's your
    decision as to whether it picks up from where it has stepped back
    to or starts from frame 1.
    Starting over again is often the better approach, since what
    you may have created may not be able to facilitate directing things
    to play in reverse.

  • Having trouble with buttons in motion menus

    I'm having some problems with buttons in motion menus:
    - I've created a motion menu where some text (button names) fade in.
    - I set a loop point after the text has faded in completely.
    - I set the end condition to "loop"
    (there is some animation after the text fades in that I would like to loop)
    - I draw out 5 buttons and assign different overlay colors to each of the button states.
    The problem is that each time the motion menu jumps back to its loop point.. the menu seems to stutter - the overlay color on the currently selected button turns off for a second and the button is momentarily disabled (can't be selected). This problem only shows up on the actual dvd build. The buttons work smoothly when tested in the simulator.
    I can avoid this problem by losing the animation and just setting the end condition to "still".. but I was wondering if anyone knows if there is something I might have missed or could try as a workaround.
    17" powerbook g4   Mac OS X (10.4.5)  

    This problem only shows up on the actual dvd build. The buttons work smoothly when tested in the simulator.
    It could be how the DVD is reading the DVD (sort of the nature of DVD, everything is not exactly the same), because buttons will not show until the loop point and there may be a slight pause from end of animation in the menu to the loop point. And the overlay will turn off briefly when it hits the end.
    Visually what you can do is make the animation in a manner so that at the loop point the buttons are part of the background itself and make sure your loop point is at that point (or slightly after) so it looks like the button is there.
    For the most part the setting of still may work okay (really a creative call), sometimes listening to the same music/seeing samee animation may be too much (of course it depends on project) and you can jump to the loop point on the menu on subsequent calls

  • Troubles importing Flash 10 Animation with 3D Transform

    I am looking for any workaround/experiences for importing a Flash 10 animation with 3D transforms. Currently, doing this will wig out Captivate 4 and break the embedded animation in all sorts of ways. AS3 support in Captivate is turned on and the same animation will load and play correctly if the 3D transform is removed. All other Flash 10/AS3 possibilites work including motiosn graphs and filters.
    I find the 3D transform option of Flash CS4 to be one of the most powerful features ever introduced in Flash and would allow some incredible breakthrough design possibilities for my Captivate projects, if it would just support it! Any experiences with this issue welcomed. A bug report has been submitted also, but looking for a quicker remedy.

    Problem Resolved!
    I got this tip from Vikram (Adobe Support)
    1. Open your project having Flash Player 10 animations involving 3D transforms.
    2. Click the Edit menu and select Preferences.
    3. Select "Publish settings" under the "Project" section.
    4. Check "Animations" option under the "Externalize resources" section.
    5. Press OK.
    6. Now click the publish button.
    7. In the publish dialog, select Flash Player 10 from the "Flash Player version:" drop down.
    8. Click publish.
    (F4 preview may not work, so use preview in browser)
    Also, you may need to be wary of embedded scripted symbols as they may loose reference to the parent symbol after being embedded in yoru your CP4 project containing 3D transforms. My advice here is to try to script using as much object oriented js as possible in the main timeframe.
    I am using a combination of localConnect and ExternalInterface functions to control the 3D animation from captivate quiz buttons. This process adds a whole new level of interactivity and visual interest to your captivates!

  • Is there a way to set up a 'dial string' with a 'wait' function?

    I'm trying to set up calling my work voicemail. On the blackberry i could set up a dial string with a wait function. So when i dialed the voicemail #, once it answered I could hit a button on the phone and it would send the next set of characters (in this case, my extension #), then wait again, and once I got my password prompt, i could again send the next characters (now my password). I can find the way to put in a pause...but it isn't enough and doesn't do what i want it to do. How can i do this on my iPhone?
    It really is important in that i don't want to have to enter these characters while i'm driving.

    Thanks for the reply....i've tried that and it's not doing what i want it to. Our VM sometimes has delays, so its impossible to predict home many pauses i need....really need a wait function.
    Thanks

  • Please help, 3D animation play button Java Script

    The U3D file embedded into the PDF contains 3 procedure animations
    I would like to add a play button for each procedure.
    But I do not see the Animation Objects in the model tree of the pdf and I do not know how to connect to these animations
    with JavaScript.
    I have tried with no luck:
    var _anim = scene.animations.getByIndex(0);
    scene.activateAnimation(_anim);
    _anim.currentTime = 0;
    runtime.play();
    Please show me how this is done with Java Script on a button.
    Thank you

    If you're controlling the 3D animation from a button on the PDF page you need to talk to the correct API.
    The easiest way to do it is to embed a function into the 3D annotation (using a .js text file) then call that function from your button.
    e.g. in the 3D script, use this:
    function playAnimation(i) {
    var _anim = scene.animations.getByIndex(i);
    scene.activateAnimation(_anim);
    _anim.currentTime = 0;
    runtime.play();
    Then on your button, use this:
    getAnnots3D(pageNum)[0].context3D.playAnimation(0);
    then the same for (1) and (2) on your other buttons.

  • Speed dials on 500S buttons?

    Having discovered the "dialable intercom" feature, I now have quite a few extra buttons on the 500S sidecars.
    Is there a way to assign speed dials to these buttons?  I'm trying to think of a way to increase utility and I have about 20 buttons free, so speed dials may be a handy way.  This particular office dials a lot of corporate numbers from each of their phones a lot (calling trucking companies and storage companies).

    Hello John,
    Yes there is by using CCA 3.2. In each of the user's extension, there is a tab labeled Speed Dial. For the SPA 500 phone with the 500S, you will see the buttons to include not only the SPA500, but also the side cart. Below is the screen shot.
    Hope this helps.
    Bert

  • Script that initiates animation with mouseover

    I need some help with the following: I want to initiate a Flash Professional CS4 animation with a mouse over script. I have tried to use a component called mouseover that is an Adobe extention. I think I have done everything right in Flash but it doesn't work after making the .swf movie. Seems like it would be a pretty simple script, but I am not an expert by any stretch. Any help with this would be much appriciated.

    Here's one way to do it:
    Create two layers.
    On the first layer, place a button.
    On the second layer, create a movie clip that contains your animation.  Place a stop action on frame one of the that movie clip.  Give the movie clip and instance name such as myMovieClip. .
    On the button action use:
    on (rollover) {
       myMovieClip.gotoAndPlay(2);

  • Creating animations with transparent backgrounds?

    I'm running into some problems when using After Effects to create animations with transparent backgrounds for Keynote...
    I use animated gifs and short quicktime movies with uniform backgrounds as source files, use color keying to take out the backgrounds, preview them to see if they look OK, render the results as RGB+alpha, and... they don't show up as transparent in Keynote. They work in Powerpoint, however. I've tried outputting as .mov, as .gif, as premultiplied vs straight alpha... no joy. Can someone explain (or point me to an explanation) of how Keynote differs from other programs in its handling of transparency? What am I missing?

    Using a TYPE_INT_ARGB BufferedImage worked beautifully. I had played around with Image for hours, but it never occurred to me that BufferedImage would be needed. :)
    many, many thanks,
    Steven

  • I'm a Graphic Designer and Animator with a Mid 2012 15" MBP...Programs slowing need up grade

    Hey everyoe,
    I'm a Graphic Designer and Animator with a Mid 2012 15" MBP. My programs get REALLY SLOW, ToonBoom Harmony and Sometimes Illustrator, HELP! I upgraded my Ram to 16GB LONG time ago and it's made a big difference but still the stuff I make is semi complicated/detailed I can't imagine this is the strength of my MBP I refuse to accept that. WIth that said HELP ME PLZ!!! I have deadlines and I dont know what else to do! Steve Jobs my life is your hands right now man...

    Maz0327,
    if you boot into Safe mode, log in, and run your graphic design and animation apps, do they run just as slowly then?

  • How do i create an animation with one frame for each layer?

    I have 76 sequential images that i've loaded as layers using bridge, then aligned using photoshop.
    I would now like to create a 76 frame animation with one animation frame for each layer
    (the layers are in sequential order).
    is there an easy way to do this
    or do i have to create 76 frames (can duplicate multiple to speed it up)
    then set layer visibility for each frame?
    thanks
    bill w
    astro.whwiii.net

    thanks for all the replies
    got it
    here's a rough draft of 2 hours of sunshine
    http://whwastro.homestead.com/files/big/31-05-2014-prom-animation.gif
    -bill w
    astro.whwiii.net

  • How to make a scroll Bar with buttons

    Hi all,
    I am using Flash cs6 on an iMAC running 10.7.2
    I would like to know if anyone could please point me to a tutorial, showing "how to create a scroll bar with buttons". I am having a heck of a time finding a tutorial.
    Many thanks in advance.
    regards,
    DH

    http://learnola.com/2008/10/27/flash-tutorial-create-a-custom-scrollbar-with-actionscript/

  • How to make a navigation bar with buttons that stay highlighted

    I have Dreamweaver MX 2004. I know how to make a simple nav
    bar, but how do you make it so it's like the Apple website, with
    buttons that stay highlighted on the appropriate page?

    "[email protected]" <[email protected]>
    wrote in message
    news:gd04sb$5mc$[email protected]..
    >I have Dreamweaver MX 2004. I know how to make a simple
    nav bar, but how
    >do you make it so it's like the Apple website, with
    buttons that stay
    >highlighted on the appropriate page?
    http://divahtml.com/products/divaGPS/current_menu_location.php
    Thierry
    http://www.TJKDesign.com/go/?0
    | Articles and Tutorials
    http://divahtml.com/products/scripts_dreamweaver_extensions.php
    | Extensions
    that keep your markup clean
    http://www.fourlevel.com/ |
    CSS Menus, Gallery, Tab Panels, etc

  • Help with buttons :S

    hi all,
    i'm new to flash but i have an idea whats going on with webpages. I need some help with buttons! i have a website and its has a stage and 9 different flv's (screens). I've been trying to read online and i can't find out how to navigate to different screens, example below
    home          |            |
    about us     |  stage   |
    contact       |            |
    you click one one button it updates the stage. also i'm using actionscript 2.0.
    thanks for any help ahead of time
    Thank you,

    Is it a wi-fi or cellular connection that isn't working?  If its wi-fi and other people/computers/phones can connect check your settings.  If its cellular, are other people's phones (on the same carrier) working in the same location? If other people can't connect then it is likely a network problem.  If others can you may need to reset/restore you iPhone.

Maybe you are looking for

  • After upgrading to Snow Leopard on my Mac, Firefox makes typewriter or paper crinkling sounds when going to links and sites

    I just upgraded to OS 10.6.8 from 10.5 so I could run iTunes 10.7 (because 10.6 wouldn't work with iPhone 5) and now everytime I go to a any URL, I hear typewriter or paper crinkling sounds. It doesn't do it if I use Safari (I rather not, though) and

  • Error message halfway through "Consolidate Library"

    I have iTunes version 9.0.3.15. I tried to consolidate my library by going to "File -> Library -> Organize Library ..." and ticked the "Consolidate Files" box. When I run this, it gets partway through my library until it says "Copying files failed. T

  • Detailed Report on Unit Cost Planning.

    Hi friends, I am doing Unit Costing in my Project in Version 1. Is there any standard report where I can get a display of all the Materials & services or (say) any Misc cost obtained thru Arithmatic Operation in the Unit Costing? That is to say the d

  • Pr CS4 Crashes during export

    New user here! My computer is: AMD Phenom II X6 1100T 3.3 Ghz Sata 7200rpm 1 tb EVGA GTX570 Geforce 1gb 4gb ram I have a 3 min video project from Pr CS4 and I select export that takes me to Media Encoder. After selecting the output (I tried various f

  • J2EE JTA-00115 An exception occurred while making afterCompletion notificat

    Hi we are trying to use declarative transaction management feature of spring framework. For this we are using TopLinkTransactionManager but we ere getting following error. ---error--- Could not open TopLink Session for transaction; nested exception i