5 Replies Latest reply on Apr 9, 2011 9:00 AM by kglad

    Mouse-overs

    Ka1i

      I'm looking for something similar to the click to display a textfield in the code snippet menu. I want the textfield to appear when i hover over the box and for the textfield to go away when the mouse is no longer on the box. How do I do this?

        • 1. Re: Mouse-overs
          kglad Adobe Community Professional & MVP

          embed your textfield's font and assign its alpha (as3)/ _alpha (as2) on mouseover/mouseout.

          • 2. Re: Mouse-overs
            Ka1i Level 1

            I'm not sure how to do that.

             

            Here is the code that I have so far.

             

             

            movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);

             

            var fl_TF:TextField;

            var fl_TextToDisplay:String = "test."

            function fl_ClickToPosition(event:MouseEvent):void

            {

            fl_TF = new TextField();

            fl_TF.autoSize = TextFieldAutoSize.LEFT;

            fl_TF.background = true;

            fl_TF.border = true;

            fl_TF.x = 0;

            fl_TF.y = 0;

            fl_TF.text = fl_TextToDisplay;

            addChild(fl_TF);

            }

            • 3. Re: Mouse-overs
              kglad Adobe Community Professional & MVP

              :

               


               

               

               

              movieClip_1.addEventListener(MouseEvent.CLICK, fl_ClickToPosition);

              movieClip_1.addEventListener(MouseEvent.MOUSE_OVER, overF);

              movieClip_1.addEventListener(MouseEvent.MOUSE_OUT,outF);

               

              function overF(e:Event):void{

              if(fl_TF){

              fl_TF.alpha=1;

              }

              }

              function outF(e:Event):void{

              if(fl_TF){

              fl_TF.alpha=0;

              }

              }

               

              var fl_TF:TextField;

              var fl_TextToDisplay:String = "test."

              function fl_ClickToPosition(event:MouseEvent):void

              {

              fl_TF = new TextField();

              fl_TF.autoSize = TextFieldAutoSize.LEFT;

              fl_TF.background = true;

              fl_TF.border = true;

              fl_TF.alpha=0;

              fl_TF.x = 0;

              fl_TF.y = 0;

              fl_TF.text = fl_TextToDisplay;

              addChild(fl_TF);

              }

               

              • 4. Re: Mouse-overs
                OS86

                Couldn't you just make a button of your text field? By physically making the button and putting your text field on the "Over" state of the button? That's what I thought of when I read this. I hope I helped. I'm just trying to answer your question.

                • 5. Re: Mouse-overs
                  kglad Adobe Community Professional & MVP

                  (he doesn't want a textfield rollover to do anything -  it's a movieclip rollover that triggers the textfield's alpha change.)