royale-asjs
royale-asjs copied to clipboard
Runtime Error When Loading Module in Flex Emulation
Consider
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="library://ns.apache.org/royale/mx" xmlns:fx="http://ns.adobe.com/mxml/2009"
applicationComplete="init()" xmlns:js="library://ns.apache.org/royale/basic" >
<fx:Script>
<![CDATA[
private function init():void
{
ml.url = "Test1.swf";
}
]]>
</fx:Script>
<mx:VBox>
<mx:ModuleLoader id="ml"/>
</mx:VBox>
</mx:Application>
Where Test1.mxml is
<?xml version="1.0" encoding="utf-8"?>
<mx:Module xmlns:mx="library://ns.apache.org/royale/mx" xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:js="library://ns.apache.org/royale/basic" >
<mx:VBox width="100%" height="100%">
<mx:Label text="This Label is in the module" />
<mx:TextInput id="ti" text="This TextInput is also in the module" />
</mx:VBox>
</mx:Module>
The debug version loads the module successfully but the release version will fail in run-time with
TypeError: this.createElement is not a function
Please also provide the compiler options used for the app and the module.
build_example.compile-js-release: [echo] Doing release..................... [mxmlc] MXMLJSC [mxmlc] -remove-circulars [mxmlc] -js-output-optimization=skipAsCoercions [mxmlc] -js-compiler-option=--skip_type_inference [mxmlc] -targets=JSRoyale [mxmlc] -compiler.debug=false [mxmlc] +royalelib=C:\dev\flexjs\royale-asjs/frameworks/ [mxmlc] +configname=flex [mxmlc] -- [mxmlc] C:\dev\RoyaleComponentTest\NewComponentTest/src/Main.mxml
and
build_example.compile-js-release: [echo] Doing release..................... [mxmlc] MXMLJSC [mxmlc] -remove-circulars [mxmlc] -js-output-optimization=skipAsCoercions [mxmlc] -js-compiler-option=--skip_type_inference [mxmlc] -targets=JSRoyale [mxmlc] -compiler.debug=false [mxmlc] +royalelib=C:\dev\flexjs\royale-asjs/frameworks/ [mxmlc] +configname=flex [mxmlc] -- [mxmlc] C:\dev\RoyaleComponentTest\NewComponentTest/src/Test1.mxml
I have a hunch it's related to mx_internal renaming.
@alinakazi , is your app using mx modules in release mode? @aharui , will you have a chance to look at this?
Hi @yishayw, we just commented in a thread with Greg and Chris that modules has some issues. Don't think Alina used Modules or any other real app out there due to that issues. I think we need to work over that to make it work in basic, jewel and emulation.
Hi @yishayw DBIZ Solutions had deployed debug mode for the demo purpose to client. Release mode wasn't working properly.
On Mon, 28 Sep 2020, 1:27 am Carlos Rovira, [email protected] wrote:
Hi @yishayw https://github.com/yishayw, we just commented in a thread with Greg and Chris that modules has some issues. Don't think Alina used Modules or any other real app out there due to that issues. I think we need to work over that to make it work in basic, jewel and emulation.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apache/royale-asjs/issues/814#issuecomment-699684198, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIYHTSWMPNN32TZNAPEKOULSH6N2TANCNFSM4MR7ETTA .
Hello @carlosrovira, I can't make modules work on my app. Even this example given in the official documentation doesn't work for me. Do you have any news or alternative for this ? Because I have to migrate a whole app from flex to apache-royale and the main menu calls modules.
Hi @Paulitino, this was commented on the dev mailing list already. I recommend you to suscribe there and stay tunned since all happens there. In resume:
- To make the example you mention to work you need to build using Maven. I never coded the ANT script and left for other insterested. Maven has a special processing to copy module to the main app target folder, so the running app can find and load the module
2- Modules still doesn't work as expected in release mode. This is something that need to be addressed, but the guys that can make it happen (mostly Greg or Josh) are very busy. So, if someone of you need this functionality, I recommend you to put in contact with this guys and contract some paid hours as other in the community did to make them focus on special issues we need to have solved.
In Apache there's two ways to make things happen. One is make yourself, other pay others to make it happen.
HTH
Hi,
With Emulation, We have created a separate method that loads the royale module.
Sample is available here: https://paste.apache.org/esa6h
HTH, Alina Kazi
On Mon, 7 Dec 2020, 9:44 pm Paulitino, [email protected] wrote:
Hello @carlosrovira https://github.com/carlosrovira, I can't make modules work on my app. Even this https://royale.apache.org/dividing-an-apache-royale-application-with-modules/ example given in the official documentation doesn't work for me. Do you have any news or alternative for this ? Because I have to migrate a whole app from flex to apache-royale and the main menu calls modules.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apache/royale-asjs/issues/814#issuecomment-740037701, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIYHTSUUOO4FDE5JAPFI4SLSTUA75ANCNFSM4MR7ETTA .
Hello,
First I would like to say thank you to @carlosrovira and @alinakazi for your fast responses.
I still got problems even with the sample you gave me. I have two files, one index.mxml that should load the module in module.mxml.
index.mxml:
<ex:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:j="library://ns.apache.org/royale/jewel"
xmlns:js="library://ns.apache.org/royale/basic"
xmlns:html="library://ns.apache.org/royale/html"
xmlns:ex="library://ns.apache.org/royale/express"
xmlns:mx="library://ns.apache.org/royale/mx"
xmlns:views="modules.*"
xmlns:ns1="components.*">
<fx:Script>
<![CDATA[
import org.apache.royale.events.Event;
private function loadForm():void {
loadModule("modules/module",null);
}
public function loadModule(swfApp:String, link:String=""):void {
mMainLoader.url = swfApp;
mMainLoader.visible = true;
mMainLoader.includeInLayout = true;
}
]]>
</fx:Script>
<ex:beads>
<js:ApplicationDataBinding />
</ex:beads>
<ex:initialView>
<j:View>
<j:beads>
<j:VerticalCenteredLayout/>
</j:beads>
<mx:ModuleLoader id="mMainLoader" paddingTop="0"
width="100%" height="100%" y="0" x="0"/>
<mx:Button label="Change Icon" click="loadForm()"/>
</j:View>
</ex:initialView>
</ex:Application>
module.mxml:
<j:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:j="library://ns.apache.org/royale/jewel"
xmlns:js="library://ns.apache.org/royale/basic"
initComplete="initModule()">
<fx:Script>
<![CDATA[
private function initModule():void
{
trace("Initialize the module!");
}
]]>
</fx:Script>
<j:beads>
<js:ContainerDataBinding/>
<j:VerticalLayout/>
</j:beads>
<j:HGroup gap="3">
<j:IconTextInput>
<j:beads>
<j:TextPrompt prompt="Search..."/>
<j:SizeControl size="xlarge"/>
</j:beads>
<j:icon>
<js:MaterialIcon text="{MaterialIconType.SEARCH}"/>
</j:icon>
</j:IconTextInput>
<j:Button text="Search" emphasis="secondary">
<j:beads>
<j:SizeControl size="xlarge"/>
</j:beads>
</j:Button>
</j:HGroup>
</j:Module>
To build (not with Maven, I will try later on) I use the commands: mxmlc +configname=flex src/index.mxml mxmlc +configname=flex -module-output=modules src/modules/module.mxml
I have no error during the build.
The files organization is:
I have the error Uncaught TypeError: Cannot read property 'addElement' of undefined to the first click to the button and then Uncaught TypeError: c.za is not a function each time I click the button.
Do you have any idea or solution on these errors ?
Thank you,
Any update on this? This seems critical to getting to 1.0