Hi Alex,

Thanks for your careful and complete answers, much appreciated!
Your reply makes it 100% clear for me that I can not use the existing
libraries and need to rewrite most code. So I will create duplicates from
scratch meaning I will keep same structure of classes like before but I
will create the SWC using a library project in Royale. Then I will copy the
code that is not Flash or AIR dependant.

For example I have a ServerUtil class which I can re-use, except for
storing the value of the server location which is dependant on the File
class. So my question here is, can I use the WebStorage API for that? Can I
write that in JS or do I need to create a AS3 equivalent that is transpiled
to JS?

On Wed, Sep 26, 2018 at 5:43 PM Alex Harui <[email protected]> wrote:

> Hi Fréderic,
>
>
>
> Just to be clear, the main goal of Royale is to provide a Flex-like
> application development workflow, but not to be 100% backward compatible
> with Flex.  Flex itself was an attempt to abstract away the intricacies of
> Flash and similarly, Royale is not focused at all on providing Flash APIs.
>
>
>
> So, the migration of a Flex app to Royale involves either using the
> Emulation components as much as possible (still a work in progress) or
> rewriting the UI to use Royale component sets like Jewel.  Where your
> application has a direct dependency on Flash, that code will definitely
> need to be changed.  But if you have good separation of concerns between
> your UI and your business logic, you should find that your business logic
> should be almost 100% re-usable.  And that last sentence is why Royale
> should be a lower-effort way to get off of Flash/AIR than rewriting and
> debugging your business logic.
>
>
>
> So, if your app has custom SWCs containing source code written by you, the
> SWC should be re-usable in Royale if it isn’t dependent on Flash.  If there
> are Flash dependencies, you will need to tweak the code to remove the Flash
> dependency.  The error about BitmapAsset is probably because there are
> embedded assets.  Royale does not support embedding of graphical assets at
> this time.  Not sure if we will in the short term as it isn’t clear there
> is a significant technical advantage to embedding like there was in Flash.
>
>
>
> A Flex SWC cannot be used “as-is” since all Royale SWCs must contains
> transpiled JS files from the source AS files.  So you must re-compile all
> of your SWCs with the Royale Compiler.  And fix any issues around Flash
> dependencies and workaround any Flex dependencies we haven’t supported yet
> in Royale.
>
>
>
> I have not used VSCode myself, but you’ll have to set up library projects
> for each of your SWCs, get them to compile cleanly, and then try compiling
> the main app.
>
>
>
> I’ve been migrating TourDeFlex to Royale.   I found that there were a
> couple of common embedding patterns.  One was “inline-MXML” as in:
>
>
>
>   <mx:Image source=”@Embed(‘assets/foo.png’)” />
>
>
>
> I just removed the embedding for now:
>
>
>
>   <mx:Image source=”assets/foo.png” />
>
>
>
> The other common pattern was in AS such as:
>
>
>
>   [Embed(“assets/foo.png”)]
>
>   var fooPNG:Class;
>
>
>
> I think all instances I found were being assigned as the source for an
> Image component, so it was simple enough to transform that to:
>
>
>
>    var fooPNG:String = “assets/foo.png”;
>
>
>
> I thought about trying to get the compiler to auto-convert these patterns,
> but I’m not sure it would be worth the effort.
>
>
>
> Anyway, try to set up your library projects and remove Flash dependencies
> and eventually it should all compile and start to run without Flash.  I’m
> sure you’ll have lots more questions.  Don’t be afraid to ask.
>
>
>
> HTH,
>
> -Alex
>
>
>
> *From: *Piotr Zarzycki <[email protected]>
> *Reply-To: *"[email protected]" <[email protected]>
> *Date: *Wednesday, September 26, 2018 at 6:48 AM
> *To: *"[email protected]" <[email protected]>
> *Subject: *Re: Library SWC (library path)
>
>
>
> I don't think so - at least if you would like to transpile your code to
> JS. That's good that you are getting this kind of errors. It means that
> probably compiler is trying to transpile and cannot pass some code. I
> believe you have two paths:
>
>
>
> 1) Rewrite your UI part of app to Royale and transpile AS3 code
>
> 2) You can use Emulation components [1] to make proper build of your app
> with transpilation to JS. - From that point you could slowly make UI looks
> better.
>
>
>
> I bet that no one tried to Emulate FileStream yet! :) If something doesn't
> exists here [2][3] you probably can add it to make your app satisfied.
>
>
>
> You can generate API report (here instruction [1]) to see what actually
> you are using in your app, look on the list in [2][3] and fill gaps by
> making pull requests.
>
>
>
> [1] https://github.com/apache/royale-asjs/wiki/emulation-components
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fwiki%2Femulation-components&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=0UYx%2Fq%2BZ1iP1XDQ%2Bf7r7AnLmn7%2BAx%2BeF7eT6J3uY6bk%3D&reserved=0>
>
> [2]
> https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fblob%2Fdevelop%2Fframeworks%2Fprojects%2FMXRoyale%2Fsrc%2Fmain%2Froyale%2FMXRoyaleClasses.as&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=FPLsJmxbH%2FyIurZa0rhfECNo8oN%2FOC%2BgHNrU98bQVyc%3D&reserved=0>
>
> [3]
> https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/SparkRoyale/src/main/royale/SparkRoyaleClasses.as
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fapache%2Froyale-asjs%2Fblob%2Fdevelop%2Fframeworks%2Fprojects%2FSparkRoyale%2Fsrc%2Fmain%2Froyale%2FSparkRoyaleClasses.as&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=vXx7fonz%2B9dRQfJIbFQVvmFSfFBfMZt9osaOPcISU8A%3D&reserved=0>
>
>
>
> Thanks,
>
> Piotr
>
>
>
> śr., 26 wrz 2018 o 15:39 Fréderic Cox <[email protected]> napisał(a):
>
> If I do it with source-path I'm getting around 3K errors like "The
> definition of base class BitmapAsset was not found or Call to a possibly
> undefined method FileStream etc... so I think that answers your last
> question :-)
>
>
>
> I was expecting to be able to use the existing Flex SWC's, is this not
> possible?
>
>
>
> On Wed, Sep 26, 2018 at 3:33 PM Piotr Zarzycki <[email protected]>
> wrote:
>
> This is probably why it's not working. I'm not an expert in that, but
> first what I would tried is create Royale library. However instead linking
> library, can you link source code ?
>
> "source-path": [
>
> "src",
>
> "mylibrary/src"
>
> ],
>
>
>
> Is this pure AS3 code without dependency to Flash ?
>
>
>
> Thanks,
>
> Piotr
>
>
>
> śr., 26 wrz 2018 o 15:21 Fréderic Cox <[email protected]> napisał(a):
>
> I tried external-library-path but if I do not use js-library-path I get
> compile errors "Access of possibly undefined property .."
>
>
>
> EnalityFlexLibrary is an existing Flex library.
>
>
>
> On Wed, Sep 26, 2018 at 2:57 PM Piotr Zarzycki <[email protected]>
> wrote:
>
> Hi Frederic,
>
>
>
> Have you tried external-library-path ? There is some explanation how
> js-library-path working [1]. However EnalityFlexLibrary is a Flex library
> or did you create Royale swc ?
>
>
>
> [1]
> http://apache-royale-development.20373.n8.nabble.com/Difficulties-with-using-in-project-JS-version-of-Royale-swc-tp5999p6015.html
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-royale-development.20373.n8.nabble.com%2FDifficulties-with-using-in-project-JS-version-of-Royale-swc-tp5999p6015.html&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=X81J0CoavI3JEFjneg%2FJvFTZCXYtCgFqtZmdkOrOhIQ%3D&reserved=0>
>
>
>
> Thanks,
>
> Piotr
>
>
>
> śr., 26 wrz 2018 o 14:49 Fréderic Cox <[email protected]> napisał(a):
>
> Can anyone help me on this? Why is this not working? The path to the SWC
> is correct.
>
>
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=dY9HjzEBCNavsbm8on0JOhqb2wWMhsoPAJqkyPmCqoc%3D&reserved=0>
> " xmlns:js="library://ns.apache.org/royale/express
> <https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.apache.org%2Froyale%2Fexpress&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=rubUeugJqDHyeTrfTJKs23UEtQMW8NeWI9gT9YDIRj8%3D&reserved=0>
> " applicationComplete="applicationCompleteHandler(event)">
>
>
>
> <fx:Script>
>
> <![CDATA[
>
> import org.apache.royale.events.Event;
>
> import com.enality.utils.ServerUtil;
>
> *// import com.enality.EnalityData;*
>
>
>
> private function applicationCompleteHandler(evt:Event):void{
>
> *// alert(EnalityData.rootURL);*
>
> ServerUtil.setServerSettings();
>
> *// alert(EnalityData.rootURL);*
>
> }
>
> ]]>
>
> </fx:Script>
>
>
>
> <js:initialView>
>
> <js:View>
>
> <js:Label text="Hello EnalityCMS!" x="100" y="100" />
>
> </js:View>
>
> </js:initialView>
>
>
>
> </js:Application>
>
>
>
> {
>
> "compilerOptions": {
>
> "source-map": true,
>
> "targets": [
>
> "JSRoyale"
>
> ],
>
> "js-library-path": [
>
>
> "/Users/frederic/Desktop/Exuvis/CityFashion/EnalityFlexLibrary/bin/EnalityFlexLibrary.swc"
>
> ],
>
> "library-path": [
>
>
> "/Users/frederic/Desktop/Exuvis/CityFashion/EnalityFlexLibrary/bin/EnalityFlexLibrary.swc"
>
> ],
>
> "html-output-filename": "index.html"
>
> },
>
> "files": [
>
> "src/EnalityCMS.mxml"
>
> ]
>
> }
>
>
>
> Error I'm getting =
>
>
>
> using SWC:
> /Users/frederic/Desktop/Exuvis/CityFashion/EnalityFlexLibrary/bin/EnalityFlexLibrary.swc
>
> Could not find file for class: com.enality.utils.ServerUtil
>
> Error: File not found: com.enality.utils.ServerUtil
>
>
>
> On Wed, Sep 26, 2018 at 2:37 PM Fréderic Cox <[email protected]>
> wrote:
>
> However I can't seem to reference code from inside the .swc. Here is my
> asconfig.json file:
>
>
>
> {
>
> "compilerOptions": {
>
> "source-map": true,
>
> "targets": [
>
> "JSRoyale"
>
> ],
>
> "library-path": [
>
>
> "/Users/frederic/Desktop/Exuvis/CityFashion/EnalityFlexLibrary/bin/EnalityFlexLibrary.swc"
>
> ],
>
> "html-output-filename": "index.html"
>
> },
>
> "files": [
>
> "src/EnalityCMS.mxml"
>
> ]
>
> }
>
>
>
> On Wed, Sep 26, 2018 at 12:44 PM Fréderic Cox <[email protected]>
> wrote:
>
> OK I found it, info about this on
> https://github.com/BowlerHatLLC/vscode-nextgenas/wiki/asconfig.json#library-path
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBowlerHatLLC%2Fvscode-nextgenas%2Fwiki%2Fasconfig.json%23library-path&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=Ta%2BwH3fe5os2JhmdoMSsxJ361lCBrpyfNBP%2FlbTFvX0%3D&reserved=0>
>
>
>
> On Wed, Sep 26, 2018 at 12:12 PM Fréderic Cox <[email protected]>
> wrote:
>
> Hi,
>
>
>
> I've managed to create my first Hello World app using Apache Royale. Now
> I'm wondering how can I link existing .swc's? I have a bunch of library
> projects which have assets, .as code files and .mxml code files. Is it
> possible to link those .swc files in an Apache Royale project (I'm using
> VSCode)? I want to be able to use the API's from the library in my new
> ApacheRoyale project so I can keep using the same libraries I used when
> working in Flash Builder with Flex for AIR.
>
>
>
> Thanks for the info!
>
>
>
> Best regards,
>
>
>
> Fréderic
>
>
>
>
> --
>
> *Piotr Zarzycki *
>
> Patreon: *https://www.patreon.com/piotrzarzycki
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=d1e8r%2BNj3vmPceksMOhb%2B%2FUapJ%2BTZE%2FKIHt3cKVXLlM%3D&reserved=0>*
>
>
>
>
> --
>
> *Piotr Zarzycki *
>
> Patreon: *https://www.patreon.com/piotrzarzycki
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=d1e8r%2BNj3vmPceksMOhb%2B%2FUapJ%2BTZE%2FKIHt3cKVXLlM%3D&reserved=0>*
>
>
>
>
> --
>
> *Piotr Zarzycki *
>
> Patreon: *https://www.patreon.com/piotrzarzycki
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Caharui%40adobe.com%7C9b86923da4504bdb44d508d623b6c099%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636735665153216547&sdata=d1e8r%2BNj3vmPceksMOhb%2B%2FUapJ%2BTZE%2FKIHt3cKVXLlM%3D&reserved=0>*
>

Reply via email to