I think we're going to allow nested ids in Flex 2.  

For Flex 1.5 though you might be able to make Person an MXMLObject which
would then have its initialized() method called as it gets created.
That call would pass the MXML document which created the object and you
could then attach the person using an id.  We have hard-coded "id" to
not be allowed on deeper faceless objects, but you could use another
name and then just assign that as the variable name for the document.
Something like this:

function initialized(document, id):Void
{
  Var myId:String = this['valueYouPicked'];
  Document[myId] = this;
}

Now what I don't remember is if when we instantiate via the Array if the
MXMLObject initialized will be called.  You'd need to look at the
generated actionscript (turn keep-generated-actionscript on in
flex-config) to be sure.

Matt

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Aldo Bucchi
Sent: Monday, December 26, 2005 3:25 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Nested faceless components. keeping IDs and
DataBinding

Hi all,

It would be great to have IDs and databinding available to faceless
data structures.
Unfortunately, there are some restrictions that apply to faceless
components.

Is there any (hacky) way to declare a nested faceless component in an
MXML document and assign a document scoped ID to it ??

This is not legal as there are IDs in the nested components.

        <c:Person id="foo">
                <c:children>
                        <mx:Array>
                                <c:Person id="barbie"/>
                                <c:Person id="birbie"/>
                        </mx:Array>
                </c:children>
        </c:Person>


One ugly way would be to extend a container and do something like the
following

        <c:Person id="foo">
            <c:Person id="barbie"/>
            <c:Person id="birbie"/>
        </c:Person>

Now, this limits me to assigning all children to one array... not to
mention the overhead and component-lifecycle-related trouble.


For now the only legal solution is the following I guess...

<c:Person id="foo"/>
<c:Person id="barbie" parent="{foo}"/>
<c:Person id="birbie" parent="{foo}"/>


Evidently the benefit of using XML is lost.


Any ideas?



--
::::: Aldo Bucchi :::::
mobile (56) 8 429 8300



--
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



 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
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/
 



Reply via email to