royale-compiler
royale-compiler copied to clipboard
itemRenderer can't be specified mxml class definition
This works:
<local:RequestList id="requestList" itemRenderer="dashboard.view.royale.UserItemRenderer" height="100%"/>
But this doen't (in RequestList.mxml)
<j:List xmlns:fx="http://ns.adobe.com/mxml/2009"
itemRenderer="dashboard.view.royale.UserItemRenderer"
implements="dashboard.core.as3.interfaces.IRequestList"
xmlns:j="library://ns.apache.org/royale/jewel"
xmlns:form="forms.view.royale.*"
xmlns:local="dashboard.view.royale.*"
>
I get a run-time error:
RequestList.js:38 Uncaught TypeError: this.generateMXMLAttributes is not a function at new dashboard.view.royale.RequestList (RequestList.js:38) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLArray (MXMLDataInterpreter.js:124) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLInstances (MXMLDataInterpreter.js:266) at org.apache.royale.jewel.supportClasses.drawer.DrawerContent.org.apache.royale.html.Group.addedToParent (Group.js:76) at org.apache.royale.jewel.Drawer.org.apache.royale.jewel.supportClasses.drawer.DrawerBase.addElement (DrawerBase.js:78) at Function.org.apache.royale.utils.MXMLDataInterpreter.initializeStrandBasedObject (MXMLDataInterpreter.js:236) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLArray (MXMLDataInterpreter.js:125) at Function.org.apache.royale.utils.MXMLDataInterpreter.generateMXMLInstances (MXMLDataInterpreter.js:266) at org.apache.royale.jewel.Drawer.org.apache.royale.html.Group.addedToParent (Group.js:76) at dashboard.view.royale.Dashboard.org.apache.royale.core.UIBase.addElement (UIBase.js:414)
Wow! How are you recognize that is compiler issue?
I don't think List can be used as a base class for an MXML file. (Whether it should or not is another question...)
Is it working in Flex?
Yes, but in Flex pretty much anything could be used as a base for an MXML file. In Royale, it's only classes which implement IMXMLDocument
.
Probably the compiler should give an error when a class which is not an IMXMLDocument
is used as a base for an MXML file.
As Harbs says in Flex you can use almost any class as root of an MXML doc. Seems, this is a limitation in Royale over what we had in Flex.
It’s working as long as you don’t specify the item renderer there, so I’m not sure using List as a base class is the issue. But I may be wrong about it being a compiler issue. The comments here have prompted me to debug
org.apache.royale.utils. MXMLDataInterpreter.generateMXMLProperties()
I’ll look into it and report…
From: Harbs [email protected] Sent: Thursday, February 7, 2019 3:45:33 PM To: apache/royale-compiler Cc: yishayw; Author Subject: Re: [apache/royale-compiler] itemRenderer can't be specified mxml class definition (#79)
I don't think List can be used as a base class for an MXML file. (Whether it should or not is another question...)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/apache/royale-compiler/issues/79#issuecomment-461424402, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ACASfR_W4lGOxu-LOLiHDdGHLdaX1ZH_ks5vLC39gaJpZM4anTD_.
As Harbs says the problem is that List does not implement IMXMLDocument. I agree the compiler should throw and error when a non-implementer is used as a base class in an mxml document.
So Royale always need to use something like Group, VGroup and so on as base tag. This means an extra nesting level in both SWF and JS right? We all agree that is right scenario?
@carlosrovira not necessary we are using List as root tag and everything is working fine - yeah that's issue, but apart of that we are good.
You can subclass any component and make it implement IMXMLDocument.
I think it's reasonable to do that in the Express and Jewel List components.
ok, we could consider that in Jewel... thanks