Much appreciated it is too mate :)

On Mon, Jun 2, 2008 at 11:29 AM, Michael Labriola <[EMAIL PROTECTED]> wrote:

>
> Perhaps. I just wanted to clarify the why, not set any policies :)
>
>
> --- In [email protected] <flexcomponents%40yahoogroups.com>,
> "Josh McDonald" <[EMAIL PROTECTED]>
> wrote:
> >
> > I still think Container makes more sense in this instance though ;-
> )
> >
> > On Mon, Jun 2, 2008 at 11:21 AM, Josh McDonald <[EMAIL PROTECTED]> wrote:
> >
> > > Well if you guys are using it and it works, I suppose that
> question is
> > > answered :) I've never tried to build a container out of
> anything but
> > > Container (strangely enough), so I wasn't talking from
> experience.
> > >
> > > Now that I put more thought into it, it does make sense really,
> for when
> > > you want to build a component that's comprised of a bunch of
> other
> > > components, without needing to support arbitrary children added
> by client
> > > code at run time.
> > >
> > > -J
> > >
> > >
> > > On Mon, Jun 2, 2008 at 11:06 AM, Michael Labriola <[EMAIL PROTECTED]>
> > > wrote:
> > >
> > >>
> > >> Josh,
> > >>
> > >> Unfortunately, I also don't agree with the conclusion reached by
> > >> that post. Take a look at the code for UIComponent yourself. It
> > >> ships with Flex 2 or Flex 3. You can also search for addChild
> in the
> > >> various components that directly inherit from UIComponent in the
> > >> framework, you will see it used often.
> > >>
> > >> Finally, take a look at any of the custom component I, Doug
> McCune
> > >> of Eli Greenfield have published. You will notice that the
> majority
> > >> use UIComponent directly.
> > >>
> > >>
> > >> Labriola
> > >>
> > >> --- In 
> > >> [email protected]<flexcomponents%40yahoogroups.com><flexcomponents%
> 40yahoogroups.com>,
> > >> "Josh McDonald" <dznuts@>
> > >> wrote:
> > >> >
> > >> > Not according to this post a day or so ago:
> > >> >
> > >> > http://www.mail-
> > >> archive.com/[EMAIL PROTECTED]<archive.com%2Fflexcoders%40yahoogroups.com>
> <archive.com%2Fflexcoders%
> 40yahoogroups.com>
>
> > >> /msg93835.html
> > >> >
> > >> > Can anybody from Adobe clear this up?
> > >> >
> > >> > -J
> > >> >
> > >> > On Mon, Jun 2, 2008 at 10:50 AM, Michael Labriola <labriola@>
> > >> wrote:
> > >> >
> > >> > >
> > >> > > I see a few problems with the code. UIComponent does not
> have any
> > >> > > default implementations for sizing, display, etc. As Josh
> > >> mentions,
> > >> > > Container does have these implementations, however, this is
> > >> likely
> > >> > > overkill for what you need. However, UIComponent.addChild
> does
> > >> add
> > >> > > things to the display list just fine....
> > >> > >
> > >> > > That said, your ScaleToFitContentHolder class extends
> > >> UIComponent.
> > >> > > UIComponent does not have an implementation of
> updateDisplayList.
> > >> > > updateDisplayList is where a component sizes it's children.
> > >> > > Therefore anything you add to that content holder is not
> going
> > >> to go
> > >> > > through the normal flex measurement and sizing process.
> > >> > >
> > >> > > You also call invalidateSize in your code quite a few times,
> > >> which
> > >> > > would make sense, but your measure methods just call the
> super
> > >> > > class.... which sets it to 0 width and height unless you set
> > >> > > explicit values in the UIComponent default implementation.
> > >> > >
> > >> > > So, basically, UIComponent is fine, it will work well if you
> > >> handle
> > >> > > these issues. If you want an implementation that handles
> these
> > >> > > things (and potentially does a lot of other stuff you don't
> need
> > >> or
> > >> > > want) you could extend Container or one of its descendants.
> > >> > >
> > >> > > HTH,
> > >> > > Labriola
> > >> > >
> > >> > > --- In 
> > >> > > [email protected]<flexcomponents%40yahoogroups.com>
> <flexcomponents%
> 40yahoogroups.com><flexcomponents%
>
> > >> 40yahoogroups.com>,
> > >>
> > >> > > "Josh McDonald" <dznuts@>
> > >> > > wrote:
> > >> > >
> > >> > > >
> > >> > > > My Bad buddy, sorry!
> > >> > > >
> > >> > > > UIComponent.addChild is an inherited Flash thing, not
> part of
> > >> > > Flex, and when
> > >> > > > you use it if it works at all, things don't go into Flex's
> > >> display
> > >> > > tree
> > >> > > > properly, and all sorts of pain ensues. Try extending
> Canvas
> > >> > > instead of
> > >> > > > UIComponent. The magic you need lives in Container.
> > >> > > >
> > >> > > > -J
> > >> > > >
> > >> > > >
> > >> > > > On Sun, Jun 1, 2008 at 7:31 AM, Richard Rodseth
> <rrodseth@>
> > >> > > wrote:
> > >> > > >
> > >> > > > > I'd love to wrap up this task. Does anyone have any
> other
> > >> > > suggestions?
> > >> > > > >
> > >> > > > >
> > >> > > > > On Tue, May 27, 2008 at 8:24 PM, Richard Rodseth
> > >> > > <rrodseth@<rrodseth%40gmail.com>>
> > >> > >
> > >> > > > > wrote:
> > >> > > > > > I'm afraid I'm still struggling with this. The classes
> > >> below
> > >> > > work
> > >> > > > > > (more or less) if I supply a large button
> as "content",
> > >> but if
> > >> > > I try a
> > >> > > > > > VBox it appears to shrink to nothing. Any ideas?
> Hopefully
> > >> the
> > >> > > > > > formatting survived.
> > >> > > > > >
> > >> > > > > > <view:ScaleOrCenterView width="100%" height="100%" >
> > >> > > > > > <mx:VBox borderStyle="solid" borderColor="red"
> > >> > > > > > horizontalScrollPolicy="off"
> verticalScrollPolicy="off">
> > >> > > > > > <mx:Button label="Test" width="400" height="400"/>
> > >> > > > > > </mx:VBox>
> > >> > > > > > </view:ScaleOrCenterView>
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > [DefaultProperty("content")]
> > >> > > > > > public class ScaleOrCenterView extends UIComponent
> > >> > > > > > {
> > >> > > > > > private var _contentHolder:ScaleToFitContentHolder =
> new
> > >> > > > > > ScaleToFitContentHolder();;
> > >> > > > > > private var _content:UIComponent;
> > >> > > > > >
> > >> > > > > > public function ScaleOrCenterView()
> > >> > > > > > {
> > >> > > > > > super();
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > override protected function createChildren():void {
> > >> > > > > > super.createChildren();
> > >> > > > > > this.addChild(_contentHolder);
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > [Inspectable]
> > >> > > > > > public function set content(value:UIComponent):void {
> > >> > > > > > if (_content != null) {
> > >> > > > > > _contentHolder.removeChild(_content);
> > >> > > > > > }
> > >> > > > > > _content = value;
> > >> > > > > > if (_content != null) {
> > >> > > > > > _contentHolder.addChild(_content);
> > >> > > > > > }
> > >> > > > > > this.invalidateSize();
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > override protected function updateDisplayList
> > >> > > (unscaledWidth:Number,
> > >> > > > > > unscaledHeight:Number):void
> > >> > > > > > {
> > >> > > > > > super.updateDisplayList(unscaledWidth,
> unscaledHeight);
> > >> > > > > >
> > >> > > > > > var contentWidth:Number =
> > >> _content.getExplicitOrMeasuredWidth
> > >> > > ();
> > >> > > > > > var contentHeight:Number =
> > >> _content.getExplicitOrMeasuredHeight
> > >> > > ();
> > >> > > > > >
> > >> > > > > > var xScale:Number = (unscaledWidth / contentWidth);
> > >> > > > > > var yScale:Number = (unscaledHeight / contentHeight);
> > >> > > > > >
> > >> > > > > > _contentHolder.setActualSize(unscaledWidth,
> > >> unscaledHeight);
> > >> > > > > >
> > >> > > > > > _contentHolder.allowInvalidateSize = false;
> > >> > > > > > if (xScale < 1 || yScale < 1) {
> > >> > > > > > _contentHolder.scaleX = xScale
> > >> > > > > > _contentHolder.scaleY = yScale
> > >> > > > > > } else {
> > >> > > > > > _contentHolder.scaleX = 1.0;
> > >> > > > > > _contentHolder.scaleY = 1.0;
> > >> > > > > > }
> > >> > > > > > _contentHolder.allowInvalidateSize = true;
> > >> > > > > >
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > public class ScaleToFitContentHolder extends
> UIComponent
> > >> > > > > > {
> > >> > > > > > public var allowInvalidateSize:Boolean = true;
> > >> > > > > >
> > >> > > > > > public function ScaleToFitContentHolder()
> > >> > > > > > {
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > override protected function measure():void
> > >> > > > > > {
> > >> > > > > > super.measure();
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > override public function invalidateSize():void
> > >> > > > > > {
> > >> > > > > > if (allowInvalidateSize)
> > >> > > > > > super.invalidateSize();
> > >> > > > > > }
> > >> > > > > >
> > >> > > > > > }
> > >> > > > > > On Mon, May 26, 2008 at 9:02 PM, Alex Harui
> > >> <aharui@<aharui%
> > >> > > 40adobe.com>>
> > >> > > > > wrote:
> > >> > > > > >> One way is to block invalidateSize when scaling the
> > >> child. See
> > >> > > > > >> ListBaseContentHolder
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >>
> > >> > > > > >> ________________________________
> > >> > > > > >>
> > >> > > > > >
> > >> > > > >
> > >> > > > >
> > >> > > >
> > >> > > >
> > >> > > >
> > >> > > > --
> > >> > > > "Therefore, send not to know For whom the bell tolls. It
> tolls
> > >> for
> > >> > > thee."
> > >> > > >
> > >> > > > :: Josh 'G-Funk' McDonald
> > >> > > > :: 0437 221 380 :: josh@
> > >> > > >
> > >> > >
> > >> > >
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > "Therefore, send not to know For whom the bell tolls. It
> tolls for
> > >> thee."
> > >> >
> > >> > :: Josh 'G-Funk' McDonald
> > >> > :: 0437 221 380 :: josh@
> > >> >
> > >>
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > > "Therefore, send not to know For whom the bell tolls. It tolls
> for thee."
> > >
> > > :: Josh 'G-Funk' McDonald
> > > :: 0437 221 380 :: [EMAIL PROTECTED]
> >
> >
> >
> >
> > --
> > "Therefore, send not to know For whom the bell tolls. It tolls for
> thee."
> >
> > :: Josh 'G-Funk' McDonald
> > :: 0437 221 380 :: [EMAIL PROTECTED]
> >
>
>  
>



-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to