ah yes - i couldn't get the mouseChildren to work before when i had
drawn in the movieclip but now i've separated the container movieclip
from the drawn-in shape, it' s working
thanks for your help guys
here's a copy of my code in case anyone else is interested:
CODE
// on xml load complete
private function periodCompleteListener(e:Event):void
{
periodXmlDoc = periodXmlLoader.doc;
trace (periodXmlDoc.toXMLString());
for each (var period:XML in periodXmlDoc.*)
{
createPeriodBar([EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]);
}
}
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; // start point for
all period bars
var pbY:int = pbYStart + pbGetY(dateStart, dateEnd) * (pbHeight
+pbSpace); // pbGetY(below) returns a level which is multiplied by
the hight and the spacing
var pbcontainer:MovieClip = new MovieClip(); // movieclip that
holds a variable (rolloverText), textfield and shape
var pb:Shape = new Shape();
if (uint(dateEnd-dateStart) > 1)
{
pb.graphics.beginFill(0xFFFFFF,.3);// white 50%
alpha
pb.graphics.drawRoundRect(0,0,pbWidth,pbHeight,pbHeight);
pb.graphics.endFill();
pbcontainer.x = pbX;
pbcontainer.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);
pbcontainer.addChild(pbText);
pbcontainer.addChild(pb);
pbcontainer.mouseChildren = false;
} else
{
pb.graphics.beginFill(0xFFFFFF,.5);// white 50%
alpha
pb.graphics.drawCircle(0,0,pbHeight/2);
pb.graphics.endFill();
pbcontainer.x = pbX;
pbcontainer.y = pbY+(pbHeight/2);
pbcontainer.addChild(pb);
}
pbcontainer.rolloverText = pbTitle + "\n" + pbDate;
pbcontainer.addEventListener(MouseEvent.MOUSE_OVER,
pbMouseOverListener);
scrollableBase.addChild(pbcontainer);
}
// replaces the mousefollower.text with what's in the rolloverText
variable
private function pbMouseOverListener(e:MouseEvent):void
{
mfTextField.text = e.target.rolloverText;
mouseFollower.visible = true;
}
// this stacks the period bars automatically based on if the dates
overlap
private function pbGetY(dateStart:int, dateEnd:int):int
{
var level:int = 0;
for (var i=0; i<previousDateEnd_ar.length; i++)
{
if (dateStart>previousDateEnd_ar[level])
{
previousDateEnd_ar[level] = dateEnd;
return level;
}
level++;
}
previousDateEnd_ar.push(dateEnd);
return level++;
}
On 1 Apr 2008, at 00:52, Steven Sacks wrote:
> Take off the true flag for bubbling and set mouseChildren =
true. This should solve your issue.
Er, I meant set mouseChildren = false.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders