RE: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement
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:[EMAIL PROTECTED] 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=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We b+site+design+developmentw2=Computer+software+developmentw3=Software+d esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1= Web+site+design+developmentw2=Computer+software+developmentw3=Software +design+and+developmentw4=Macromedia+flexw5=Software+development+best+ practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+ developmentw2=Computer+software+developmentw3=Software+design+and+deve lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1 66.sig=OO6nPIrz7_EpZI36cYzBjw Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practice w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw are+design+and+developmentw4=Macromedia+flexw5=Software+development+be st+practicec=5s=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] * 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Re: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement
Dude, ! Thanks, I knew it was as simple as that! Thanks again. Peace, MikeOn 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=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We b+site+design+developmentw2=Computer+software+developmentw3=Software+d esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1= Web+site+design+developmentw2=Computer+software+developmentw3=Software +design+and+developmentw4=Macromedia+flexw5=Software+development+best+ practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+ developmentw2=Computer+software+developmentw3=Software+design+and+deve lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1 66.sig=OO6nPIrz7_EpZI36cYzBjw Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practice w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw are+design+and+developmentw4=Macromedia+flexw5=Software+development+be st+practicec=5s=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 Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- 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
Re: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement
Well, Do you have another answer ;-) This did what I was looking for but, the event effect still is not right. I am making a drag and drop tab button. I need the button to have the normal hitarea that the skins use to detect the ACTUAL button click. I need a 10x10 dragger sprite, button whatever to be on top of the button skins, this component needs to listen for mouseMove etc. Then I need a close button on the other side. Now this would be really easy from my end. I wouldn't even extend button, I would make my own tab using composition. To me that is more tight thatn what I am doing to the Button. The problem with the approach is, Adobe did not program to an interface but to a concrete implementation of Button in the TabBar. So now, I cannot override createNavItem() and use my Tab becasue down the chain in the Bar, it is testing somewhere for mx.controls.Button, then I get the nice cannot coeirce Tab to Button. If there was an IButton interface or ITabButton interface that they tested for, that would solve problems like this where I do not want to subclass but to type an instance AS ITabButton interface that does what the ITabButton interface requires.. Any thoughts? Am I doing something wrong when subclassing the Button? Peace, MikeOn 4/28/06, Michael Schmalle [EMAIL PROTECTED] wrote: Dude, ! Thanks, I knew it was as simple as that! Thanks again. Peace, MikeOn 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=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We b+site+design+developmentw2=Computer+software+developmentw3=Software+d esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1= Web+site+design+developmentw2=Computer+software+developmentw3=Software +design+and+developmentw4=Macromedia+flexw5=Software+development+best+ practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+ developmentw2=Computer+software+developmentw3=Software+design+and+deve lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1 66.sig=OO6nPIrz7_EpZI36cYzBjw Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practice w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw are+design+and+developmentw4=Macromedia+flexw5=Software+development+be st+practicec=5s=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:
RE: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement
Just wondering... what's the use case for making a Button ignore some clicks inside the border that it draws? Are you also reskinning the button to have a non-rectangular shape? - Gordon From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Michael Schmalle Sent: Friday, April 28, 2006 6:30 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement 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=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We b+site+design+developmentw2=Computer+software+developmentw3=Software+d esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1= Web+site+design+developmentw2=Computer+software+developmentw3=Software +design+and+developmentw4=Macromedia+flexw5=Software+development+best+ practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+ developmentw2=Computer+software+developmentw3=Software+design+and+deve lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1 66.sig=OO6nPIrz7_EpZI36cYzBjw Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practice w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw are+design+and+developmentw4=Macromedia+flexw5=Software+development+be st+practicec=5s=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 Visit your group flexcoders on the web. To unsubscribe from this group, send an email to: [EMAIL PROTECTED] Your use of Yahoo! Groups
RE: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement
Sorry... I see that you've already described what you're doing in a subsequent email. - Gordon From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith Sent: Friday, April 28, 2006 3:51 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement Just wondering... what's the use case for making a Button ignore some clicks inside the border that it draws? Are you also reskinning the button to have a non-rectangular shape? - Gordon From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Michael Schmalle Sent: Friday, April 28, 2006 6:30 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement 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=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We b+site+design+developmentw2=Computer+software+developmentw3=Software+d esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1= Web+site+design+developmentw2=Computer+software+developmentw3=Software +design+and+developmentw4=Macromedia+flexw5=Software+development+best+ practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+ developmentw2=Computer+software+developmentw3=Software+design+and+deve lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1 66.sig=OO6nPIrz7_EpZI36cYzBjw Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practice w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw are+design+and+developmentw4=Macromedia+flexw5=Software+development+be st+practicec=5s=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
Re: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement
Gordon, I just made a composite tab button, re implemented a tab bar out of a NavBar, made it toggle and I am good for now. ;-) ... Hacking through the bushes ... Peace, MikeOn 4/28/06, Gordon Smith [EMAIL PROTECTED] wrote: Sorry... I see that you've already described what you're doing in a subsequent email. - Gordon From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Gordon Smith Sent: Friday, April 28, 2006 3:51 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement Just wondering... what's the use case for making a Button ignore some clicks inside the border that it draws? Are you also reskinning the button to have a non-rectangular shape? - Gordon From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of Michael Schmalle Sent: Friday, April 28, 2006 6:30 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Flex2 :: Subclassing Button :: How to change hitarea placement 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=msk=Web+site+design+developmentw1=Web+ site+design+developmentw2=Computer+software+developmentw3=Software+des ign+and+developmentw4=Macromedia+flexw5=Software+development+best+prac ticec=5s=166.sig=L-4QTvxB_quFDtMyhrQaHQ Computer software development http://groups.yahoo.com/gads?t=msk=Computer+software+developmentw1=We b+site+design+developmentw2=Computer+software+developmentw3=Software+d esign+and+developmentw4=Macromedia+flexw5=Software+development+best+pr acticec=5s=166.sig=lvQjSRfQDfWudJSe1lLjHw Software design and development http://groups.yahoo.com/gads?t=msk=Software+design+and+developmentw1= Web+site+design+developmentw2=Computer+software+developmentw3=Software +design+and+developmentw4=Macromedia+flexw5=Software+development+best+ practicec=5s=166.sig=1pMBCdo3DsJbuU9AEmO1oQ Macromedia flex http://groups.yahoo.com/gads?t=msk=Macromedia+flexw1=Web+site+design+ developmentw2=Computer+software+developmentw3=Software+design+and+deve lopmentw4=Macromedia+flexw5=Software+development+best+practicec=5s=1 66.sig=OO6nPIrz7_EpZI36cYzBjw Software development best practice http://groups.yahoo.com/gads?t=msk=Software+development+best+practice w1=Web+site+design+developmentw2=Computer+software+developmentw3=Softw are+design+and+developmentw4=Macromedia+flexw5=Software+development+be st+practicec=5s=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