Matt,
Unless I have a bug in my compiler(s), I believe I cannot place inline
events in a nested faceless component ( the stack trace is attached at
the end of the mail )
<Person name="A" id="personA" age="55">
<children>
<mx:Array>
<Person name="A1" age="20" talk="trace('THIS INLINE EVENT
WONT COMPILE')"/>
</mx:Array>
</children>
</Person>
and since I cannod declare an ID on it either, the only way to bind is
by referencing it the long way.
<mx:Label text="{ 'age=' + Person( personA.children[0] ).age}"/>
which is not necessarily bad in this simple case but makes you
hardcode the nesting...
See my point?
I was trying to use MXML to create the declaration for a finite state
machine implementation . If I had nesting, events and binding on all
levels then things like declaring transition and entry/exit events
would be very straightforward.
<State ... entry="trace('I am the entry action for state ' +
event.target.id )" final="true"/>
The same with references: instead of passing a string name ( or ID ) I
could just use binding to relate, say, states to transitions
<Transition target="{aState}" execute="Void('another event')"/>
So, I will have to go for the spaghetti in this implementation for flex15
Best,
Aldo
PS. Send my best to Ely, Todd, and Lucian ( if he's still there ) ;)
the stack trace for the nested faceless inline event exception:
28/12 14:57:36 ERROR flex.compiler.HtmlOutputHandler: Results of
compiling ...\fsm\nestedMXMLObjectsTest\main.mxml
1 Exception found.
Exception java.lang.NullPointerException
at flex.compiler.SwcBuilder.getEvents(SwcBuilder.java:1214)
at flex.compiler.SwcBuilder.generateDescriptorCode(SwcBuilder.java:1072)
at flex.compiler.SwcBuilder.generateClassText(SwcBuilder.java:329)
at flex.compiler.SwcBuilder.createClassStub(SwcBuilder.java:549)
at flex.compiler.MxmlLoader.parse(MxmlLoader.java:290)
at flex.compiler.MxmlLoader.loadComponentType(MxmlLoader.java:178)
at flex.compiler.MxmlLoader.loadComponent(MxmlLoader.java:204)
at
flex.compiler.CachedComponentLoader.getComponent(CachedComponentLoader.java:197)
at
flex.compiler.CachedComponentLoader.loadDefinition(CachedComponentLoader.java:101)
at
flex.compiler.CachedComponentLoader.getDefinition(CachedComponentLoader.java:263)
at flex.compiler.CompositeLoader.getDefinition(CompositeLoader.java:54)
at flex.compiler.linker.Loader.getType(Loader.java:266)
at flex.compiler.linker.Loader.findType(Loader.java:248)
at
flex.compiler.CompilerPackageManager.loadType(CompilerPackageManager.java:629)
at flex.compiler.MxmlCompiler.openDocument(MxmlCompiler.java:61)
at flex.compiler.MxmlServlet.sendHtmlShell(MxmlServlet.java:249)
at flex.compiler.MxmlServlet.doGet(MxmlServlet.java:193)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at flex.bootstrap.BootstrapServlet.service(BootstrapServlet.java:69)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
at flex.server.j2ee.cache.CacheFilter.doFilter(CacheFilter.java:262)
at flex.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:66)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at flex.server.j2ee.DetectionFilter.doFilter(DetectionFilter.java:95)
at flex.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:66)
at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
at jrun.servlet.FilterChain.service(FilterChain.java:101)
at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
at
jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:249)
at
jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527)
at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168)
at
jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:457)
at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
On 12/28/05, Matt Chotin <[EMAIL PROTECTED]> wrote:
> What part of inline events and databinding are missing? If your class
> extends EventDispatcher it has events. And binding is the same on a
> faceless object as a UIComponent.
>
> Matt
>
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of Aldo Bucchi
> Sent: Wednesday, December 28, 2005 1:37 AM
> To: [email protected]
> Subject: Re: [flexcoders] Nested faceless components. keeping IDs and
> DataBinding
>
> Hi Matt,
>
> Back posting huh!
>
> Thx for the answer.
>
> > 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
>
> Yes it is called. As with every faceless comp.
>
> Using the initalized() indeed allows me to set an id or registe the
> component somehow... but still, it is of little use with no binding
> and inline events.
>
> another point for flex2
>
> Best,
> Aldo
>
>
>
> On 12/27/05, Matt Chotin <[EMAIL PROTECTED]> wrote:
> > 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: [email protected] [mailto:[EMAIL PROTECTED]
> On
> > Behalf Of Aldo Bucchi
> > Sent: Monday, December 26, 2005 3:25 PM
> > To: [email protected]
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > 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
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> --
> ::::: 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
>
>
>
>
>
>
>
>
>
> --
> 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
>
>
>
>
>
>
>
--
::::: Aldo Bucchi :::::
mobile (56) 8 429 8300
------------------------ Yahoo! Groups Sponsor --------------------~-->
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/.QUssC/izNLAA/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/