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.
--
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
YAHOO! GROUPS LINKS
|
- RE: [flexcoders] Flex2 :: Subclassing Button :: How to ch... Gordon Smith
-