Summary
We are developing FXML with Scene Builder 10 and loading it on an app with JRE 8. We are confident that our FXML is all Java 8 compliant, but would like to suppress the following warnings that are printed whenever an FXML file is loaded:
Dec 19, 2018 12:50:14 PM javafx.fxml.FXMLLoader$ValueElement processValue
WARNING: Loading FXML document with JavaFX API of version 10.0.1 by JavaFX runtime of version 8.0.192
We've thought of a variety of solutions, but none of them seem very good. I just want to know if anyone can think of anything better.
Note that there are a few questions on SO that seem very similar to this, but so far it seems like they were all resolved by just updating to a newer JRE, which is not an option for us.
Background
Our apps get shipped to a variety of customers, some of whom are unwilling to update past JRE 8. It turns out that Scene Builder for java 10 is WAY faster than Scene Builder for Java 8 (not sure why). As a result, we'd like to keep using Scene Builder for Java 10, but we always write our code to be Java 8 compliant and we always do all of our testing with JRE 8.
Workarounds
There are a variety of workarounds we've thought of, but they all seem a little hacky and definitely more like workarounds than true solutions. What I would really like to see would be either a way to tell Scene Builder to use an older API version, or to tell the FXML loader to ignore the version number. It's looking like that's probably not possible though.
Manually change the version number in FXML
It's not hard to just change the xmlns="http://javafx.com/javafx/10.0.1" attribute to xmlns="http://javafx.com/javafx/8.0.192" but it gets updated every time you modify it in Scene Builder and it's a pain to have to keep changing it. I thought about making a git hook to do it automatically on commit, but we're using Eclipse and the egit hook integration is practically non-existent.
Redirect Stderr on FXML load
We could make an FXMLLoading utility that we use for all FXML loading. It would could essentially disable stderr prior to loading it and then reenable it. This would not be thread safe though and anything else that might be printed to stderr at the same time would be lost.
We could also redirect stderr to an object that determines what should be printed based on the currently running thread, or perhaps by just omitting text that matches the FXML warning we're seeing. This still seems sort of hacky though.
Use custom input stream to load FXML
We could create an FXML loading utility that uses load(InputStream) and pass it in a custom InputStream that filters out or modifies that xmlns attribute. I think that this is probably my favorite solution, but it still seems like sort of a hassle.
Related
Well, it's a little ridiculous; and probably unbelievable, but when I have more than five hundred lines of actionscript in tags in my MXML FLEX Main.mxml, all syntax highlighting, error and syntax verification, error reporting, "Problems" pane, and even sometimes compilation fail. Upon removing any chunk of code, it works again.
I don't see why Adobe could release a product such as Flash Builder 4.5 Premium, have this big of a problem; and nobody notice. Therefore I believe the problem has to do with my computer, or my project; as there's now ay more people have had this happen if I can't even find it on Google.
Additionally, many objects that have been defined in the MXML properties above the code, even those in All States, are now showing as warning: Access of undefined property down the side of my document. However, these warnings are not showing up in the "Problems pane", and aren't even yellow squigly underlining the right sections of code to pertain to the message.
Steps I have taken to TRY and fix this:
I have tried restarting, as well as re-installing the IDE (Adobe Flash Builder 4.5).
I have tried creating a new project.
I have tried splitting my code into smaller .as files and including them.
I have tried compiling my application.
Nothing has worked, PLEASE HELP.
--
Edit 1: In response to the first answer, I have already tried increasing the memory allotted to Adobe Flash Builder 4.5 by editing the flashbuilder.ini and flashbuilderC.ini files in the main installation folder, it did not help; as my heap (heap display in bottom right) never uses more than 128MB anyways (even during compile) this did not fix anything.
You can try the following steps:
You can try to allocate additional memory for your Eclipse/Flash Builder by editing of eclipse.ini.
You can try to compile your project from the command line using mxmlc compiler and compare result.
You can try to split your code but not using just code including (which you should avoid forever) but extraction subcomponents (keywords are refactoring, OOP, composition etc.).
And of course you can use all of these advices together :)
Anyway you should avoid large code listings in a Script block of a single MXML file. The main purpose of Script block of MXML is to have simple and clear code with event handlers and required fields declarations.
I am trying to understand what is going on in a SWC that I am importing from Flash CS4 into Flex Builder 3. Specifically I am using a SWC supplied by a Designer as the animation for a custom preloader (a subclassed DownloadProgressBar).
The issue I am trying to understand is, once the FlexEvent.INIT_COMPLETE is fired, I cleanup by removing the swc by running this :
removeChild(myPreloader);
myPreloader = null;
though even after I have removed this (which is successful, as I have checked by comparing this.numChildren before and after the call) the key framed animation still continues to run (not visibly). This has been detected by the Designer placing a trace in the time line of the animation (in Flash).
Can anyone tell me why is it, that even after I have removed the animation from the subclassed DownloadProgressBar, it still keeps running ?
Also, is it standard practice when importing SWCs to manage the cleanup of resources from the Flash side of things (much like releasing memory in obj-c). I find it counter intuitive that removing the child from the Flex side does not stop the animation.
Any clues to this would be greatly appreciated.
Basically, your SWC file is nothing more than a ZIP containing a SWF. So what you're doing is removing a MovieClip from the stage, but it is NOT stopping or unloading it. You might want to try
myPreloader.stop();
to stop the animation and
myPreloaderLoader.unload();
after you removed the item from the stage to free up memory.
Beware, though: the Flash Player garbage collection does not always work correctly. If there is any kind of ActionScript running within myPreloader, chances are it will continue to run, and it will be ignored during garbage collection. It is usually best to include a clear() or destroy() method for all AS classes and call it upon Event.REMOVED_FROM_STAGE.
This would have to be done by your designer colleague, but in my experience it is the cleanest procedure.
I just started making games and I decided for my next project to use either flashdevelop or flex builder. Reason being is because you can embed just about everything and for licensing purposes and it recommended the the game is compiled into one file. flex sdk is good with that type of stuff.
As of right now I decided to use flashdevelop. but recently it's been kicking my behind. First I wasnt able to use ui class (e.i. buttons, and textboxes) probably because of something stupid I did. Now for some reason I can not compile my applications. When I compile, nothing happens, no errors, no nothing. below is a screenshot of what happens when I compile.
Yes i installed debugger and yes I installed sdk
So now I was thinking about just going with flex builder. Not sure which one is more easier to assemble and use. But I do know the flex builder community is bigger, and they have a much better documentation. I am good with actionscript, but I am not so good with using flex.
My ultimate question is...
Which one is easier to assemble
which one is easier to use
which one is BETTER overall
as far as not compiling goes, looks like it compiled just fine.
I don't know what you're expecting to see from the code other than the "Hello"
to see that open up your output window (under View)
Whether you use flex or flashdevelop, you end up using the same compiler.
Like Adam, I find flashdevelop easier to use than flex, but that's because I've used it more (flex trial expired and FD didn't)
And plus I'm fast with FD, like really fast :)
Try some of the shortcuts:
to create getter and setter or
generate function press 'ctrl shift ~' and PRESTO
or for a for loop or for each loop type in the first few
letters and press 'ctrl B'
to find instances of any string in code you
can do F3 and shift F3, whereas F4
will find the object or function
declaration(even in separate files)
FD also adds a lot of the classes as
needed (sometimes I have to do it manually)
and the latest version lets
you generate classes which extend
another class easier.
I'm sure that flax does most of this as-well, but when you're already used to this then switching slows you down.
I had the same issues when I started working with FD. What it boils down to is that flex has a bunch of libraries that it's using that FD doesn't unless you link to them, and sometimes even then.
But once you start compiling your libraries and assets into SWCs you will be able to compile them through Flash and Flex. Which can be handy (like when you're working with other developers)
FD doesn't have a profiler, but this has not prompted me to stop using it. When I need some debugging and trace isn't enough I add the demonsters debugger class: http://www.monsterdebugger.com/ it's pretty powerful, but you still can't step through your code.
** Update - Flash Develop has had a profiler for a few versions now, It's good for watching memory use, but I still end up using monster debugger a lot. You can use debug in Flash Develop as-well and step through your code.**
FD doesn't have the UI that flex does, and for developing mxml it is a bit more tedious, but at pure as3, I find FD is all I need. Well than and Flash to create my SWCs
I think a lot of it is personal preference, and what you have previously used. Some people do have strong opinions though.
Personally I like FlashDevelop, but only because I am use to it, and can get things done a lot faster e.g. setting up projects, workflow, shortcuts etc. But I am sure If I forced myself to only use FlashBuilder (formally FlexBuilder) that I would soon come to grips with its nuances.
Here are a few of my points for either side:
FlashDevelop:
I like how FlashDevelop is so simple,
where as Flash Builder is rather
bulky.
FlashDevelop is totally free, where Flash Builder actually cost quite a bit.
Flash Builder:
Built on Eclipse, so has a massive community, tons of plug-ins etc.
Source control intergrated into the IDE (very important in large projects).
Also might want to check out this article on ActionScript Editors.
I know it's an old topic, but in case someone finds it, here is an interesting thing I've noticed:
I am using pixel fonts in my project, and by default Flash Player blurs part of it (it is a known problem). One solution is to use a bitmap text (some kind of custom class) and the other is to use Text Renderer with some of its related elements to force Flash to render the font correctly. When compiling under the same version of Flex SDK in Flash Builder 4+ the font rendered correctly. But when I compiled with Flash Develop (latest version) the text was really ugly, with missing pixels at random places. It might be caused by the fact that Flash Develop or Flash Builder are sending some hidden arguments to the compiler which either make it work/break.
This is a long running question that has been repeated a few times. Review this question and see if it answers yours.
Web-based Game Development: Flex Builder or Flash CS3?
I have been in the process of creating a "lite" version of an existing Flex application, and thereby porting many of the classes that are used by both into a library project. As such, I want to easily find all of the "orphan" classes in the original project - those classes that are no longer referenced/used by the project. Is there an Eclipse plug-in, or some other easy way to find these in Flex Builder 3?
Thanks.
MXML Compiler (mxmlc) compiler has "link-report" which will generate all the classes you are using in your original application. From there, with a bit of grep / awk / xsl magic, you should be able to diff with the classes you have in your library project.
Here's what I do sometimes, lets say we've been refactoring, and a class becomes obsolete, I simply move the suspecting file from Flex Builder to the desktop, rebuild the project and see if it the compiler spits out any Errors.
If it doesn't complain, I know I can safely delete it.
If your class is depended on, the compiler will throw some errors in the Problems panel in Flex Builder and give you a fairly clear hint of what's missing.
This won't be fun however if you have thousands of classes, as you have to traverse them one by one.
I would suggest, always keep copies of the old ones in Subversion, just in case you had something re-usable in there, and later you want the deleted file restored.
Will there be any difference between the swf generated by Flex Builder and mxmlc?
In my application, there is a page with certain fields to be filled in. Upon clicking a button, it opens up a popup. Upon selecting an option in the popup and clicking OK, it makes a request to the server, fetches some data and adds it to the main page.
When the swf is generated by the Flex Builder, everything works just fine. But when the same is generated using an ANT script, upon selecting a value from the popup, I get an error.
[ResultEvent messageId="8638F71F-BCB8-ACFD-E577-B6F97156374D" type="result" bubbles=false cancelable=true eventPhase=2]
This happens only when ANT is used for building the swf.
<mxmlc output="$swf_name" file="$mxml_name" allow-source-path-overlap="true" optimize="true">
I'm using the Cairngorm framework, and the swc is generated before hand.
<compc output="$swc_name">
Also there is a size difference between the final outputs.
The swf is 802 KB when generated from Flex Builder whereas its only 788 KB when generated using ANT. I haven't made any config changes in Flex Builder. It uses the default values(which I believe is optimized) for generating swf.
Am I doing anything wrong with ANT scripts? Do I need to use any different arguments so that I can remove the error which I get only when using the swf built by mxmlc?
Please provide your suggestions.
There could be differences between your configurations; have a look here -- this Adobe KB article might help you determine whether there are, and if so, what they might be so you can correct them:
http://kb2.adobe.com/cps/404/kb404341.html
I hesitate to mention this second part, because I haven't often toggled between the two compilers (I generally stick with one or the other), but I can say that I've noticed this issue before myself, and as I recall there was a brief mention, in Ely Greenfield's talk at MAX this past month, about a push with Flex 4 to achieve parity between Flex Builder's compilers and their SDK counterparts -- suggesting that such parity doesn't quite exist today. So while I don't have much in the way of details on that, it does seem there are some differences between the two.
Wish I could be more helpful on that -- maybe someone with a little more detail could chime in on it.