8 Replies Latest reply on Apr 28, 2011 10:30 AM by kglad

    MovieClip click problem

    melas076 Level 1

      Hi!

       

      I have a problem with this code:

       

      targetClip.onRelease = function() {
          trace("OK");
          modelnamemc.play();
          };

       

      when i click on it isn't work at all why?

       

      can someone help me plz

       

      regards,

      MELAS

        • 1. Re: MovieClip click problem
          kglad Adobe Community Professional & MVP

          if you don't see the trace(), you have a path/name problem with targetClip.  if you see the trace, you have a path/name problem with modelnamemc

          • 2. Re: MovieClip click problem
            melas076 Level 1

            i did another btn and put this code and it is working well

            but not my modelnamemc at all!!!!

             

            modelnamemc is loaded an external images from xml!!!

            i want to be clickable...

             

            how can i do?

             

            regards,

            MELAS

            • 3. Re: MovieClip click problem
              kglad Adobe Community Professional & MVP

              if modelnamemc is the target movieclip of a loadMovie() method, you must wait until loading is complete to assign a mouse handler to modelnamemc.  in addition, no where in the code you showed are you attempting to add a mouse handler to modelnamemc and applying a play() method to the target of a loaded bitmap makes no sense.

              1 person found this helpful
              • 4. Re: MovieClip click problem
                melas076 Level 1

                thanks for your help.

                but how can i do it?

                • 5. Re: MovieClip click problem
                  melas076 Level 1

                  Can you help me?

                   

                  I try a lot of time but still not find it!!!!

                   

                  thanks in advance!!!

                  • 6. Re: MovieClip click problem
                    kglad Adobe Community Professional & MVP

                    for example,

                     

                    modelnamemc.loadMovie("whatever.swf");

                    clearInterval(preloadI);

                    preloadI=setInterval(preloadF);

                     

                    function preloadF():Void{

                    if(modelnamemc.getBytesLoaded()>=modelnamemc.getBytesTotal()){

                    clearInterval(preloadI);

                    mouseHandlerF();

                    }

                    }

                     

                    function mouseHandlerF():Void{

                    modelnamemc.onRelease=function(){

                    //do whatever

                    }

                    }

                    • 7. Re: MovieClip click problem
                      melas076 Level 1

                      thanks for your help!!!!

                      unfortunatly it doesn't works :

                       

                      there is the code:

                       

                      targetClip.loadMovie(txtimage1);
                      clearInterval(preloadI);
                      preloadI=setInterval(preloadF);
                      function preloadF():Void{
                      if(targetClip.getBytesLoaded()>=targetClip.getBytesTotal()){
                      clearInterval(preloadI);
                      mouseHandlerF();
                      }
                      }

                      function mouseHandlerF():Void{
                      targetClip.onRelease=function(){
                      modelnamemc.gotoAndStop(2);
                      }
                      }

                      • 8. Re: MovieClip click problem
                        kglad Adobe Community Professional & MVP

                        if textimage1 is correctly defined (ie, your image loads), use:

                         


                        targetClip.loadMovie(txtimage1);
                        clearInterval(preloadI);
                        preloadI=setInterval(preloadF);
                        function preloadF():Void{
                        if(targetClip.getBytesLoaded()>=targetClip.getBytesTotal()){
                        clearInterval(preloadI);
                        mouseHandlerF();
                        }
                        }

                        function mouseHandlerF():Void{
                        targetClip.onRelease=function(){
                        this.gotoAndStop(2);
                        }
                        }