A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Tooltip in Flash AS2

  1. #1
    Member
    Join Date
    Jul 2008
    Posts
    49

    Tooltip in Flash AS2

    I have a map with 32 small states and I like to show the name of each state when the user mouse over the state.The states are all now buttons, the problem is that as the states are very small and reside closely sometimes the states with big names creates problem. So I am in search of tooltip that will display the name of the state when the user mouse over the state.

    Can anyone help me. The state will be buttons and I could not use movie clip .

    Thanks.

  2. #2
    Junior Member
    Join Date
    Jul 2012
    Posts
    14
    Is this you need?
    Attached Files Attached Files

  3. #3
    Member
    Join Date
    Jul 2008
    Posts
    49
    Thanks for the help. It works but I have to write 32 times for 32 states. I am in search of some way so that we can use some lesser code to do this. However I really appreciate your help.

    Thanks.

  4. #4
    . fruitbeard's Avatar
    Join Date
    Oct 2011
    Posts
    1,780
    Hi,

    This might help you out.

    PHP Code:
    var states = Array("State1""State2""State3""State4""State5");

    for (var 
    i:Number 0states.lengthi++)
    {
        
    this["S" i].Num i;
        
    this["S" i].onRollOver = function()
        {
            
    StateText.text states[this.Num];
            
    StateText._x this._x;
            
    StateText._y this._y;
        };
        
    this["S" i].onRollOut = function()
        {
            
    StateText.text "";
        };

    In this example I have named the buttons/clips (state buttons) S0, S1, S2, S3, S4 and so on.
    So "S0" corresponds with state 1 "S1" corresponds with state2, this is because arrays start at 0.

    However, if you have the states named the same as the button clips you can do this instead.
    PHP Code:
    var states = Array("State1""State2""State3""State4""State5");

    for (var 
    i:Number 0states.lengthi++)
    {
        var 
    StateButtons this[states[i]];
        
    StateButtons.onRollOver = function()
        {
            
    StateText.text this._name;
            
    StateText._x this._x;
            
    StateText._y this._y;
        };
        
    StateButtons.onRollOut = function()
        {
            
    StateText.text "";
        };

    Holla if you get stuck.

    Fruit
    Last edited by fruitbeard; 06-24-2013 at 03:00 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center