1 Reply Latest reply on Jan 4, 2008 4:58 AM by m_hartnett

    Higlight border of a box

    kruse
      I have got some box elements.
      When I click on a certain box an event happen.
      But when I have clicked on the box I can't see what box I have clicked.

      Because of this I would like to highlight (or some thing else) the border of the box to show the box that was clicked.

      How do I do that?
        • 1. Higlight border of a box
          m_hartnett Level 3
          I am not sure what you mean by box but here is a canvas, hbox and vbox with borders that change color.
          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
          >
          <mx:Script>
          <![CDATA[
          import mx.core.UIComponent;


          private var lastSelected : UIComponent;


          private function clickHandler(event:Event):void {
          if(lastSelected != null)
          lastSelected.setStyle("borderColor","#000000");

          event.target.setStyle("borderColor","#00ff00")
          lastSelected = event.target as UIComponent;
          }
          ]]>
          </mx:Script>

          <mx:HBox x="6" y="6" width="293" height="117" id="hbox1" click="clickHandler(event)" borderStyle="solid" borderColor="#000000">
          </mx:HBox>
          <mx:Canvas x="10" y="148" width="289" height="200" id="canvas1" click="clickHandler(event)" borderStyle="solid" borderColor="#000000">
          </mx:Canvas>
          <mx:VBox x="351" y="148" height="200" width="242" id="vbox1" click="clickHandler(event)" borderStyle="solid" borderColor="#000000">
          </mx:VBox>
          </mx:Application>