5 Replies Latest reply on Nov 12, 2006 2:47 PM by Newsgroup_User

    Problem using with()


      Can anyone help me here? I am pulling my hair out trying to get this code to work. When I test the following code I get a
      Error: A 'with' action failed because the specified object did not exist. problem. I can't see what is wrong. My three images display however the rollOver bit just doesn't happen at all. I am new to Actionscript and trying to get an exercise to work from an animation and effects text book.
        • 1. Re: Problem using with()
          arunbe Level 1
          the with command is the old one.
          so, for line drawing we give the mc name directly like this..

          target_mc.box_mc.beginFill(0xFFFFFF, 30);
          target_mc.box_mc.moveTo(0, 0);
          target_mc.box_mc.lineTo(target_mc.box_mc.w, 0);
          target_mc.box_mc.lineTo(target_mc.box_mc.w, target_mc.box_mc.h);
          target_mc.box_mc.lineTo(0, target_mc.box_mc.h);
          target_mc.box_mc.lineTo(0, 0);

          instead of

          with (target_mc.box_mc) {
          beginFill(0xFFFFFF, 30);
          moveTo(0, 0);
          lineTo(w, 0);
          lineTo(w, h);
          lineTo(0, h);
          lineTo(0, 0);
          • 2. Re: Problem using with()
            KylieJebb Level 1
            Hi Arun,

            Thanks for your help. Your answer got rid of that error, but I am still at a loss as to why the rollOver effect still isn't working. Can you see anything else that is wrong? Should that code be inside the onrollOver function? BTW, I am using flash 8.

            Thanks, Kylie
            • 3. Re: Problem using with()
              arunbe Level 1
              i think, this is a part of your code.
              i cant get any idea from this code to understand whats you desired result.
              can you send me the code details fully or send me the fla file.
              • 4. Re: Problem using with()
                KylieJebb Level 1
                Hi Arun,

                I have attached the complete code. My goal is just basically to code an image gallery using actionscript. I don't know of any good ones on the net but I would rather code one myself and learn before going down that alley. Once I get the rollOver effect going I wanted to put some code that when the user clicked on an image, the fullsize picture will display. If you can see why the rollOver effect isn't working, I would appreciate it.
                • 5. Re: Problem using with()
                  Level 7
                  Its telling you than box_mc doesn't exist. So its most likely not your
                  code, but other things in your FLA. make sure your names are correct with
                  correct upper/lower case, and make sure that your code is executing where it
                  is supposed to (in the correct clip).

                  Put in some tracing like
                  at various key places to ensure it is running inside the clip you expect it

                  Basically, you need to find out why things aren't how you expect .. and
                  99.9999% of the time, the problem is with something you've done :)