Simple coding rotating script

I have a script to move an object in my flash already:
var speed:Number = 4;
plane_mc.onEnterFrame = function() {
if (Key.isDown(Key.RIGHT)) {
this.ang=ang+0.01;
} else if (Key.isDown(Key.LEFT)) {
this._x = this._x-speed;
if (Key.isDown(Key.UP)) {
this._y = this._y-speed;
} else if (Key.isDown(Key.DOWN)) {
this._y = this._y+speed;
This makes it move but now I want to object to rotate so instead of the left and right arrow keys making it move I need them to rotate them in the retrospective way. E.g. Right arrow spins object anticlockwise.
Thanks for any help.

The code you showed wouldn't indicate that your new... it's actually semi-advanced.    Try the following in place of what you have now for the RIGHT/LEFT code section. It does what you requested -- CCW for the right arrow, though that may be backwards from what you really want.
if (Key.isDown(Key.RIGHT)) {
     this._rotation -= 1;         // subtracts 1 degree of rotation
} else if (Key.isDown(Key.LEFT)) {
     this._rotation += 1;        // adds 1 degree of rotation

Similar Messages

  • Simple image rotation

    Hi all,
    Have a couple of pages on a site i'm building where i need a simple image rotation / image swap.
    It doesn't have to be anything flash, it's purely for a 200px square image to automatically swap every 5 seconds or so. It doesn't need any user buttons to go to next / previous, or enlarge when clicked.
    I've tried a couple of free jquery ones, but these won't load the starting image until all the images have been loaded into the browser, so you end up with a blank spot, then after say 10 seconds the images appear.
    Looking through the programs forums, it seems that the jquery i'm downloading isn't configurable to preload the images, so maybe i'm going down the wrong route completely!
    Whats the best / simplest way to do this and can you recommend anywhere to read up on how to implement it?
    Thanks
    Dan

    Dan, download the cycle plugin pack first: http://jquery.malsup.com/cycle/download.html. You can copy/ paste in a new .js file and store it locally on your site folder. Or, you could also use the cloud link as I've given below. Both will work.
    Then, include the jQuery library to before closing your </head> tag:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
    Now, include the jQuery cycle plugin library before your </head> tag:
    <script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.latest.js"></script>
    Define the DIV that will animate with cycle plugin before your </head> tag:
    <script type="text/javascript">
    $(document).ready(function() {
        $('.slideshow').cycle({
    fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
    </script>
    In the above code, Div with class slideshow will keep cycling with a fade effect. Note that for some effects to work, you may require the jquery easing plugin. But, fade will do just fine for your original question.
    Then, structure your image container:
    Based on your original code:
    <p class="pagetext">    <img src="images/hgsindeximg1.png" alt="School pupils" width="300" height="233" class="fltrt">Welcome  to our school website, we hope that you enjoy looking around the site. <br>
        </p>
    You have to restructure it this way:
    <p class="pagetext">
    <div class="slideshow">
    <img src="images/hgsindeximg1.png" alt="School pupils" width="300" height="233" class="fltrt">
    <img src="images/hgsindeximg2.png" alt="School pupils" width="300" height"233" class="fltrt">
    <img src="images/hgsindeximg3.png" alt="School pupils" width="300" height"233" class="fltrt">
    </div>
    Welcome  to our school website, we hope that you enjoy looking around the site. <br>
        </p>
    In the above code, I've added 2 more images that will rotate on your page. Change the filenames to whatever you desire. Also, ensure you retain the image dimensions same across all 3 images for best results.
    If you notice, I've just moved the images into a DIV called 'Slideshow'. As defined previously, all 3 images with <img..> within the div with class slideshow will keep rotating.
    On a sidenote, please please please please change the background color from red to something 'non-distractive'! Seriously, I went searching for moisturizing drops for my eyes once I opened up the test page you had posted!
    Trust this helps.

  • Simple image rotator using Fireworks

    I have Design Premium CS4. So I have Flash, Fireworks, Dreamweaver, etc. I'd like to create a simple slide rotator to put on the site. I've created a photo gallery with Fireworks. It's easy but I don't want all the header information and navigation buttons. I just want a simple box on the page where the images will rotate automatically without headings, nav buttons, etc. I know there are simple java scripts out there but I want to try something which is easily configurable and easily modified as the images will be changed frequently.
    Is there a way to configure the Fireworks gallery to not display the header information? Is there another way to accomplish what I want using other programs in Design Premium CS4?
    Thanks in advance for the help.
    Steve

    A quickie way would be to design it as an animated GIF in Fireworks, but save it in Flash format. If you'd like to try this, add the images to seperate 'States', and then choose File > Save As > Adobe Flash SWF. Click the Options button in the Save As Window to set the SWF export options.

  • Execution of Coded UI scripts with least possible test execution time in Windows7 Operating system using Visual Studio Test Agent 2010 without VS2010 installed

    Hi All,
    We are trying to execute coded UI scripts without Visual Studio installed. We are using “Visual Studio Test Agent 2010” for executing coded UI scripts without VS2010 in Windows 7, it is working fine. Also we verified executing the same script with VS2010
    Premium, it works fine as well.
    Here the challenge we are facing is with the Test execution time.
    When we run the coded UI script with IE11-Windows 7 OS-Visual Studio 2010 Premium it takes
    3min 36sec to complete the execution whereas with IE11-Windows 7 OS-Visual Studio Test Agent 2010  it takes
    6min 40sec for the same script to execute (which is almost double the time it takes while executing using VS2010).
    My question is what may be the reason for this difference? and how we can reduce the test execution time when running from Test Agent 2010?
    Kindly let us know what is the best practice to execute the coded UI scripts with least test execution time in Windows 7 Operating system using Visual Studio Test Agent 2010 without VS2010
    installed.
    Looking forward for your positive response.
    Thanks in advance..!!

    Tina-Shi, Thanks for the information.
    As you mentioned, we tried to execute the coded UI test using Mstest.exe in command on VS2010 Premium and checked on the execution
    time, there was a slight difference.
    Please find below execution time.
    Using Mstest.exe in command on VS2010 Premium/Win7 – 3.47 minutes
    Using VS2010 Premium/Win7 – 3.53 minutes
    Using Test Agent/Win7 – 7.3 minutes
    Also, I closed all the other processes in Task manager before starting up the execution.
    Still , I am facing the same Issue. Could you please suggest any other way to reduce the scripting time of coded UI script execution
    through Test agent 2010.
    Looking forward for your earliest response.

  • Im trying to make a simple 360 rotation for a 3d logo in CC 2014 but when i tried to create the 1st key frame the image when out axis

    im trying to make a simple 360 rotation for a 3d logo in CC 2014 but when i tried to create the 1st key frame the image when out axis

    I find that if you have multiple 3d object  they must be merged into a single 3d layer their positions reset to align to the same axises then sized and positioned along them. The layer should then be able to be animated well around an axis like the y axis. Here a Sphere, Cylinder and ring. http://www.mouseprints.net/old/dpr/McAssey-CC.mp4

  • Suggestions for simple random image script

    Would like to randomly display one of five new JPG banner each time page is loaded.
    Your experience would be appreciated.
    Thanks

    Since no one replied, I am posting solution I found.for future inquiries.
    Simple PHP Random Image Script
    This can be done in one line of text directly in your HTML and a collection of images.
    The first step is to gather together the images you wish to have randomly rotated.
    Change all of their file names to a numerical order, starting with the number 1.
        * 1.jpg
        * 2.jpg
        * 3.jpg
        * 4.jpg
    Be sure each image has the same extension (either all jpg, png, or gif),
    and that there are no gaps in the numbers.
    Also, place these images in their own folder to keep everything organized.
    Write the Code
    In the HTML of your page, insert the following code where you want an image to display:
    <img src="path/<?php echo rand(1,n);?>.jpg" alt="Random Image" />
    The “rand” operator will display a randomly generated number between 1 and ‘n’.
    Change ‘n’ to the total amount of pictures you have arranged numerically
    (or the highest numbered picture you have).
    In the example above I only have 4 pictures, therefor I would change it to: rand(1,4);

  • I can't get a simple "do shell script" in AppleScript to work!

    Hi All,
    I can get simple commands like "do shell script "ls"" or "do shell script "ps"" to work in AppleScript, but I cannot get something like "do shell script "python -V"" to work. (yes, my shell script says: do shell script "python -V" (no double quotes!))
    This is driving me nuts!
    Can anyone help?
    - Jon

    python -V appears to direct its output to stderr. Try
    do shell script "python -V 2>&1"

  • Simple button navigation script

    This question is so simple-I can't really find the answer
    anywhere, but as a complete NooB I have no idea how to make this
    work. I have a nested movie 1 layer down from main stage that has
    several navigation buttons that move to different main stage
    labeled frames. I get an 1120 error because I am somehow not
    calling them out on the script. I have named the instances..so
    that's not the problem. I think I just need to somehow direct the
    script to the nested location. If I move the buttons to the main
    stage I get no errors and it all works perfectly. Please help.
    Here's a sample script for the button:

    ok..not to mix things up but here's the instance name of
    button I'm currently working on: "buttonbio".
    It's located in a mc called "movFilmbackground". I'm trying
    to get the playhead to go to the frame label "bio" on the main
    stage.
    If I put the first code in...on the main stage at the
    beginning of the timeline, nothing happens when I try the button...
    If I put the second code in.. I get 1120 error.."access of
    undefined property buttonbio" & 1180 error "call to possibly
    undefined method movFilmbackgound"
    CODE

  • Page rotate script not working(not allowed error security settings prevent access to this property)

    HI,
    I am using a script to rotate each pages in pdf file when clicking a button. I have added a script to rotate file in the rotate button's click event as a javascript.It is working in acrobat but not in adobe reader. Pleae see the script
    nStart = 0;
    nEnd = this.numPages - 1;
    nRotate = 90;
    try
    if (this.numPages > 0)
               this.setPageRotations(nStart , nEnd , nRotate)
    catch(e)
    app.alert("Processing error: "+e)
    But I'm getting this  error in adobe reader not in acrobat.'not allowed error security settings prevent access to this property or method'. What is the problem. Please anybody tell me.

    OK, so here's what you do:
    - Create a new file in a plain-text editor (I recommend Notepad++), and paste this code into it:
    safeExecMenuItem = app.trustPropagatorFunction(function(code){
        app.beginPriv();
        app.execMenuItem(code);
        app.endPriv();
    mySafeExecMenuItem = app.trustedFunction(function(code){
        app.beginPriv();
        safeExecMenuItem(code);
        app.endPriv();
    Close Reader if it was open and then save this file as "MyScripts.js" and place it in the following directory (this is for Windows):
    C:\Program Files (x86)\Adobe\Reader 11.0\Reader\Javascripts
    If you want it to work in Acrobat as well place the file also under:
    C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\Javascripts
    Now to rotate the pages clockwise attach this code to your button (in Acrobat, of course):
    mySafeExecMenuItem("RotateCW");
    And to rotate them counter-clockwise, use this code:
    mySafeExecMenuItem("RotateCCW");
    Open your file in Reader and the buttons should rotate the pages when clicked...

  • Simple date stamp script

    Hello Adobe Community!
    I have 100+ photos to which I need to add a date stamp. Is there a simple script to do this? I'd like to make it an action too if possible, and it's worth noting that I have no idea how to script! There were some samples linked here but I can't for the life of me figure out how to edit them to get the desired effect.

    You can't use the date from either the profile folder or NTUSER.DAT as a reliable indicator of when a user last logged on, if I understand what you're trying to do.  The profile folder date may not be updated even when the user's profile is active;
    my own profile folder on my current system hasn't been updated for fifty days, even though I've logged off and on repeatedly and rebooted the system at least once.
    On the other hand, NTUSER.DAT, since it contains the user's registry hive, can be updated
    at any time by a malware scanner, malicious website blocker, or registry cleaner, or (I think) by some kinds of software installation or update.
    If you want to delete user profiles according to when the user last logged on, you're probably going to have to scan the security log (assuming you have security auditing enabled).  Maybe a tool like
    Log Parser from Microsoft is what you need.
    If you're running in a domain, you should research ways to get information from Active Directory as well.

  • Coded ui scripts working in one system when taken latest it is not working in other system

    Executable scripts working on one system, when taken latest on another system and executed, fails without throwing any error

    Hi Yellesh,
    Could you please provide us detailed error messages so that we can further look at this issue?  This blog introduced a similar scenario, maybe it can help you.
    http://blogs.msdn.com/b/mathew_aniyan/archive/2011/03/01/smart-match-amp-slow-coded-ui-tests.aspx
    One quick way to figure out the issue is to record a new and similar coded UI test against the same application on another system and run it. If the new test run fines, compare it with the old one for example the searchproperties of controls and the control
    hierarchy etc.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Automator hangs on simple iTunes-related script

    Hi folks,
    Automator (v2.0.2) seems to hang on some very simple scripts involving iTunes. For example:
    Get Selected ITunes Items -> Copy Finder Items (to Desktop)
    will hang in perpetuity on my system, even if a single, small mp3 file is the only selection in iTunes.
    On the other hand, if I use "Ask For Songs" and manually select the same mp3 file, the script works properly.
    Anyone have any ideas?
    Mike

    If you look in the description for the action, the input that the action is expecting and the result (output) of the action are listed. The output for the Get Selected iTunes Items is iTunes Items (an object that other iTunes actions can use), while the output for Ask for Songs is Files/Folders (an object that file handling actions can use). Automator 2 is pretty good at converting different object types, but not everything has a conversion action - apparently this is one of them.

  • Simple CDO Mail script??

    Hi,
    I need to automatically send an e-mail as a asp-page loads.
    No forms or interactivity, just a e-mail with a simple message.
    Does anybody has such a script? I am using asp and
    VisualBasic.
    Thanks!!

    Presuming CDONTS, it doesn't get much easier than the method
    outlined here:
    http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=25
    Simply plop it at the top of the page and away it goes :-)
    Best regards,
    Chris

  • Simple digital clock script

    Hi All,
    Since I am a new bee, I am seeking a simple digital clock MIDlet. Last two days I have been searching internet but I haven't found. If you do not consider me as RTFM or too lazy, could you please either post a script or simple give a shortcut?
    Many thanks in advance
    seyyah

    deepspace,
    this is my code but it is not updating. I know tha I am being too much. Help is really appriciated.
    * DrawImage.java
    * Draw mutable image on a canvas
    import java.util.*;
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class emuezzin extends MIDlet
    private Display display; // The display
    private ImageCanvas canvas; // Canvas
    public emuezzin()
    display = Display.getDisplay(this);
    canvas = new ImageCanvas(this);
    protected void startApp()
    display.setCurrent( canvas );
    protected void pauseApp()
    protected void destroyApp( boolean unconditional )
    public void exitMIDlet()
    destroyApp(true);
    notifyDestroyed();
    * Class ImageCanvas
    * Draw mutable image
    class ImageCanvas extends Canvas implements CommandListener
    private Command cmExit; // Exit midlet
    private emuezzin midlet;
    private Image im = null;
    private String message = "developerWorks 1";
    public ImageCanvas(emuezzin midlet)
    this.midlet = midlet;
    // Create exit command and listen for events
    cmExit = new Command("Exit", Command.EXIT, 1);
    addCommand(cmExit);
    setCommandListener(this);
    * Draw mutable image
    protected void paint(Graphics g)
    // Clear the display
    Calendar now = Calendar.getInstance();
    int hours = now.get(Calendar.HOUR_OF_DAY);
    int minutes = now.get(Calendar.MINUTE);
    int seconds = now.get(Calendar.SECOND);
    String message = hours+":"+minutes+":"+ seconds;
    System.out.println("Current Time = "+message);
    // Create mutable image
    im = Image.createImage(100, 20);
    // Get graphics object to draw onto the image
    Graphics graphics = im.getGraphics();
    // Specify a font face, style and size
    Font font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
         graphics.setFont(font);
    // Draw a filled (blue) rectangle, with rounded corners
    graphics.setColor(0, 0, 255);
         graphics.fillRoundRect(0,0, im.getWidth()-1, im.getHeight()-1, 20, 20);
         // Center text horizontally in the image. Draw text in white
    graphics.setColor(255, 255, 255);
    graphics.drawString(message,
              (im.getWidth() / 2) - (font.stringWidth(message) / 2),
              (im.getHeight() / 2) - (font.getHeight() / 2),
              Graphics.TOP | Graphics.LEFT);
    g.setColor(255, 255, 255);
    g.fillRect(0, 0, getWidth(), getHeight());
    // Center the image on the display
    if (im != null)
    g.drawImage(im, getWidth() / 2, getHeight() / 2,
    Graphics.VCENTER | Graphics.HCENTER);
    public void run(){
    while(true){
    repaint();
    try{
    System.out.println("Current Time =");
    Thread.sleep(1000);
    } catch (Exception e){}
    public void commandAction(Command c, Displayable d)
    if (c == cmExit)
    midlet.exitMIDlet();
    }

  • Simple cold backup script

    I am a linux newbie and I need a simple script that will do the following for me. I am using Oracle 11g and RHEL 6 ....I wanting to use VI to write a script and schedule it nightly....
    1.) shutdown the database
    2.) copy the dbf's and maybe the archivelogs
    3.) start the database
    Then I am hoping to copy the dbf's to another server and clone.
    thanks for the help
    Edited by: user2857110 on Jan 4, 2012 8:10 AM

    This is the coolest way to clone:
    SYS password must be the same on both databases.
    In this RMAN code you will see the labels "Target" and "Auxiliary". Just remember that the "Target" is the DB you will be cloning FROM. It is more like the "Source". The "Auxiliary" is the DB that you will be cloning TO. The "Auxiliary" will be completely erased and replaced by the "Target".
    Must be able to SQLPlus to the "Auxiliary" DB from the command line of the server that hosts the "Target" DB.
    The "Auxiliary" database needs to be mounted but not open.
    Then run this. (I run it from the server that hosts the "Auxiliary" DB)
    rman target sys/password@PROD
    connect auxiliary sys/password@TEST
    run
    allocate channel c1 device type disk;
    allocate auxiliary channel c2 device type disk;
    duplicate target database to TEST from active database nofilenamecheck;
    }

Maybe you are looking for

  • My Ipod touch 4g won't turn on, and my home button is broken

    I was trying to downgrade my Ipod touch 4g from 6.1.3 to 6.1.2 and It didnt went through but now my Ipod won't turn on and I cant do the home+power button because my Home button doesn't work....PLZ HELPPP

  • The Itunes application could not be opened. An unknown error occurre 130104

    Hi I opened Itunes and got this error message exactly as it appears here. "The Itunes application could not be opened. An unknown error occured (130104)" Could someone help me get my itunes back to normal. Its probably a simple problem, but I haven't

  • Ipod Video Not restoring - Error code 1418

    I've had my ipod over a year now and havent used it for a few months. Now tried connecting it to my new laptop and it doesnt recognise the ipod as an ipod video so i tried to restore it to standard but its been coming up with "unknown error code 1418

  • How can I transfer a playlist to my mum's iPad mini

    My mum is visiting me and I would like to transfer a playlist of her favourite muisc to her iPad mini. What is the best way to do this?  The home sharing function doesnt seem to be working for me as when I go into Music > More (via ipad)... there is

  • Read value of DateTimeInput XML View in YYYYMMDD format

    Dear Experts, I am using DateTimeInput in my XML view as: <DateTimeInput id="FromDate" type= "Date" placeholder="Enter Date ..."  /> And reading the value in the controller as: var oParameters = { "fdate" : sap.ui.getCore().getElementById('FromDate')