8 Replies Latest reply on Mar 31, 2011 8:24 AM by SorJai225

    Erm.. my puzzle is appearing everywhere?

    SorJai225 Level 1

      I didnt have this problem before... but yeah... heres the problem:

       

      I made a drag and drop jigsaw game... and when i put the pieces in the 'target' it sticks to it and stays there... good.

      the PROBLEM is when i go to OTHER pages/frame, the picture in the 'target' is viewable...

       

      how do i make that not happen?!

      i use action script 3 btw.

        • 1. Re: Erm.. my puzzle is appearing everywhere?
          kglad Adobe Community Professional & MVP

          as2 or as3?

          • 2. Re: Erm.. my puzzle is appearing everywhere?
            SorJai225 Level 1

            i already mentioned as3 in my last sentence XD

            • 3. Re: Erm.. my puzzle is appearing everywhere?
              kglad Adobe Community Professional & MVP

              apply removeChild() and null your displayobjects that are no longer needed.

              1 person found this helpful
              • 4. Re: Erm.. my puzzle is appearing everywhere?
                SorJai225 Level 1

                var startX:Number;

                var startY:Number;

                var counter:Number = 0;

                 

                pone_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                pone_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);

                ptwo_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                ptwo_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);

                pthree_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                pthree_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);

                pfour_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                pfour_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);

                pfive_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                pfive_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);

                psix_mc.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                psix_mc.addEventListener(MouseEvent.MOUSE_UP, dropIt);

                 

                function pickUp(event:MouseEvent):void {

                    event.target.startDrag(true);

                    replytxt.text = "";

                    event.target.parent.addChild(event.target);

                    startX = event.target.x;

                    startY = event.target.y;

                }

                function dropIt(event:MouseEvent):void {

                    event.target.stopDrag();

                    var myTargetName:String = "target" + event.target.name;

                    var myTarget:DisplayObject = getChildByName(myTargetName);

                    if (event.target.dropTarget != null && event.target.dropTarget.parent == myTarget){

                        replytxt.text = "Good Job!";

                        event.target.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                        event.target.removeEventListener(MouseEvent.MOUSE_UP, dropIt);

                        event.target.buttonMode = false;

                        event.target.x = myTarget.x;

                        event.target.y = myTarget.y;

                        counter++;

                    } else {

                        replytxt.text = "Try Again!";

                        event.target.x = startX;

                        event.target.y = startY;

                    }

                    if(counter == 6){

                        replytxt.text = "Congratulations, you've finished!";

                    }

                }

                 

                pone_mc.buttonMode = true;

                ptwo_mc.buttonMode = true;

                pthree_mc.buttonMode = true;

                pfour_mc.buttonMode = true;

                pfive_mc.buttonMode = true;

                psix_mc.buttonMode = true;

                 

                im a beginner in this program... can you help me out on where to type that and what to type please? XD

                • 5. Re: Erm.. my puzzle is appearing everywhere?
                  kglad Adobe Community Professional & MVP

                  when you "go to another page" call removeF:

                   

                  function removeF():void{

                  pone_mc.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                  pone_mc.removeEventListener(MouseEvent.MOUSE_UP, dropIt);

                  ptwo_mc.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);

                  etc

                  removeChild(pone_mc)

                  removeChil(ptwo_mc);

                  etc

                  pone_mc=null

                  ptwo_mc=null

                  etc

                  }

                  • 6. Re: Erm.. my puzzle is appearing everywhere?
                    SorJai225 Level 1

                    thanks dude. i have one last question... from time to time... my dynamic text doesnt work... where the text will change into things like

                    'well done'

                    'congratulations'

                     

                    etc etc when they get the pieces right.. is there anything wrong with my codings of my dynamic text?

                    • 7. Re: Erm.. my puzzle is appearing everywhere?
                      kglad Adobe Community Professional & MVP

                      i don't see a code problem.  just assign the textfield's text property when appropriate.  it looks like you're doing that.

                       

                      however, if that textfield is in more than one keyframe, that can cause text to not appear.  or, if your text needs to be embedded that can cause a text not-appearing problem.

                       

                       

                      p.s.  please mark correct/helpful answers.

                      1 person found this helpful
                      • 8. Re: Erm.. my puzzle is appearing everywhere?
                        SorJai225 Level 1

                        http://forums.adobe.com/thread/832013

                         

                        your answer didnt work for the dynamic text, please help me again