1 Reply Latest reply on Feb 4, 2007 10:51 PM by depakchopra

    rollover button using external xml

    depakchopra
      I am able to get a button with a movie clip to appear when the movie clip is a single frame. However, I want this button to be invisible when you start, and then appear when you hover over it. When I try to give the movieclip states of up, over, and out, I cant figure out how to get the movie to gotoAndPlay('over');

      What I am trying to do is create a new button:

      if(ok){
      allData=this.firstChild.childNodes;
      for(i=0;i<allData.length;i++){
      newBut=_root.attachMovie('button_mc','but'+i,i)
      newBut._y=50;
      newBut._x=(i*100)+50;
      newBut.but_txt.text=allData .attributes.text
      }
      }

      If your looking at this and the answer is smaking you in the face, I hope you take pitty on me and help a newbie out. This is part of a larger piece I am trying to do and have never used external files before. I know how to get a gotoAndPlay to work,

      grid_container["cell"+counter].onRollOver = function(){
      this.gotoAndPlay("over");
      }

      Why cant I use this here? I just cant figure out how to make the button appear only when you hover over it.

      Thanks
        • 1. rollover button using external xml
          depakchopra Level 1
          ok, I added this after the newBut.but_txt.text=allData .attributes.text :

          newBut.onRollOver = function(){
          newBut.gotoAndPlay('over');
          }
          newBut.onRollOut = function(){
          newBut.gotoAndPlay('up');
          }

          That seems to partly do the trick, I dont know why I had such a hard time with it prior to this.

          However, I am still missing something. I am wanting to generate hundreds of these buttons, and when you roll over any of them at this time, only the very last one is generating the 'over' state. So I need to reference the specific button I am rolling over. Any suggestions on how to do that?