My experience has been with creating containers from DisplayObjects

Ok, how do you use your DisplayObjects in mxml containers (IE mxml)? You
haven't implemented IFlexDisplayObject.

I'm completely lost on your second paragraph.

It doesn't make sense why you wouldn't just add the container to the Panel
and then after that
point add items to the container.

I suggested this in my first response to this question.

My sugesstion was, create the composite container BEFORE
super.createChildren(), override createComponentsFromDescriptors(), remove
the children that get created with createChild(). Then create public methods
like addCompositeChild() removeCompositeChild() for adding and removing
children from the composite container.

If you try and override addChild(), you mess up overalys, measuring etc.

PS An example would be making a TilePanel. If you are truly going after
abstractness, you want the Panel to do what is meant to do without having a
user add a Tile to the Panel in mxml. With the process above, you have
successfully created a tile panel with the ability to add and remove tiles.

Peace, Mike


On 4/27/07, Paul J DeCoursey <[EMAIL PROTECTED]> wrote:

  Michael Schmalle wrote:
>> Add things to rawChildren and setStyles on contentPane.
>
> What do you mean by this?
Alright I concede now that after reading what she is trying to do it
will not be as simple as I described. My experience has been with
creating containers from DisplayObjects of extending and hacking the
Container itself. I have not done what she is trying to do, I have not
tried to hack a Panel in this way. And to be frank I don't understand
why. But here is my revised suggestion.

Create a component that extends Display Object, add the Panel to it and
the container that you want to have the children. You'll have to use the
top, left, bottom and right properties on each of them to control the
sizing and whatnot. Then override addChild and addChildAt to add any
future components to the "contentPane" you created. This should work
and will simulate what Containers already do and you don't have to worry
about all the numChildren and other "tricky" stuff related to containers.

Claudia, What is the purpose/goal of this? It doesn't make sense why
you wouldn't just add the container to the Panel and then after that
point add items to the container.

Paul

>
> If you are creating a composite child, there will be no contentPane
> created
> if you resize it in the raw children's list.
>
> I would love to see your implementation of 2 or 3 methods, do you
> override
> numChildren also?
No... because I extend DisplayObject.
>
> Peace, Mike
>
>
> On 4/27/07, Paul J DeCoursey <[EMAIL PROTECTED] <paul%40decoursey.net>>
wrote:
>>
>> I'm sorry, but it's not tricky or cumbersome... there are like 2
>> maybe 3
>>
>> functions to override. It's very easy to do. Really what Claudia will
>> want to do is use the built in code in Container. Add things to
>> rawChildren and setStyles on contentPane.
>>
>> Paul
>>
>>
>> Manish Jethani wrote:
>> > You'll have to override the whole child management API.
>> > mx.core.Container already does this for the case where it has
>> > scrollbars. See the internal contentPane property and how it's
>> > implemented. It's tricky and cumbersome.
>> >
>> > On 4/27/07, Claudia Barnal <[EMAIL PROTECTED]<barnaclau%40gmail.com>
>> <barnaclau%40gmail.com>>

>> wrote:
>> >
>> >> Hi,
>> >>
>> >> What would I have to do to make the child of a Panel be the
recipient
>> >> of any children added to that Panel, like below?
>> >>
>> >> For example, below if my custom container creates another container
>> >> (let's call it the xxx container) in the createChildren() method,
how
>> >> can I make sure any children added to the parent container are added
>> >> to the xxx container?
>> >>
>> >> I guess I have to override the actual addChild() method, to bypass
>> the
>> >> normal flow and adding the newly added children to the xxx
container,
>> >> but how would that work out?
>> >>
>> >> <blah:CustomContainer>
>> >> <mx:HBox>
>> >> </mx:HBox>
>> >> <blah:CustomContainer>
>> >>
>> >> Any comments or ideas?
>> >>
>> >> Thanks,
>> >> Claudia
>> >>
>> >>
>> >>
>> >> Yahoo! Groups Links
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>
>>
>>
>
>
>




--
Teoti Graphix
http://www.teotigraphix.com

Blog - Flex2Components
http://www.flex2components.com

You can find more by solving the problem then by 'asking the question'.

Reply via email to