Of course you can pass a runtime-created component to another component as a 
parameter. However, the instance will be passed by reference and will still be 
bound to the component it was created on. Perhaps you can give some more info 
on the requirements you have?
 
Passing a component as a reference is useful to delegate some work to other 
classes. For example, in your case you could use the meta-information inside a 
generic "Builder" class that works on a passed in component reference - this 
way the Builder could create sub-components on basically any component, i.e.
 
class Builder {
  // ...
  static function createComponents(target:UIObject, metaInfo:Object):Void {
    // target is the component you want to create your components in
    // metaInfo is the meta-information
    target.createChild(...);
  }
 
}
 
This way you can dynamically create sub-components on any given component:
 
// myCanvas is a Canvas container
var Builder.createComponents(myCanvas);
 
Just an idea.
 
Cheers,
Dirk.

 
________________________________

Von: [email protected] im Auftrag von Lothar Krenzien
Gesendet: Do 23.06.2005 14:00
An: [email protected]
Betreff: Re: [flexcoders] ViewStack as a parameter for other components



Thanks for your answer Dirk. That make somethink clear now.

I have tried the TabNavigator component and know the createTab() method.
That works ok,
<http://dict.leo.org/se?lp=ende&p=/Mn4k.&search=excepting>except that
the tabs are very small and there's only a very small area where I can
place the elements. Even when I try to set the width of the tabs to a
predefined pixel size.

Is it generally possible to create a component (image, video...) during
runtime and pass it as parameter to another component ? As I understand
the parent of a component is assigned automatically when the component
is created. And the property "parent" is just read-only.

Sorry for so many questions ;) .But the most important of our project is
to create the UI during runtime based on some 'meta-informations'.

Thanks for your patience.

Lothar

Dirk Eismann wrote:

> Hi Lothar,
>
> you cannot pass over an instance of a container (in your case a
> ViewStack) to another container and have it act like a child of the
> container you passed it to. Inside your createContent() method the
> ViewStack gets created on 'this' - it's not clear from your code
> snippet to what 'this' refers to in this special moment but obviously
> the ViewStack gets created on the wrong component (possibly the
> Application?)
>
> Instead of using a TabBar have you tried using the
> mx.containes.TabNavigator class directly? It offers a quite
> straightforward way to add childs during runtime by using the
> createTab() method. This should suit your needs.
>
> BTW: welcome to Flex :)
>
> Cheers,
> Dirk.
>



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links










--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<<winmail.dat>>

Reply via email to