2 Replies Latest reply on Dec 8, 2008 12:15 PM by evoluent

    LinkButton ignores textRollOverColor after addChild()

    evoluent
      My goal is a button that has no border/background when Up. On mouseOver, a border and background are added and stay there even after mouseOut. The button needs to have a cursor.

      I decided to use LinkButton since it has a cursor.

      I set the skin to Embed("space.png") so that none of the LinkButton's state-based skinning applies (I have no idea if this is right).

      I draw the border/background with a Shape object on mouseOver. However, when I addChild this shape, the LinkButton ignores its textRollOverColor CSS style.

      Does anyone know how I can accomplish the button and retain its textRollOverColor property?

      Here is the MXML:

      <mx:LinkButton id="navBoxNewsLink" styleName="primaryNavLink" label="NEWS" mouseOver="primaryNavOver(event)" />

      Here is the ActionScript:

      private function primaryNavSetState(obj:Object):void { // obj is event.target

      var myBorder:Shape = new Shape;
      myBorder.graphics.beginFill(0x000000,1.0);
      myBorder.graphics.lineStyle(2,0xFFFFFF);
      myBorder.graphics.drawRect(obj.x+2, obj.y+2, obj.width-4, obj.height-4);
      myBorder.graphics.endFill();
      obj.addChild(myBorder);

      }

      And here is the CSS:

      .primaryNavLink {
      color: #FFFFFF;
      textRollOverColor: #FFFFFF;
      skin: Embed("space.png");
      }