Given Alex's point, that SWF size can change dynamically, getting your measure/updateDisplayList functionality right might be difficult.
An easy solution, in my mind, would be:
1) Set the width/height of your custom class to 100%, so it fills
your title window (or do whatever you want to give it a size...but if
you don't give it a size, and don't implement measure(), it will default
to 0x0).
2) In your createChildren() function of your custom component,
create a shape, addChild it, draw a rectangle into it, and add it as a
mask:
override protected function createChildren():void
{
var tmp:Shape = new Shape();
tmp.beginFill(0);
tmp.drawRect(0,0,10,10);
tmp.endFill();
addChild(tmp);
mask = tmp;
}
3) In your updateDisplayList(), set the width/height of your mask
to match your unscaled width/height:
override protected function updateDisplayList(...):void
{
mask.width = unscaledWidth;
mask.height = unscaledHeight;
}
Now you don't need to rely on the masking capabilities of
TitleWindow...your custom component self-masks.
Ely.
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Alex Harui
Sent: Thursday, September 06, 2007 9:41 AM
To: [email protected]
Subject: RE: [flexcoders] Re: Problem with Content spilling over beyond
it's container's bounds
Are you reporting a measured or explicit widht/height in measure() and
matching that in updateDisplayList()?
If you base it on the SWF size, keep in mind that the SWF's size may
change and measure incorrectly.
________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Ryan Stawarz
Sent: Thursday, September 06, 2007 9:00 AM
To: [email protected]
Subject: [flexcoders] Re: Problem with Content spilling over beyond it's
container's bounds
I'm having a very similar issue. Did you ever come up with a good
resolution or at least an understanding as to what was going on?
--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Mike Anderson" <[EMAIL PROTECTED]> wrote:
>
> Hello All,
>
> I have an irritating problem with a draggable TitleWindow, that houses
a
> UIComponent w/embedded SWF.
>
> My Custom Class extending a UIComponent embeds an external SWF File,
> which gives me the ability to wrap it with code. This way I can
control
> the SWF and all the MovieClips it contains, programmatically.
>
> Basically, upon the initial Load of the UIComponent, it exceeds the
size
> of the TitleWindow - and instead of the TitleWindow Container masking
> off the extents of the UIComponent, it literally lets the entire SWF
> File show through.
>
> Now if I trigger a Resize Event by actually sizing the TitleWindow (I
> have code in place, that allows the user to resize the window), THEN
the
> TitleWindow immediately clips the Content properly.
>
> The UIComponent can be controlled by the User, via a Slider Control
> (which controls the Zoom Level), and the user can also pan the
Component
> around via startDrag() and stopDrag(). Because of all this potential
> interaction, it's imperative that the Content's Parent Container,
> properly clips the parts that should not be showing.
>
> So with all that said, is there anything I can do differently, to
ensure
> that the TitleWindow always clips the Children that it houses?
>
> Thanks in advance for your help,
>
> Mike
>
<<image001.jpg>>
<<image002.jpg>>

