You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by OK <OK...@edscha.com> on 2016/01/17 20:49:35 UTC

[FlexJS] Some general questions

Hi,
I've started playing around with FlexJS and have some (perhaps stupid)
questions:

1) Can be pure ActionScript "non UI .swc libraries", that are already used
with the standard SDK, still used with FlexJS? (I've made some tests with
PureMVC and it seems that it works)
2) Is there an equivalent to <s:module> implemented and if so, could FlexJS
modules used with the standard SDK?
3) Is it possible to integrate third party JS UI libraries (especially one
of the material design libs out there) and if so, what effort does it mean? 
4) Can FlexJS target AIR?

Thanks for help,
Olaf




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Some-general-questions-tp11765.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Some general questions

Posted by OK <OK...@edscha.com>.
>So, that's why I'm currently exploring trying to put UIComponent on top of
>UIBase.  It should allow your skin files to work as is, but again, size
>and performance may be an issue.  And I might hit some other roadblock.

Cause my english is rather bad there sometimes may occur misunderstandings
and confusion.
So I'd like to clarify my point of view:
I'm not sure if a spark-like component set is really needed, especially if
it's hard to implement and perhaps less performant.
I would go so far to say that I'll probably never port an existing app to
FlexJS. Instead of this I'd take the opportunity to redesign and reimplement
it. For very big code bases this is probably not an option.

At the end it's a balancing act between satisfy Flex developers with its
existing code base and inspire also new developers for FlexJS. IMO last
could be easier if FlexJS provides minimum one fast and modern UI component
set. Yes I know FlexJS depends on Volunteers... ;-)

Thanks,
Olaf



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Some-general-questions-tp11765p11783.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Some general questions

Posted by Alex Harui <ah...@adobe.com>.

On 1/18/16, 8:40 AM, "OK" <OK...@edscha.com> wrote:

>>But if you want to see the SWCs functionality work without Flash, you
>>actually need to cross-compile the source code for the SWC with the
>>FlexJS/FalconJX compiler.
>
>By doing this with the PureMVC lib I've got a "File not found" error while
>cross compiling my FlexJS project
>(see log at the end), do you've any idea what I've done wrong?:
>
>These are the steps that I've done using FlashBuilder 4.7:
>- Create a new Flex library project
>- Select "FlexJS 0.6.0 SDK" as "Flex library compiler"
>- Paste the PureMVC source code into the library project
>- Copy the auto created swc to the "lib" folder of my FlexJS project
>- Compile my FlexJS project by using "External tools" -> 1 FlexJS (Falcon
>JX...)
>

Ah yes, that made me realize that we haven't implemented auto-packaging of
the JS files in the SWC.  We are currently doing that via Ant script.  So
for now, there are some additional steps.  After making sure the PureMVC
code compiled to be a SWC without any errors in the Problems tab, the next
step is to try to cross-compile it into a set of JS files.  Try running
"External tools" -> "FlexJS CompC".

That will expose any Flash dependencies in the PureMVC code.  It will
probably also expose any dependencies on the regular Flex SDK which might
have dependencies on Flash.  But if that does compile without errors, then
it should output a pile of JS files, one for each AS file.  If you get
errors, you will have to figure out what modifications to make to PureMVC
to get rid of those errors.  Feel free to ask here.  I'm doing a similar
exercise with the Spark and MX SWCs right now.

Then, once the cross-compile is free of errors, you can either create an
Ant script like we have for the FlexJS swcs to package the JS files into
the SWC, or try telling FB to include those files, or, instead of using
"External tools" -> FlexJS (FalconJX...) to compile the app, make a copy
of that external tool and add an additional -sdk-js-lib= parameter
pointing to the folder of JS files.

>
>>I'll ponder whether it will be practical to create a component set that
>>lets you see some small portion of your UI written in FlexJS work in your
>>regular Flex app in Flash.
>Don't waste to much time on this.
>My understanding now is that it makes most sense to start with FlexJS from
>scratch... and that's ok!

Well, not from scratch.  If you have existing code, you should be able to
re-use all or most of your .AS files.  For the MXML files, it was
easier/faster for us to produce a new component set for MXML UI instead of
using one based on Spark in order to have something to show, and having a
lighter weight component set should give you better performance and
download speeds.  And other folks said their apps were old and wanted to
upgrade their UI anyway.  And for many, the big dollar value in migration
is in the AS code, not the UI.  So right now as I write this, you have to
do a fair amount of changes to your MXML files, but if the Spark-like
component set becomes a reasonable option, you'll have to do far fewer
changes (but probably not zero changes).

>
>>I'm writing a more Spark-like component set for FlexJS now.
>I'm not a designer, but for me a modern look and feel is very very
>important.
>Is my understanding right that even with a Spark-like component set there
>will be nothing similar to "Component skinning"? So if styles are not
>sufficient to change the look and feel of a component we have to create an
>own component set?

There are actually at least two approaches to doing a Spark-like component
set.  One is to subclass the current FlexJS components and give them the
outer API surfaces of the Spark components.  But you are right that this
approach won't have an identical skinning model.  What I'm investigating
right now is having UIComponent subclass the FlexJS UIBase.  If it is
practical to do that, then a component set based on that will probably
have the same Spark skinning model, but realize that the size and
performance of that may be insufficient.  We'll see.

