14 Replies Latest reply on Oct 24, 2006 11:20 AM by in v3rt

    rollover text  in buttons doesn't work inside movieclip

    in v3rt Level 1
      hello,
      i have a problem, i need to put a text when rollovers a button with the mouse and that small text follows the mouse,
      i already now to do that but the problem is that the buttons are inside a movie clip so the text doesn't apear, it doesn't work

      can anybody help me?

      my code is this:

      b2.onRollOver = function() {

      captionFN(true, "Cervejaria", this);
      this.onRollOut = function() {

      captionFN(false);

      };

      };
      b3.onRollOver = function() {

      captionFN(true, "Eventos", this);
      this.onRollOut = function() {

      captionFN(false);

      };

      };
      b4.onRollOver = function() {

      captionFN(true, "Cafetaria", this);
      this.onRollOut = function() {

      captionFN(false);

      };

      };
      b5.onRollOver = function() {

      captionFN(true, "Bebidas", this);
      this.onRollOut = function() {

      captionFN(false);

      };

      };
      b6.onRollOver = function() {

      captionFN(true, "Localização", this);
      this.onRollOut = function() {

      captionFN(false);

      };

      };
      b7.onRollOver = function() {

      captionFN(true, "Chás", this);
      this.onRollOut = function() {

      captionFN(false);

      };

      };
      captionFN = function (showCaption, captionText, bName) {

      if (showCaption) {

      _root.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
      cap.desc.text = captionText;
      cap._width = 7*cap.desc.text.length;
      cap._alpha = 75;
      //
      if ((bName._width+bName._x+cap._width)>Stage.width) {

      xo = -2-cap._width;
      yo = -17;

      } else {

      xo = 2;
      yo = -17;

      }
      hoverCaption.onEnterFrame = function() {

      cap._x = _root._xmouse+xo;
      cap._y = _root._ymouse+yo;
      cap._visible = true;

      };

      } else {

      delete hoverCaption.onEnterFrame;
      cap._visible = false;

      }

      };




      (b2; b3; b4; b5; b6 and b7 are the buttons)

      thank you (sorry my english)
        • 1. Re: rollover text  in buttons doesn't work inside movieclip
          .:}x-=V!P=-x{:. Level 3
          you have to embed the font in the textbox
          • 2. Re: rollover text  in buttons doesn't work inside movieclip
            in v3rt Level 1
            i embed the font but it continues not working

            the buttons that are inside the movie clip the text doesn't apear
            • 3. Re: rollover text  in buttons doesn't work inside movieclip
              .:}x-=V!P=-x{:. Level 3
              i noticed you never created a textfield inside your emptyMovieclip you created - ok try this
              • 4. Re: rollover text  in buttons doesn't work inside movieclip
                in v3rt Level 1
                It works fine, the text apears, but when i roll out of the button the text is always there it doesn't disappear!
                • 5. Re: rollover text  in buttons doesn't work inside movieclip
                  .:}x-=V!P=-x{:. Level 3
                  oh chang the line

                  bName.onRollOut = function() {
                  _root.captionFN(false);
                  };

                  to this

                  bName.onRollOut = function() {
                  _root.captionFN(false, "", this);
                  };
                  • 6. Re: rollover text  in buttons doesn't work inside movieclip
                    in v3rt Level 1
                    I did like you said:

                    b2.onRollOver = function() {
                    _root.captionFN(true, "Cervejaria", this);
                    };
                    b3.onRollOver = function() {
                    _root.captionFN(true, "Eventos", this);
                    };
                    b4.onRollOver = function() {
                    _root.captionFN(true, "Cafetaria", this);
                    };
                    b5.onRollOver = function() {
                    _root.captionFN(true, "Bebidas", this);
                    };
                    b6.onRollOver = function() {
                    _root.captionFN(true, "Localização", this);
                    };
                    b7.onRollOver = function() {
                    _root.captionFN(true, "Chás", this);
                    };
                    captionFN = function (showCaption:Boolean, captionText:String, bName:MovieClip) {
                    if (showCaption) {
                    _root.createEmptyMovieClip("hoverCaption", 420);
                    with (_root.hoverCaption) {
                    this.createTextField("cap", 0, 0, 0, bName._x, bName._y);
                    cap.autoSize = true;
                    cap.selectable = false;
                    if ((bName._width+bName._x+cap._width)>Stage.width) {
                    xo = -2-cap._width;
                    yo = -17;
                    } else {
                    xo = 2;
                    yo = -17;
                    }
                    }
                    hoverCaption._alpha = 75;
                    hoverCaption.onEnterFrame = function() {
                    cap._x = _root._xmouse+xo;
                    cap._y = _root._ymouse+yo;
                    };
                    bName.onRollOut = function() {
                    _root.captionFN(false, "", this);
                    };
                    cap.text = captionText;
                    } else {
                    delete _root.hoverCaption.onEnterFrame;
                    _root.hoverCaption.removeTextField(cap);
                    _root.removeMovieClip(hoverCaption);
                    }
                    };


                    but the text still doesn't disappear!

                    so I put the code like this:

                    b2.onRollOver = function() {
                    _root.captionFN(true, "Cervejaria", this);
                    this.onRollOut = function() {

                    _root.captionFN(false); }
                    };
                    b3.onRollOver = function() {
                    _root.captionFN(true, "Eventos", this);
                    this.onRollOut = function() {

                    _root.captionFN(false); }
                    };
                    b4.onRollOver = function() {
                    _root.captionFN(true, "Cafetaria", this);
                    this.onRollOut = function() {

                    _root.captionFN(false); }
                    };
                    b5.onRollOver = function() {
                    _root.captionFN(true, "Chás ", this);
                    this.onRollOut = function() {

                    _root.captionFN(false); }
                    };
                    b6.onRollOver = function() {
                    _root.captionFN(true, "Localização", this);
                    this.onRollOut = function() {

                    _root.captionFN(false); }
                    };
                    b7.onRollOver = function() {
                    _root.captionFN(true, "Bebidas", this);
                    this.onRollOut = function() {

                    _root.captionFN(false); }
                    };
                    captionFN = function (showCaption:Boolean, captionText:String, bName:MovieClip) {
                    if (showCaption) {
                    _root.createEmptyMovieClip("hoverCaption", 420);
                    with (_root.hoverCaption) {
                    this.createTextField("cap", 0, 0, 0, bName._x, bName._y);
                    cap.autoSize = true;
                    cap.selectable = false;
                    if ((bName._width+bName._x+cap._width)>Stage.width) {
                    xo = -2-cap._width;
                    yo = -17;
                    } else {
                    xo = 2;
                    yo = -17;
                    }
                    }
                    hoverCaption._alpha = 75;
                    hoverCaption.onEnterFrame = function() {
                    cap._x = _root._xmouse+xo;
                    cap._y = _root._ymouse+yo;
                    };
                    cap.text = captionText;
                    } else {
                    delete _root.hoverCaption.onEnterFrame;
                    _root.hoverCaption.removeTextField(cap);
                    _root.removeMovieClip(hoverCaption);
                    }
                    };

                    And now the text disapears fine.
                    • 7. Re: rollover text  in buttons doesn't work inside movieclip
                      .:}x-=V!P=-x{:. Level 3
                      oh ok glad you figured it out
                      • 8. Re: rollover text  in buttons doesn't work inside movieclip
                        in v3rt Level 1
                        hello again,

                        now I have another problem

                        when i return to the frame that have that code the text box but just the box apears in the mouse

                        the box has this instance name >> cap
                        • 9. Re: rollover text  in buttons doesn't work inside movieclip
                          in v3rt Level 1
                          why that happens? it should just apear when i rollover a button

                          please help me

                          thnks
                          • 10. Re: rollover text  in buttons doesn't work inside movieclip
                            .:}x-=V!P=-x{:. Level 3
                            why are you leaving the frame? cant you just stay there?
                            • 11. Re: rollover text  in buttons doesn't work inside movieclip
                              in v3rt Level 1
                              Ok... i am in the first frame with all that buttons, the text box apears and disapears in the mouse fine when i rollover the buttons then
                              I click in one button and go an play another frames with information then i close and return to the first frame. And in the moment the frame is loaded the text box without the text apears in my mouse.

                              Maybe is important to say that i have a single button that is outside the movieclip it is in the main timeline with this code:

                              b1.onRollOver = function() {

                              captionFN(true, "Apresentação", this);
                              this.onRollOut = function() {

                              captionFN(false);

                              };

                              };
                              captionFN = function (showCaption, captionText, bName) {

                              if (showCaption) {

                              _root.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
                              cap.desc.text = captionText;
                              cap._width = 7*cap.desc.text.length;
                              cap._alpha = 75;
                              //
                              if ((bName._width+bName._x+cap._width)>Stage.width) {

                              xo = -2-cap._width;
                              yo = -17;

                              } else {

                              xo = 2;
                              yo = -17;

                              }
                              hoverCaption.onEnterFrame = function() {

                              cap._x = _root._xmouse+xo;
                              cap._y = _root._ymouse+yo;
                              cap._visible = true;

                              };

                              } else {

                              delete hoverCaption.onEnterFrame;
                              cap._visible = false;

                              }

                              };


                              i hope i was clarify

                              sorry about english
                              • 12. Re: rollover text  in buttons doesn't work inside movieclip
                                .:}x-=V!P=-x{:. Level 3
                                i believe its because when you go back to the first frame you are re-declaring all the code again, try to have it go back to a frame that dosent have the code on it.
                                • 13. Re: rollover text  in buttons doesn't work inside movieclip
                                  in v3rt Level 1
                                  well, but i need to return to that first frame because is the frame that have all the buttons.

                                  is like this: i have a first frame with one button and a movie clip with 6 buttons i click in one button an go and play some frames with information about that button. then i close the information to return to the frame with that buttons to continuing exploring the site.

                                  but when the frame is loaded the text box apears in my mouse : s
                                  • 14. Re: rollover text  in buttons doesn't work inside movieclip
                                    in v3rt Level 1
                                    can anibody help me with this problem?