3 Replies Latest reply on Jul 20, 2009 9:24 AM by Rothrock

    Weird issue - code rejected not sure why

    qpidity72 Level 1

      Hi,

       

      I'm experiencing an issue with a piece of code which elsewhere works without issue. For some reason Flash keeps rejecting it.

       

      The following is the code placed on a frame, within a movie clip button. No other code on main timeline relating to the same mc btn.Code causing the issue highlighted in red

       

      stop();

       

      back_mc.onRollOut = function(){
          gotoAndPlay("out");
      }

       

      back_mc.onRelease = function(){
          unloadMovieNum(01);
          unloadMovieNum(02);
          unloadMovieNum(03);   
          unloadMovieNum(04);   
          unloadMovieNum(05);
          unloadMovieNum(06);
          unloadMovieNum(07);
         unloadMovieNum(08);
          unloadMovieNum(09);

          unloadMovieNum(10);
          unloadMovieNum(11);
          unloadMovieNum(12);
          unloadMovieNum(13);
          unloadMovieNum(14);   
          unloadMovieNum(15);
          unloadMovieNum(16);
          unloadMovieNum(17);
          unloadMovieNum(18);
          unloadMovieNum(19);
          unloadMovieNum(20);
          unloadMovieNum(21);
          unloadMovieNum(22);
          unloadMovieNum(23);   
          unloadMovieNum(24);   
          unloadMovieNum(25);
          unloadMovieNum(26);
          unloadMovieNum(27);
          unloadMovieNum(28);
          unloadMovieNum(29);
          unloadMovieNum(30);
          _root.gotoAndPlay("home");
      }

       

      Compiler errors attached. Strangely, if I remove the zero's on just these two lines then the errors disappear and the button functions as intended. I just can't understand why just on these two lines of code would the zero cause any type of issue.

       

      Grateful for any assistance.

       

      Thanks in advance

        • 1. Re: Weird issue - code rejected not sure why
          kglad Adobe Community Professional & MVP

          that's pretty screwy code so you may have problems elsewhere sooner or later.  but for now why don't you remove the zeros?

          • 2. Re: Weird issue - code rejected not sure why
            qpidity72 Level 1

            Hi kglad,

             

            Thanks for your reply.

             

            I wasn't aware that this is scewy code. Could you please tell me why ? Recently started to learn AS3 through formal training but didnt have much opportunity with AS1/2. Taught myself bit and pieces and the results obviously show ! I've used this particular code often but this is the first time i'm having this issue. I could simply remove the zeros but I'd be happier to know where I'm going wrong rather than a band-aid solution which comes back to haunt me again further down the line.

             

            Thanks in advance.

            • 3. Re: Weird issue - code rejected not sure why
              Rothrock Level 5

              A zero in front of a number (since normal numbers don't have leading zeros) tells flash that the number it is reading is octal (base 8). In an octal system there is no "8" or "9" so that doesn't make sense to Flash (or anywhere else for that matter.

               

              But as Kglad says this is pretty bizarre code. Do you actually have things loaded into all those levels? That seems alike a lot of stuff to be loading in.

               

              Additionally I've always found that levels are really hard to deal with since there is no "Level" class and therefore the number of things you can do with them is very limited. In fact if/when you make the jump to AS3 you will find that levels are completely gone.

               

              Without knowing all the details of what you are doing it is hard to give specific advice, but generally loading into movieclips is a better practice. And only adding and removing specifcally what you need in a (possibly) more organized manner....