Having ported the FlexStore example to FlexJS, I would say each MXML file
needed to be touched.  FlexStore didn't really leverage Spark Skinning
that much, but I had to visit nearly every line in the MXML file to rename
tags and attributes.  Not too difficult, but apparently more work than
most folks want to do.  The FlexJS tags and attributes have different
names in order to better map to native HTML controls and APIs where
possible.

I expect that the Spark-like component set based on subclassing existing
FlexJS components would mean you wouldn't have to touch as many lines in
your MXML files, but the skin-related files might be an issue, and any
code where you expected a regular SDK type like UIComponent might need
tweaking as well.

So, that's why I'm currently exploring trying to put UIComponent on top of
UIBase.  It should allow your skin files to work as is, but again, size
and performance may be an issue.  And I might hit some other roadblock.
Right now, it looks like I'd need Harbs to finish up the E4X emulation
otherwise you'd have to touch more of your code where you used
DescribeType.  And some other code will have to be touched in order to
deal with the fact that currently is no event priority and weak references
in the JS runtime (and maybe never will be).

HTH,
-Alex


Re: [FlexJS] Some general questions

Posted by OK <OK...@edscha.com>.
>But if you want to see the SWCs functionality work without Flash, you
>actually need to cross-compile the source code for the SWC with the
>FlexJS/FalconJX compiler.

By doing this with the PureMVC lib I've got a "File not found" error while
cross compiling my FlexJS project
(see log at the end), do you've any idea what I've done wrong?:

These are the steps that I've done using FlashBuilder 4.7:
- Create a new Flex library project
- Select "FlexJS 0.6.0 SDK" as "Flex library compiler"
- Paste the PureMVC source code into the library project
- Copy the auto created swc to the "lib" folder of my FlexJS project
- Compile my FlexJS project by using "External tools" -> 1 FlexJS (Falcon
JX...)


>I'll ponder whether it will be practical to create a component set that
>lets you see some small portion of your UI written in FlexJS work in your
>regular Flex app in Flash.  
Don't waste to much time on this.
My understanding now is that it makes most sense to start with FlexJS from
scratch... and that's ok!

>I'm writing a more Spark-like component set for FlexJS now.
I'm not a designer, but for me a modern look and feel is very very
important.
Is my understanding right that even with a Spark-like component set there
will be nothing similar to "Component skinning"? So if styles are not
sufficient to change the look and feel of a component we have to create an
own component set?


>The advantage of having a SWF version is that you can
>test against a runtime that truly understands sealed class definitions and
>interfaces.  
Hope I've got it ;-)

Thanks,
Olaf

ErrorLog:
------------------------
using SWC: C:\Users\kruegola\Adobe Flash Builder
4.7\PureMVCForFlexJS\bin\PureMVCForFlexJS.swc
Could not find file for class:
org.puremvc.as3.multicore.patterns.mediator.Mediator
File not found: org.puremvc.as3.multicore.patterns.mediator.Mediator

java.lang.RuntimeException: Unable to find JavaScript filePath for class:
org.puremvc.as3.multicore.patterns.mediator.Mediator
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:179)
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:213)
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:213)
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:213)
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:213)
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.addDeps(GoogDepsWriter.java:213)
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.buildDB(GoogDepsWriter.java:130)
	at
org.apache.flex.compiler.internal.graph.GoogDepsWriter.getListOfFiles(GoogDepsWriter.java:82)
	at
org.apache.flex.compiler.internal.codegen.mxml.flexjs.MXMLFlexJSPublisher.publish(MXMLFlexJSPublisher.java:334)
	at org.apache.flex.compiler.clients.MXMLJSC.compile(MXMLJSC.java:472)
	at org.apache.flex.compiler.clients.MXMLJSC._mainNoExit(MXMLJSC.java:351)
	at org.apache.flex.compiler.clients.MXMLJSC.mainNoExit(MXMLJSC.java:276)
	at
org.apache.flex.compiler.clients.MXMLJSC.staticMainNoExit(MXMLJSC.java:235)
	at org.apache.flex.compiler.clients.MXMLJSC.main(MXMLJSC.java:178)




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Some-general-questions-tp11765p11771.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Some general questions

Posted by Alex Harui <ah...@adobe.com>.

On 1/18/16, 12:03 AM, "OK" <OK...@edscha.com> wrote:

>>Any library without dependencies on Flash has a chance of working when
>>cross-compiled. 
>
>Does it make a difference if the swc is compiled by using the standard
>Compiler or by the FlexJS Compiler?

I guess it depends on what your goals are.  FlexJS should be a viable
lighter weight framework for building Flash/AIR-based applications.  But
most folks are looking to use it to write MXML and AS and cross-compile it
to output HTML/JS/CSS-based apps.

If all you want is just a SWF, then it doesn't matter which compiler
compiles the SWC.  ActionScript ByteCode (ABC) is just abc code no matter
what compiler is used.

