Dude, !

Thanks, I knew it was as simple as that!

Thanks again.

Peace, Mike

On 4/28/06, Dirk Eismann <[EMAIL PROTECTED]> wrote:
Here's a quick example of a Button subclass which is only clickable on
its left side:

package {
     
      import mx.controls.Button;
      import flash.display.*;
     
      public class ButtonTest extends Button {
     
            override protected function createChildren():void
            {
                  super.createChildren();
                 
                  var s:Sprite = new Sprite();
                  s.visible = false;
                  s.mouseEnabled = false;

                  addChild(s);
                  hitArea = s;
            }
           
            override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
            {
                  super.updateDisplayList(unscaledWidth,
unscaledHeight);
                  var g:Graphics = hitArea.graphics;
                  g.clear();
                  g.beginFill(1, 1);
                  g.drawRect(0, 0, unscaledWidth/2,
unscaledHeight);
            }
      }
}

Usage:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
layout="absolute">
  <ButtonTest label="I'm only active on the left side"/>
</mx:Application>


Dirk.

________________________________

      From: flexcoders@yahoogroups.com
[mailto:flexcoders@yahoogroups.com] On Behalf Of Michael Schmalle
      Sent: Friday, April 28, 2006 3:17 PM
      To: flexcoders@yahoogroups.com
      Subject: [flexcoders] Flex2 :: Subclassing Button :: How to
change hitarea placement

     
     
      Hi,
     
      I was wondering if anybody from Adobe could shed some light on
how to go about adding like two little buttons to a Button?
     
      I have tried with all my heart and cannot find a way to chnge
the hitArea of a button to something smaller than it's bounds.
     
      Are you just adding a click listener to the whole component? If
so, this makes it really hard to subclass.
     
      Can you give me any advice?
     
      Peace, Mike
     
      PS won't be asking these questions when I can see the source !
:)
     
      --
      What goes up, does come down.
     
      --
      Flexcoders Mailing List
      FAQ:
http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
      Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com
     
     
     
     
      SPONSORED LINKS
      Web site design development
<http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+
site+design+development&w2=Computer+software+development&w3=Software+des
ign+and+development&w4=Macromedia+flex&w5=Software+development+best+prac
tice&c=5&s=166&.sig=L-4QTvxB_quFDtMyhrQaHQ>        Computer software
development
<http://groups.yahoo.com/gads?t=ms&k=Computer+software+development&w1=We
b+site+design+development&w2=Computer+software+development&w3=Software+d
esign+and+development&w4=Macromedia+flex&w5=Software+development+best+pr
actice&c=5&s=166&.sig=lvQjSRfQDfWudJSe1lLjHw>        Software design and
development
<http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=
Web+site+design+development&w2=Computer+software+development&w3=Software
+design+and+development&w4=Macromedia+flex&w5=Software+development+best+
practice&c=5&s=166&.sig=1pMBCdo3DsJbuU9AEmO1oQ>       
      Macromedia flex
<http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+
development&w2=Computer+software+development&w3=Software+design+and+deve
lopment&w4=Macromedia+flex&w5=Software+development+best+practice&c=5&s=1
66&.sig=OO6nPIrz7_EpZI36cYzBjw>        Software development best
practice
<http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&
w1=Web+site+design+development&w2=Computer+software+development&w3=Softw
are+design+and+development&w4=Macromedia+flex&w5=Software+development+be
st+practice&c=5&s=166&.sig=f89quyyulIDsnABLD6IXIw>       

________________________________

      YAHOO! GROUPS LINKS


                  *      Visit your group "flexcoders
<http://groups.yahoo.com/group/flexcoders> " on the web.
             
      *      To unsubscribe from this group, send an email to:
            [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]?subject=Unsubscribe>
             
      *      Your use of Yahoo! Groups is subject to the Yahoo!
Terms of Service <http://docs.yahoo.com/info/terms/> .


________________________________




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS






--
What goes up, does come down.

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to