class com.domain.RollWhileWithin extends MovieClip
{
public var rolled:Boolean;
function RollWhileWithin ()
{
rolled = false;
}
public function doRollOver():Void
{
if (!rolled) {
Hi
I need to detect mouse events on a movieclip's non-white content
rather than it's bounding rectangle even where the contents are
bitmap based.
I'm putting together an activity for kids where they create a piece
of art by dragging and dropping visual elements onto their canvas,
then
Check out the BitmapData class, specifically the static loadBitmap(id)
method for creating an instance from a library symbol, and getPixel() which
allows checking individual pixel values.
I would think an algorithm that would work would be to iterate through the
display list, do hitTest() on
Also, just looking this up made me notice that as of Flash 8, you can do
pixel-level hit detection between not only a bitmap and a point, but 2
bitmaps, with alpha threshold support!
BitmapData.hitTest()
On 2/7/07, Jason Boyd [EMAIL PROTECTED] wrote:
Check out the BitmapData class,
Thanks for those suggestions.
I didn't think about Birmapdata.hitTest(), but I had thought about
using getPixel()
Sure, I can use that to decide whether or not the user has clicked on
a non-white area, but that doesn't resolve user confusion. It doesn't
help the user to know which item
Can't you override the onMouseOver of the clips to prevent the cursor
change?
Or wait, why would the cursor be changing?
There's no onRollover event being specifically handled, but each of
the clips has onPress, onRelease and onReleaseOutside events handled.
My understanding is that it's
cant you just use hitArea and make a transparent vector shape hit state
for each visual element?
On 2/7/07, Dave Wood [EMAIL PROTECTED] wrote:
Hi
I need to detect mouse events on a movieclip's non-white content
rather than it's bounding rectangle even where the contents are
bitmap based.
I'm
My understanding is that it's the default behaviour of a clip with
any mouse events handled at all, that the cursor changes when it
enters the clip.
Oh right, sorry. So I wonder if it is possible to override this by
definining an onMouseOver and changing the cursor to the default one?
oki just realized you said that would be a pain in your original
message. sorry...i am tired.
how many elements do you have? a hitArea for each one does seem like a
simpler way to goor maybe i'm just tired.
On 2/7/07, John VanHorn [EMAIL PROTECTED] wrote:
cant you just use hitArea and
cant you just use hitArea and make a transparent vector shape hit
state
for each visual element?
As I think I indicated, that is indeed an option, but one we're
looking for a way to avoid.
Cheers
David
___
Flashcoders@chattyfig.figleaf.com
To
: Wednesday, February 07, 2007 10:29 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Detecting mouse events over non-white parts of
amovieClip
My understanding is that it's the default behaviour of a clip with
any mouse events handled at all, that the cursor changes when it
enters the clip
If I were looking for the super-ideal correct algorithm and hade infinite
coding monkeys, I would at init time create bitmaps of every library item,
and use flood-fill combined with trig math to generate vector trace shapes
of the non-white areas, which I would draw as zero alpha shapes into a
The code to
convert a bitmap into vectors would be the tricky part, but is technically
doable.
ModifyBitmapTrace Bitmap...
-Keith
http://keithreinfeld.home.comcast.net
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or
Good point. Yeah I'm tired.
On 2/8/07, Keith Reinfeld [EMAIL PROTECTED] wrote:
The code to
convert a bitmap into vectors would be the tricky part, but is
technically
doable.
ModifyBitmapTrace Bitmap...
-Keith
http://keithreinfeld.home.comcast.net
My understanding is that it's the default behaviour of a clip with
any mouse events handled at all, that the cursor changes when it
enters the clip.
Using useHandCursor, you could turn that feature off as the default, and then
back on when you test positive for your viewable clip area.
Thanks John, Bob, Jason and Keith for your thoughts and advice.
I think we'll be making vector graphics to match all the bitmaps .
For now, sleep beckons...
Cheers
David
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or
16 matches
Mail list logo