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, Mike
On 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=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
- 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.
--
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
- 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.