Errors in code, please help

I am trying to generate random motion in flash and can't seem
to make it work.
Any help will be much appreciated
newpos = function () {
ranx = Math.random ()*250)
rany = Math.random ()*250)
this.onEnterFrame = function() {
newpos ()
this._x = ranx;
this._y = rany;
acceleration = 10
newpos = function () {
ranx = Math.round((Math.random ()*250));
rany = Math.round ((Math.random ()*250));
newpos();
this.onEnterFrame = function() {
this._x += ((ranx-this._x)/ acceleration);
this._y += ((rany-this._y)/ acceleration);
acceleration = 10
newpos = function () {
ranx = Math.round((Math.random ()*250));
rany = Math.round ((Math.random ()*250));
newpos();
this.onEnterFrame = function() {
this._x += ((ranx-this._x)/acceleration);
this._y += ((rany-this._y)/acceleration);
if (Math.round(this._x) == ranx || Math.round(this._y) ==
rany) {
newpos();

Try this:
newpos = function () {
acceleration = 10;
ranx = Math.round((Math.random()*250));
rany = Math.round((Math.random()*250));
this._x += ((ranx-this._x)/acceleration);
this._y += ((rany-this._y)/acceleration);
this.onEnterFrame = function() {
newpos();
cheers,
blemmo

Similar Messages

  • Logical error in code, please help, thanks alot.

    I have this file Socks.java which reads in a file containing information about a sock drawer. The file is of the format:
    11
    red athletic
    green casual
    blue athletic
    blue athletic
    red athletic
    so when the program runs, it is supposed to output the socks that are pairs: so it would output
    1 pair red athletic
    1 pair blue athletic
    my code compiles and runs fine and i am testing it with println statements, but I am not getting the desired ouput. Can someone look over it and see if they spot what is wrong. Right now in the code I am seeing what the value of socks[i] and socks[j] is by printing them out as you will notice. If anyone can help, I appreciate it. Thanks so much for all your wonderful help
    Here is the code:
    import java.io.*;
    public class Socks {
    public static void main(String args[])
    try
    String socks[] = new String[1000];
    int pairs[] = new int[500];
    int numOfsocks;
    int i;
    int j;     
    FileReader fr = new FileReader("test.txt");
    BufferedReader inFile = new BufferedReader(fr);
    numOfsocks = Integer.parseInt(inFile.readLine());
    int possiblePairs = numOfsocks/2;
    //System.out.println(numOfsocks);
    //System.out.println(possiblePairs);
    for(i = 0; i < numOfsocks; i++)
    socks[i] = inFile.readLine();
    //for(i = 0; i < numOfsocks; i++)
    //System.out.println(socks);
    for(i = 0; i <= possiblePairs;i++)
    for(j = i; j <= possiblePairs;j++)
    System.out.println(socks[i]);
    System.out.println(socks[j]);
    //if(pairs[i] >= 2)
    //System.out.println(pairs[i]/2 + " pairs" + socks[i]);
    inFile.close();     
    catch(IOException e){}
              System.out.println("File Not Found or no File Specified");

    Try the following quickly revised version of your code.
    import java.io.*;
    public class Socks {
    public static void main(String args[])
      try
        String socks[] = new String[1000];
        int pairs[] = new int[500];
        int numOfsocks;
        int i;
        int j;
        FileReader fr = new FileReader("test.txt");
        BufferedReader inFile = new BufferedReader(fr);
        numOfsocks = Integer.parseInt(inFile.readLine());
        for(i = 0; i < numOfsocks; i++)
          socks[i] = inFile.readLine();
        for(i = 0; i < numOfsocks; i++)
          if (socks[i] != null)
            pairs[i]++;
            for(j = i + 1; j < numOfsocks; j++)
                if (socks.equals(socks[j]))
    pairs[i]++;
    socks[j] = null;
    System.out.println(pairs[i]/2 + " pairs " + socks[i]);
    inFile.close();
    catch(IOException e){
    e.printStackTrace();

  • My dear during i update my iphone 4s 16 giga  to ios 7 itis not responde and error 4005  wasfound please help me

    dear sir during updating my iphone 4s 16 giga error 4005 found please help me

    http://lmgtfy.com/?q=iPhone+error+code+4005

  • Error 213.5 Please help me get DW working again. Thanks CaptJim4685

    I have a Mac OS 10.10 used the Migration Assistant to move all files from old computer to new computer yesterday. Now can not use my Dreamweaver CS 5.5 program I have my original install disk. Tried that. get error 213.5 Please help me get DW working again. Thanks CaptJim4685

    Hi Nancy O.
    Thing is, I was using it on my old MacBookPro, also w/ yosemite. No problem. So I think it should run on the new one with the same OS.
    I did figure out how to find the CC cleaner log file. It had a lot of stuff in it, but did not indicate any kind of failures. I did not see the word “failure in the log file at all.
    After your suggestions, I went thru all the steps again - twice - very carefully emptying the trash between steps and restarting. Got the same error message at the end.
    Now, I still have 5.5 working on the old computer. That was my first and only install. My notes suggest  I installed it in 2011.
    If I knew for sure that if I deactivated it (if I knew how to do that) on the old computer, and uninstalled it, AND I could then count on the install working on my new computer, I would do it, but I am afraid to do that for fear that then I wouldn’t have it to use at all.
    I had expected it to transfer over, and then I would clean the old computer, as my son wants it for his wife, They have no use for DW.
    I also had trouble w/ MS Office, but they allowed me to call them and get a new install code. Now that Works fine.
    I wish Adobe were as accommodating. I have my original install disk & code. I never expected any of this trouble.
    I hope you can come up with a new plan. I really can’t afford to buy a new copy, especially when I know that this one should work, if it would just get rid of this blocking action.
    I only use it for editing my own personal family website: http:www.americanfenner.com.  I am not a webmaster/webwriter/ computer programmer or anything like that. Just an old guy doing personal stuff on my mac.
    Jim Fenner
    [email protected]

  • TS3694 How can I fix this type of error in iphone 4?"The iphone could not be restored. An unknown error occurred (3194) "please help me.

    Hi everybody !
    AT&T company is unlocked (factory)my iphone4 before 3 days ago so i want to restore to unlock iphone 4 with itunes but it is not restore.
    How can I fix this type of error in iphone 4?- "The iphone could not be restored. An unknown error occurred (3194) "
    please help me in nepali language(if posible) or english. thank you.

    http://support.apple.com/kb/TS3694#error3194
    This means that either your firewall/antivirus is blocking access to Apple's servers, or you have used your computer to jailbreak an iDevice in the past. The link above tells you how to resolve this issue.

  • I have a compilation problem with my mini iPod that is preventing my volume from increasing. I can't get the compilation code, please help me

    MY mini iPod version number1.1.3 pc robs iPod ,4GB is having volume limit problem ,the volume is very low compare to how it was playing before I mistakenly touch the combination code. I have forgotten the combination code, please help me out.. I have tried to reset settings but it wouldn't work.

    i can get the combination code please

  • TS2865 when i export movie from final cut pro to quicktime , something happened. it says error quicktime -50. please help.

    when i export movie from final cut pro to quicktime , something happened. it says error quicktime -50. please help.
    i need to submit this movie for uni project tomorrow.
    any help/advice will help . thanks.

    According to Crash Analyzer
    -50 (QuickTime)
    This error occurs when there is corrupt or invalid media in your timeline. Check that the codec used by the file is recommended for use in your editing application.
    good luck

  • TS3694 hi, I was trying to update my iPhone 3gS but when I turn it on again iTunes send me a message that says error 3194 occurs, please help me!!

    hi, I was trying to update my iPhone 3gS but when I turn it on again iTunes send me a message that says error 3194 occurs, please help me!!

    If the screen shows a plug going to itunes, then you have no choice,  It's in recovery mode.  You'll be given the chance to restore from a backup either from itunes or icloud.
    I assume when you got the message to update (was this for the ios or update some apps?), that was before the device when dead.  At any rate, doing a restore does not change the ios.

  • HT201413 Whenever i try to sync my ipod a message keeps coming up saying "1 or more items could not be synced", apparently its error -69. Please help, i've tried rebooting my laptop, installing the latest itunes and turning off the wifi but nothing seems

    Whenever i try to sync my ipod a message keeps coming up saying "1 or more items could not be synced", apparently its error -69. Please help, i've tried rebooting my laptop, installing the latest itunes and turning off the wifi but nothing seems to work.

    Are you using security software on your PC? If yes, try to disable the software or check the settings. More info here: http://support.apple.com/kb/TS3125

  • My ipad mini 2 is not turning on. I tried to reset with the power/home buttons but it didnt work. I tried to restore it in DFU mode but it didnt work, i get error 4004. Please help me!

    My ipad mini 2 is not turning on. I tried to reset with the power/home buttons but it didnt work. I tried to restore it in DFU mode but it didnt work, i get error 4004. Please help me!

    I also tried the ol' whacking 3 times trick...Didn't work to my surprise

  • I backed up my movies and rebuild my computer, and after making sure i'm using the latest version of itunes and quicktime and and making sure i still had spare computer authorizations, i still get error 23132.  Please help.

    I backed up my movies and rebuild my computer, and after making sure i'm using the latest version of itunes and quicktime and and making sure i still had spare computer authorizations, i still get error 23132.  Please help.

    I had this exact issue.  Spent over an hour on the phone with apple support, they couldn't resolve.  Here is what I ended up doing, that worked.
    1.  Turned iTunes match off on all my iOS devices
    2.  Deleted the offending playlists from the iOS device they originated on
    3.  Started iTunes, let it run (literally) for an hour before it became responsive.  First thing I did, before clicking anywere else was disable iTunes match.  If I clicked anywhere, it would clock for another hour.
    4.  Let iTunes run overnight, by morning it had cleaned out the repeating play lists.  This got my Mac/iTunes back to an operable state.
    5.  Restore iPhones from backup in iTunes.
    What was causing my issue was a single playlist that was created on an iPhone, then suddenly showed up with several thousand duplicates on my other iPhone.  The culprit playlist did not, for some reason, duplicate itself on my two iPads.  Apple support seemed to think it was because the problem iPhone tried to sync the playlist to iCloud over and over again unsuccessfully, then it finally went through and populated the thousands of blank/failed playlists which then tried to propigate to iTunes and my other iOS devices.  Seems like a reasonable theory.
    I have not yet re-enabled iTunes match.  So, no idea what will happen if I decide to go back down that rabbit hole.

  • ýesterday  my iphone 5c screen  suddendly  shows connect to itune and i try to restore it using itune but halfway i got a message error occured (14). please help me in solving this problem.

    ýesterday  my iphone 5c screen  suddendly  shows connect to itune and i try to restore it using itune but halfway i got a message error occured (14). please help me in solving this problem.

    what did you learn when you search the internet for iPhone error 14?

  • I am not able to sync some videos and apps onto my iphone 3gs. it shows a sync error: 0xe8008001.i updated it but still i am getting the same sync error problem..please help.

    i am not able to sync some videos and apps onto my iphone 3gs. it shows a sync error: 0xe8008001.i updated it but still i am getting the same sync error problem..please help.
    aman

    Are you using Windows...?

  • TS3694 Hello. I have an iphone 3gs 8gb factory unlocked. Currently its running on ios 5.0.1 and I am trying to update it ios 5.1.1 but its not updating. The itunes downloads the ios 5.1.1and gives back unknown error(3194). Please help.

    Hello. I have an iphone 3gs 8gb factory unlocked. Currently its running on ios 5.0.1 and I am trying to update it ios 5.1.1 but its not updating. The itunes downloads the ios 5.1.1and gives back unknown error(3194). Please help.

    Unable to contact the iOS software update server gs.apple.com
    Error 1004, 1013, 1638, 3194: These errors may be the result of the connection to gs.apple.com being redirected or blocked. Follow these steps to resolve these errors:
    Install the latest version of iTunes.
    Check security software. Ensure that communication to gs.apple.com is allowed. Follow this article for assistance with security software. iTunes for Windows: Troubleshooting security software issues.
    Check the hosts file. The restore will fail if there is an active entry to redirect gs.apple.com. FollowiTunes: Advanced iTunes Store troubleshooting to edit the hosts file or revert to a default hosts file. See section "Blocked by configuration: (Mac OS X/Windows) > Rebuild network information".
    Try to restore from another known-good computer and network.
    If the errors persist on another computer, the device may need service.

  • My macbook is blocked by pin code, please help, I dont know what to do!

    My macbook is blocked by pin code, please help, I dont know what to do!

    When you enter iTunes on the PC and the iPod icon pops up, right click on it and select "Options". Then click on the Music tab. Once you're in the Music tab check the box that says "Enable Disc Use". This means that you've just turned your iPod into a portable hard drive. Click "Ok" and move your iPod from the PC to the Mac. From there, your iPod should show up on the Mac's desktop right under the Hard Drive icon. Click "File" at the top of the screen and select "Add to Library". Find the iPod hard drive in the selection screen and choose the music folder that's on it. Then just click Ok and all your music will be downloaded. That should do the trick, but you might want to do a Google search on the subject to get a second opinion. Best wishes!

Maybe you are looking for

  • How can I disable a button ?

    Hi! How can I disable the a button ? There is a if statement. If it returns a false the button must be disabled. Regards sas Edited by: erdem sas on Jan 15, 2008 3:06 PM Edited by: erdem sas on Jan 15, 2008 3:16 PM

  • Text table for long text of product catalog area and product description

    Hi experts, I'm a new comer in CRM, what my current job is to do the translation for CRM system and its portal, e.g. webshop.  Now I met some questions as below, Could you please give me some advices? 1. Long text for product catalog area (t-code: CO

  • All my incoming messages are being marked as junk

    If I send a message to myself the filter marks mail as junk despite the advanced settings saying 'don't mark as junk people in my address book'. I reset the junk mail filter by accident. Anyone have any ideas. It was working OK up to that point

  • ITunes on Windows annoyance

    Everytime I use iTunes, the process "apple mobile device helper" opens as well and takes up 15 MB of RAM (on top of the 50+ iTunes already uses). Is there a way to stop this from happening? I don't have any apple mobile device and I've disabled the p

  • Need help in Plsql for Oracle Reports

    Hi i need urgent requirement for this, Kindly guide me. Since i couldnt do. Main Table: For example: Conside this table: (Card_no, month and year are unique constraint) Card_No Name Amount_1 Amount _2 Total Month Year 1 Justin 50 1000 1050 Jan 2011 1