i have the moock book but i couldn't get my head round the bubbling
phase and how it affected me - i need to look into it a bit more
i added mouseChildren=false but it made the entire event stop - even
on the objects that were working before, and i didn't even get the error
is this because i've drawn directly in the sprite?
here's what i did:
private function createPeriodBar(dateStart:int, dateEnd:int,
pbTitle:String, pbDate:String, pbList:Array = null):void
{
var pixelStart:int = yearsToPixels(dateStart);
var pixelEnd:int = yearsToPixels(dateEnd);
var pbX:int = pixelStart;
var pbWidth:int = pixelEnd - pixelStart;
var pbYStart:int = taTitleBarHeight + pbSpace;
var pbY:int = pbYStart + pbGetY(dateStart, dateEnd) * (pbHeight
+pbSpace);
var pb:MovieClip = new MovieClip();
if (uint(dateEnd-dateStart) > 1)
{
pb.graphics.beginFill(0xFFFFFF,.3);// white 50%
alpha
pb.graphics.drawRoundRect(0,0,pbWidth,pbHeight,pbHeight);
pb.graphics.endFill();
pb.x = pbX;
pb.y = pbY;
var pbText:SimpleTextField = new SimpleTextField(0xFFFFFF, 14,
headingFont, 4, -2, pbWidth-4, 25, pbTitle, false);
pbText.selectable = false;
pbText.text += " ";
pbText.text += pbDate;
var pbf:TextFormat = new TextFormat();
pbf.font =
subheadingFont;
pbf.size = 10;
var pbCurrentLength =
pbTitle.length+1;
var pbDateLength = pbText.length;
pbText.setTextFormat(pbf, pbCurrentLength,
pbDateLength);
pb.addChild(pbText);
pb.mouseChildren =
false; /////////////////////////////////////////////////////////////
<<<<<<<<<<<<<<<<<<<<<<--------------------------------- HERE
} else
{
pb.graphics.beginFill(0xFFFFFF,.5);// white 50%
alpha
pb.graphics.drawCircle(0,0,pbHeight/2);
pb.graphics.endFill();
pb.x = pbX;
pb.y = pbY+(pbHeight/2);
}
pb.rolloverText = pbTitle + "\n" + pbDate;
pb.addEventListener(MouseEvent.MOUSE_OVER, pbMouseOverListener,
true);
scrollableBase.addChild(pb);
}
thanks for your input so far
a
On 31 Mar 2008, at 22:30, Steven Sacks wrote:
IMO, explaining Event Bubbling as the reason the TextField is the
target is complicating the immediate solution he needs, which is
mouseChildren = false.
Yes, it's Event Bubbling that's causing the target to be the
TextField. To understand Event Bubbling, read about it in the
docs, or better yet, in a book (like Moock's). But, then you MUST
do it yourself to learn how it works. If you don't play with it
yourself, you will never "get it" no matter how much somebody
explains it to you. I'm fully convinced of that. You gotta mess
around with it to fully understand why it's so amazingly awesome.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders