3 Replies Latest reply on Dec 10, 2007 9:09 PM by kglad

    Movie Clip

    Blindgator Level 1
      I am new to flash and have a movie clip that is randomly generated and Im wanting it to be deleted when clicked on but I get an error message that says mouse events are only permitted for buttons. Is there any way around it?
      Thanks
        • 1. Re: Movie Clip
          kglad Adobe Community Professional & MVP
          mouse events are ok for movieclips, too. you must be applying your mouse handler(s) to something other than your movieclip.
          • 2. Re: Movie Clip
            Blindgator Level 1
            Thanks for the reply. I tried
            function removeIt () {
            _root.thingMC.removeMovieClip();
            }

            thingMC.onRelease = function() {
            removeIt;
            }
            which got rid of the error but it didnt do anything when i tested it. Also I when I was messing around with this.removeMovieClip I got it to delete some of the clips but only a certain couple. Is that a depth problem or class problem of something? Heres the rest of my script. Could you please tell me what is wrong with it? Sorry I am new to actionscript and am kindve clueless. I really aprreciate the help.
            Thanks,
            Brian

            function initThing(){
            thingArray = new Array();
            //start number bush at 0
            thingNum = 0

            //creat four things 100% at random location
            for (i=0; i<4; i++) {
            thingMC = newThing(100);
            thingMC._x = 550*Math.random();
            thingMC._y = 400*Math.random();
            }
            }

            function newThingsize) {

            //create a new thing
            thingMC = attachMovie("thing", "thing"+thingNum, thingNum++)
            //scale it to size
            thingMC._xscale = size;
            thingMC._yscale = size;
            thingArray.push(thingMC);

            return (thingMC);
            }
            • 3. Re: Movie Clip
              kglad Adobe Community Professional & MVP
              you should copy and paste code using the attach code option. otherwise, you risk posting non-sense (which you did) which wouldn't even compile and distracts from your problem.

              your first problem is you're trying to define mouse handlers for a movieclip that doesn't exist, yet: you must create your movieclip because you can assign it mouse handlers.

              your problem with removing movieclips is probably caused by trying to remove a movieclip that has a negative depth: with actionscript, you can only remove movieclips that have non-negative depths. using the swapDepths() method can be helpful when trying to remove a movieclip created in the authoring environment (which will have a negative depth). you change its depth to something non-negative and then apply your removeMovieClip() method.