I just can't work out the variable here!

Hi team,
I have some code that I am trying to put onto 10 different moviclips m1, m2 m3 etc to 10
I have tried to use every hint and bit of code that has been given to me by others here but I just can't get it to work..
I am trying
for (var i =1; i<=10; i++){
trace("m"+i);// this gives me the right result but doesnt work in the code..
I have tried
m[i]
["m"+i]
MovieClip("m"+i)
this.[m+i]
..... and heaps more!  I just can't get it to work.
Here is the code I am trying to use this variable on, 
Thanks for any help,
sub
m1.minX = 132;
m1.minY = 182;
m1.maxX = 930;
m1.maxY = 720;
// Initialize the circle at a random coordinate within the acceptable range.
m1.x = Math.random() *m1.maxX -m1.minX;
m1.y = Math.random() *m1.maxY -m1.minY;
// Set the velocity of the circle to six pixels/frame.
m1.vel = .003;
/* Initialize the x and y vectors for the circle clip. A "vector",
   in circle case, is a line that both direction (angle) and speed ("velocity").
   Here the direction is either horizontal (x-axis), in the
   case of "vx," or vertical (the y-axis), in the case of "vy."
   So, while it may appear that we're just assigning one number, the
   velocity, keep in mind that we've also determined the direction by
   distinguishing these values as either horizonal ("vx") or vertical ("vy").
   BUT -- while all that is true, it's also cheating a little (remember, this
   is the "simple" version.) The reality is that we're really using 2 speeds
   and 2 directions, where a vector is truly a single direction and single
   speed.  See the "complex" version for that execution.
m1.vx = Math.random() * 3;
m1.vy = Math.random() * 3;
// Define an onEnterFrame() method for the circle so that it continually updates
// its position.
m1.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(e:Event):void {
    // Calculate the new x and y coords for the circle clip on each frame
    // based on what happened in the previous frame (in the conditionals below.)
   m1.x +=m1.vx;
   m1.y +=m1.vy;
    // If the circle is touching the rectangle or is outside its boundaries,
    // change direction.
    if ((m1.x +m1.width/2) >=m1.maxX) {
       m1.x =m1.maxX -m1.width/2;
       m1.vx *= -1;
    else if ((m1.x -m1.width/2) <=m1.minX) {
       m1.x =m1.minX +m1.width/2;
       m1.vx *= -1;
    if ((m1.y  +m1.height/2) >=m1.maxY) {
       m1.y =m1.maxY -m1.height/2;
       m1.vy *= -1;
    else if ((m1.y -m1.height/2) <=m1.minY) {
       m1.y =m1.minY +m1.height/2;
       m1.vy *= -1;

The correct way to target instances m1 thru m10 using bracket notation would be... 
this["m"+i]
or even more correctly...
this["m"+String(i)]

Similar Messages

  • How can i work out the GMT time wherever i am ?

    Hi, i'm going crazy with the date/time classes, just can't seem to work it out.
    I need to know the current time as a GMT time.
    I need to know wherever the program is running, i myself am in Amsterdam GMT+02:00 , my server is located in Canada GMT-04:00 (?)
    I parse dates from websites all over the world so i get times in the form of strings of which i know the timezone. I need to store everything in a mysql database and i want the database to contain GMT times only.
    I've worked out how to get a string from its timezone into GMT but,
    how can i get the current time as GMT ?
    somehow i keep getting timeshifts i cannot explain.
    this is where i got to:
    TimeZone tz_gmt;
    tz_gmt = TimeZone.getTimeZone("GMT");
    SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    sdformat.setTimeZone(tz_gmt);
    Timestamp tsGmtnow;
    tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
    Which is fine if i run it in Amsterdam, it gives me the current date/time in GMT, but on the server in Canada it gives me GMT+4 hours. What am i missing ?

    found a workaround,
         TimeZone tz_gmt;
         tz_gmt = TimeZone.getTimeZone("GMT");
         TimeZone tz_can;
         tz_can = TimeZone.getTimeZone("GMT-04:00");
         TimeZone tz = TimeZone.getDefault();
         String Stz = tz.getID();
         SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Timestamp tsGmtnow;
    if ( "Europe/Berlin".compareTo(Stz) == 0) {
         // i'm in Europe, go from local time to GMT
         sdformat.setTimeZone(tz_gmt);
         tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
    } else {
         // i'm in Canada, local time IS gmt
         sdformat.setTimeZone(tz_can);
         tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
    out.println(tsGmtnow.toString());
    the default timezone returns either:
    Europe/Canada
    GMT-04:00
    somehow the GMT-04:00 get ignored by the formatter

  • How can I work out the I cloud

    How can I download the music
    How can I get the I cloud started
    Need to increase the speed of my cell the fastest processing unit required

    Music and other content from the store will only show if you are in a country where they can be redownloaded (and if they remain in the store). If you are in a country where you can redownload music purchases then you will have a Music category in the Purchased tab in the iTunes store app on your phone, and under the Purchased link under Quicklinks on the right-hand side of the iTunes store homepage on your computer's iTunes
    There is some info on the cloud here : http://www.apple.com/icloud
    How to set up : http://www.apple.com/icloud/setup/
    Creating an iCloud account : http://support.apple.com/kb/HT4436

  • How can I work out the Total Uptime between two points?

    I need to find the TOTAL uptime between a certain date and now (need to separate for an electricity bill). Can someone help me with a script or something?
    Thanks

    I'm confused as to what you are looking for if uptime is not it. 
    I need to find out how long it has been powered on from the 6th August 2014 to now. Any ideas?
    If the system has been rebooted in that time then you might be able to go back into the log files and as Mark Jalbert wrote look for the times the system was shutdown and then booted and get a rough figure that way. But of course this requires that the log files since August are still available.
    Of course what the system was booted there is no guarantee all external peripherals were also on and when the system was shutdown there is no guarantee that all the peripherals were turned off so at best you are getting a rough estimate.

  • Why can't I access the variables in my threads?

    hello.
    another question about threads..
    ==========================
    I have an inner class that implements Runnable (i.e. a thread) and has a variable in it. I want to be able to access that variable from outside the thread class so that I can set or retrieve the variable.
    here is the code for the program
    class myClass
         public static void main(String[] args)
              myClass c = new myClass();
         myClass()
              Thread t = new Thread(new myThread());
              t.number = 1;
              t.start();
         class myThread implements Runnable
              int number = 0;
              public void run()
         }//end myThread
    }//end myClassthe line
    t.number = 1;
    where I try to set the number variable to 1 gives me an error (in the MyClass constructor)
    This is my error
    AccessThreadVars.java:11: cannot find symbol
    symbol  : variable number
    location: class java.lang.Thread
              t.number = 1;
                        ^
    1 errorif I put a method in myThread, and then try to call that method from myClass (via t.MethodName()) it gives me that same error telling me it can't find it..
    what am I doing wrong? how can I get access my thread's variables and methods??

    1. Type names should start with an uppercase letter
    2. t is defined as a Thread, not as a myThread
    (which, may I insist, should be "MyThread"), so the
    compiler has no means of detecting that "number" is
    an accessible field of the object... which wouldn't be accessible anyway, cause you're trying to get attributes from your Runnable after wrapping it inside a Thread.
    Why don't you do something like :
    MyThread t = new MyThread();
    t.number = 1;
    new Thread(myThread).start();?
    I bet you don't use Thread's own methods anyway...

  • I have updated my Apple ID via my iPad, but my other devices still think the ID is the old one and I can't work out how to update them

    Yesterday, after discovering that the email address I used as my Apple ID was about to be deleted, I used my iPad to update my Apple ID to a new one.  Everything went fine, until I moved on to my iPhone, which is still asking me for the password for my OLD Apple ID.  I can't work out how to tell either my iPhone or my Macbook that this one is out of date and get them to change to the new one.  iTunes is changed, but the settings aren't.  Can anyone help me please?

    You haven't stuffed it, you just haven't signed out, so do that now, everywhere your old ID appears needs to be signed out of.
    Any variant of "Find My" (phone/mac/pad etc) that's signed in should be signed out.
    List what needs a sign out if you don't know how to.

  • How do I save a photo after I have zoomed in on it?  I want to save the zoom-in as a new photo and can't work out why this doesn't work the same way saving a cropped image, or adjusted image does.  Thank you.

    How do I save an image after I have zoomed in on it?  I can't work out why I can't save a zoom-in the same way
    I can save a cropped image or an adjusted image. Thanks, Lily A.

    Hi Matt, thanks for your reply.  Have realised that Zoom in Iphoto is just  a viewing tool and not an editing tool.
    Was creating beautiful abstractions by zooming in and wanted to create a new image of the result.   Have since discovered that cropping after zooming takes me a little way to where I want to go but it isn't the same effect.  Will perhaps have to try to create it when actually shooting.  Am doing a photoshop course in February and maybe will learn a bit more then, too.  Am pretty much an amateur just finding my way.
    Thanks again,
    Best, Lily

  • I prepare chronologies in word, and i am trying to do the same in pages using tables and cells. But somtimes i need a cell to wrap onto the next page but I can't work out how to do it - any suggestions would be greatly appreciated

    I prepare chronologies in word, and I am trying to do the same in pages using tables and cells. But sometimes I need a cell to wrap onto the next page because the contents are bigger than the page or the space left on the page,  but I can't work out how to do it - any suggestions would be greatly appreciated

    brendanfromsydney wrote:
    What are the different opinions on why pages should not achieve this?
    As far as I know, Apple is free to choose to offer this or that feature.
    They never said that they want to clone Word or even compete with it.
    Differences between tables in both worlds are numerous.
    In Pages (or Numbers)
    - we can't sort a single column
    - we can't sort by row
    - we can't insert or remove a single cell
    - a cell can't cross pages boundaries
    If I understand well these design choices match :
    ++-+-+-+-+-+-+-+-++
    Apple Human Interface Guidelines:
    Apply the 80 Percent Solution
    During the design process, if you discover problems with your product design, you might consider applying the 80 percent solution‚ that is, designing your software to meet the needs of at least 80 percent of your users. This type of design typically favors simpler, more elegant approaches to problems.
    If you try to design for the 20 percent of your target audience who are power users, your design may not be usable by the other 80 percent of users. Even though that smaller group of power users is likely to have good ideas for features, the majority of your user base may not think in the same way. Involving a broad range of users in your design process can help you find the 80 percent solution.
    +-+-+-+-+-+-+-+-+-++
    Yvan KOENIG (VALLAURIS, France) jeudi 9 juin 2011 16:03:52
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • How can I close out the page I am working on in safari when error boxes keep popping up?

    How can I close out the page I am working on in safari when error boxes keep popping up?

    What do the error messages say ?

  • I have CS5 and a d-600. I would like to use camera raw but not working. I downloaded CR 7.3 and still not working. Do I need to upgrade to CS6 ..or just throw it all out the window and get rid of my d-600 ?

    I have CS5 and a d-600. I would like to use camera raw but not working. I downloaded CR 7.3 and still not working. Do I need to upgrade to CS6 ..or just throw it all out the window and get rid of my d-600 ?

    it allows you to use your cr files, Adobe - Adobe Camera Raw and DNG Converter : For Windows
    Camera Raw: How to use Adobe DNG Converter - YouTube

  • Hi - I'm trying to sync iBooks on my Macbook Pro with iBooks running on my iPad. I have some pdf's download from the net I want to share between devices and I can't work out how to sync the two devices. Any help please?

    Hi - I'm trying to sync iBooks on my Macbook Pro with iBooks running on my iPad. I have some pdf's download from the net I want to share between devices and I can't work out how to sync the two devices. Any help please? I'm running Mavericks

    Thanks for your help Brij011 - much appreciated. Apologies as I'm a newbie but I've looked at the info for synching and I appear to have all the switches flicked on my iPad. Does the iPad and iBooks only sync in iCloud for purchases as I appear to be doing something wrong. I could sync ok when books was in iTunes but since migrating to Mavericks I think I'm doing something wrong!!

  • Have Lion, but just can't sign out in System Preferences iCloud.The application freezes

    Have Lion, but just can’t sign out in System Preferences>iCloud.The application freezes

    Nevermind. Reinstalled Leopard. Must have not installed Printing setup utilities properly upon first install.

  • I'm a new iPad owner. When I've rented a movie, I can't work out how to play it back without a wifi connection. I get a message which says you cannot connect to the iTunes store without an Internet connection. This happens whether I've rented or purchased

    I'm a new iPad owner. When I've rented a movie, I can't work out how to play it back without a wifi connection. I get a message which says you cannot connect to the iTunes store without an Internet connection. This happens whether I've rented or purchased a film. We're going on a flight soon and would ideally like to watch one on the plane. Can someone please provide some step by step instructions. Thanks.

    Rented or purchased video are watched through the videos app after you have downloaded them, iTunes on iOS devices is for buying media only.

  • HT1766 Whenever I try to backup my ipad to iCloud, I get the following error message and can't work out why " the last backup could not be completed" I am connected to my wi FI and iPad off and connected to power. Please can anyone help ?

    Whenever I try to backup my ipad to iCloud, I get the following error message and can't work out why " the last backup could not be completed" I am connected to my wi FI and iPad off and connected to power. Please can anyone help ?

    In settings>general> cellular do you have it  turned ON?

  • HT1688 I have a damaged I-Phone and I need the contents of my calendar off of it. I did not have Mobile me at the time.  Can I swap out the sim card from the broken phone to a new phone and recover this calendar?

    I have an older I-Phone (3G) that for some reason the body of the phone has split in two.  This phone was a business phone and it had a lot of important information on it. I have a second phone that is also a 3G.  On the broken phone there is a lot of important information that I need in my calendar. Im not worried about anything else but the calendar.  I didn't have the Mobile Me account at that time or I would be having this problem. Does anybody know if I can ust switch out the sim cards. I just need to recover the old calendar, so im hoping that the calendar will transfer when I switch the sim card into the good 3G. If that doesn't work does anybody know of anyway that I can retrieve this information off of this phone?

    Nothing is stored on the sim card on an iPhone.  If you backed up to your computer the backup will contain your calendar events.  Otherwise, if your phone isn't functioning there is no way to back up or extract your calendar at this point.

Maybe you are looking for

  • Play Waveform Express vi: How to disable "Normalize waveform"?

    I am an EE professor. My students are using LabView to develop simple music synthesizers. How can we disable the "Normalize Waveform" function within the "Play Waveform" express vi, so that we can control volume with amplitude?

  • My email print is so small i can't read it. how do i get it back to normal size?

    If  you know the answer to this problem  please post it on forum as I can't read my email's. Thanks gman55. This question was solved. View Solution.

  • BUG - Switch statement & compiler

    I am overriding AccordionHeader. In the set Data method I have a switch statement. I dont think the location of the statement is relevant, but included for completeness. (MenuGroup is my own class and not relevant) If you have the following code Flex

  • Sample editing bug in 10.1

    For some reason the transient editing mode/slicing in LPX 10.1 is not working correctly. Have a look at this video and you'll see that the slices i make are not reflective of the exs24 instrument created. VIDEO: http://cl.ly/0e1d0A042m2H Any input wo

  • JNI_GetCreatedJavaVMs not working

    I was trying to use the JNI_GetCreatedJavaVMs to work and it gives me an error within my C++ program: C:\Examples\Conversation\MSGpumper\MSGpumperDlg.cpp(193) : error C2039: 'JNI_GetCreatedJavaVMs' : is not a member of 'JNIEnv_' c:\jbuilder8\jdk1.4\i