But if you want to see the SWCs functionality work without Flash, you
actually need to cross-compile the source code for the SWC with the
FlexJS/FalconJX compiler.

>
>
>>Why do you want to load FlexJS modules into a Flex app?
>
>I could extend existing Flex Apps by using FlexJS for selected
>functionalities.
>On the one hand working with the standard SDK gives me a safe feeling with
>the certainty that I'm
>able to do my work and on the other hand I could try FlexJS and integreate
>it without any risk.

I'll ponder whether it will be practical to create a component set that
lets you see some small portion of your UI written in FlexJS work in your
regular Flex app in Flash.  I'm writing a more Spark-like component set
for FlexJS now.  The issue is that in order to be lightweight and
cross-compile, FlexJS doesn't want to base its all of its components off
of the regular Flex SDK's UIComponent which is really heavy and has lots
of Flash dependencies.  And without that, certain integration issues like
Focus Management might be an issue.

Currently, the thinking is that folks would test out FlexJS by creating a
branch of their current app and trying to cross-compile the whole thing.
All of your AS code that doesn't have Flash dependencies has a good chance
of cross-compiling and just working.  Then, you have to look into
replacements for where your AS code needs Flash.  For MXML, you currently
have to change out a fair amount of tags and attributes.  The Spark-like
component set should require fewer places to tweak but might result in a
really fat and slow JS file.  We'll see.

>
>
>>...or skip using the SWF altogether and just use what we call "externs
>swcs": a swc of empty API definitions.
>
>I don't understand this, what do you mean with "...skip using the SWF"?

Some folks think they don't need/want a SWF version of their FlexJS app.
They only want to work with the HTML/JS/CSS.  Just like you shouldn't use
Flash API's in a FlexJS app if you want it to cross-compile, you can't use
low-level HTML/JS/CSS APIs in your FlexJS app either if you want it to
create a runnable SWF.  Basically FlexJS is trying to create a set of APIs
that aren't Flash or JS specific so it can cross-compile into either SWF
or HTML/JS/CSS.  The advantage of having a SWF version is that you can
test against a runtime that truly understands sealed class definitions and
interfaces.  This should catch a lot of errors much sooner than you would
if you just test your HTML/JS/CSS.  And you can deploy the SWF to older
browsers that FlexJS won't support.

HTH,
-Alex


Re: [FlexJS] Some general questions

Posted by OK <OK...@edscha.com>.
>Any library without dependencies on Flash has a chance of working when
>cross-compiled. 

Does it make a difference if the swc is compiled by using the standard
Compiler or by the FlexJS Compiler?


>Why do you want to load FlexJS modules into a Flex app?

I could extend existing Flex Apps by using FlexJS for selected
functionalities.
On the one hand working with the standard SDK gives me a safe feeling with
the certainty that I'm 
able to do my work and on the other hand I could try FlexJS and integreate
it without any risk.


>...or skip using the SWF altogether and just use what we call "externs
swcs": a swc of empty API definitions.

I don't understand this, what do you mean with "...skip using the SWF"?


Thanks for help Alex!

Olaf



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/FlexJS-Some-general-questions-tp11765p11769.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: [FlexJS] Some general questions

Posted by Alex Harui <ah...@adobe.com>.

On 1/17/16, 11:49 AM, "OK" <OK...@edscha.com> wrote:

>Hi,
>I've started playing around with FlexJS and have some (perhaps stupid)
>questions:
>
>1) Can be pure ActionScript "non UI .swc libraries", that are already used
>with the standard SDK, still used with FlexJS? (I've made some tests with
>PureMVC and it seems that it works)

Any library without dependencies on Flash has a chance of working when
cross-compiled.  But we don't have cross-compilation support for E4X
working yet, nor do we have reflection/introspection APIs.  Also, the
event lifecycle for FlexJS is different as well.  But we are interested in
seeing what it would take to get them to work.  Depending on how my
attempt to make a more Spark-like component set goes, it might help make
more of these libraries work.

>2) Is there an equivalent to <s:module> implemented and if so, could
>FlexJS
>modules used with the standard SDK?

We have not implemented modules yet in FlexJS.  Once we do, you should be
able to load a FlexJS module SWF, but then I don't know how well it would
work.  Why do you want to load FlexJS modules into a Flex app?

>3) Is it possible to integrate third party JS UI libraries (especially one
>of the material design libs out there) and if so, what effort does it
>mean?

Yes.  We have prototypes of using GoogleMaps, CreateJS, Jquery and
Jasmine.  Depending on how well you want the SWF version to work, you
create AS classes that implement the same functionality or just act as
"mocks", or skip using the SWF altogether and just use what we call
"externs swcs": a swc of empty API definitions.  Having a SWF version lets
you debug your code with a strict runtime which can be quite useful for
catching integration issues sooner.

> 
>4) Can FlexJS target AIR?

Yes, the GoogleMaps demo and CordovaCameraExample use AIR to run the SWF.
To run the cross-compiled version we are targeting Cordova/PhoneGap since
it is an Apache project, and supports a wider variety of runtime
configurations.  We have not tried to publish a JS app that runs in AIR.

HTH,
-Alex