Like in android i would use for example width ="#dimen/bottom_padding"
How can i do something similar in Java FXML files?
Related
In the official documentation of Gluon Client maven plugin, the 'reflectionList' section is explained as
List of additional full qualified classes that will be added to the default reflection list, that already includes most of the JavaFX classes.
Tbh, it doesn't clearly explain what type of classes should be added in 'reflectionList'. In a pom.xml file of a gluon sample some of the classes in that project are not specified.
So, what kind of classes do we have to specify in 'reflectionList'?
You only have to add classes which are loaded via reflection. This happens for example when you are using FXML. It's mostly a try and error game unless you are following a more systematic approach and use the GraalVM native-image agent.
In most cases, controllers for FXML views created in Scene Builder. In the FXML file you specify what class should be a controller for a view generated from this file, and in that controller class you put fields and methods which are linked to elements in FXML. Sometimes, unfortunately, if you use a certain JavaFX widget in FXML you will also have to specify it on the reflection list (happened to me with javafx.scene.control.TitledPane).
There is way to make it more fine-grained and specify certain methods instead of all classes, but I wouldn't recomment it. Please take a look here for details: How to solve fxml loading exceptions in compiled JavaFX project using GluonHQ client, Native Image and GraalVM?
My solution is to keep FXML simple and enrich it with additional styles, register methods on actions (unless they are straightforward, like onClick), etc., in the code, so that I don't have to deal much with reflection.
How can I specify a default css file for a QML WebView in Qt 5.5? I am looking for a solution similar to the one provided by BlackBerry for their Cascades framework https://developer.blackberry.com/native/reference/cascades/bb__cascades__websettings.html#property-userstylesheetlocation
It seems like this is currently not supported by the APIs provide by Qt 5
I received a Flex project but don't know how to open it in Flash builder. It doesn't contain a project.mxml or .actionScriptProperties, .flexProperties and .project files.
the file structure looks like this:
(rootFolder)
-(com)
...subfoldrestructure containing only folders and .as files
-(src)
-(_embed)
-assets.fla
-assets.swf
-assets.swc
-Main-app.xml
-Main.as
-icon-16.png
...
-icon-128.png
how do I make a compilable Flex project out of this?
That is not a Flex project, that's a Flash project. Just create a new Actionscript project and point the location of it at the same location as this one. It will add the necessary project files to compile. It will try to create another Main actionscript file, but you can delete the one that it made and select the one already there as the default application.
I have a working AS3 project and it compiles fine to a SWF. I added a new file (via various means: import, drag-drop, new), but it doesn't compile this new file. I'm using Flex Builder 3. I've tried a clean an rebuild. I've tried renaming. It picks up the existing files fine, but not the new one. The project is set to use a HTML wrapper. I see some build files (I think). The new file is in an existing folder and package.
Any idea what could be wrong?
First, the SWF Compiler will optimize your end code. If you never use a class or create an instance of it anywhere in your application; that code will never be compiled in your application. this is a common occurrence if you're using Flex Remoting with some backend; and a VAlue Object is never instantiated directly, instead you're always returning arrays of it. You'll find you get a lot of "Generic Objects" without the backend object-to- AS3 object translation of the Flex Remoting Gateway.
You didn't specify what type of file you are adding. If it is an ActionScript file it won't automatically be compiled in the swf. You'll have to 'include' it in another class somehow. IF it is an ActionScript class or MXML Component, make sure you are using that class somehow in your code. If it is another file type, such as an image or other asset you'll have to embed that file into your code somehow.
We might be able to offer more help if you were to tell us what type of file is not being added to the final SWC. Also tell us how you can tell.
Has anyone got experience in converting AS3 projects (no mxml) in Flex, to Flash CS4? Are there any resources out there as to what works in Flex Builder that doesn't work in Flash, and how to get the project running? I read somewhere that (for instance) certain Metadata tags don't work.
If I've got all my code in the src folder, should I just create the .fla file in that folder and basically copy all code from the .as file which launched the Flex project? Or create the .fla file somewhere else and point assign that src folder in the classpath? Also, not being familiar with the CS4 IDE, do I create a new Flash Project?
Thanks!
So here's the issue I'm having. The code in the Flex AS3 looks like this:
[Embed(source='C:/WINDOWS/Fonts/ArialBD.TTF', fontWeight = 'bold', fontName='ArialBold', unicodeRange='U+0020-U+0020,U+0021-...')] //a bunch of other unicode
public static var _VerdanaFontBold:Class;
[Embed(source='C:/WINDOWS/Fonts/Arial.TTF', fontWeight = 'regular', fontName='Arial', unicodeRange='U+0020-U+0020...')] //a bunch of other unicode
public static var _VerdanaFont:Class;
And in constructor of the extended textfield in which my text appears I have:
Font.registerFont(_VerdanaFontBold);
Font.registerFont(_VerdanaFont);
CS4 doesn't allow use of the Embed metadata. So I've commented that out. In CS4, I understand that I'm supposed to create a blank textfield in design mode, which I've done. I then can select fonts to embed. I've selected verdana (upper and lower case, punctuation, number, etc).
When I run the app in CS4, the textfield is blank.
What am I doing wrong? Do I need to give the verdana font an instance name of _VerdanaFont? I wouldn't think so, since I've had to comment out the Font.registerFont as well. The fact that I'm embedding the font in a blank textfield, and not the one that's called by the document class I've set, shouldn't matter, right -- the font should just be embedded in the swf and available for use. But it's blank.
Does anyone know what to do here?
Edit: Well given that the apparent reason this isn't working now has to do with fonts not showing up correctly, I better create that as a new Question. Also, there's a clearer description than the one in the link provided above regarding the document class, here: http://www.heaveninteractive.com/weblog/2008/03/04/introduction-to-the-document-class-in-actionscript-30-tutorial/
It really depends. If it's just a pure AS3 project that relies only on playerglobal.swc it should be fairly easy. Just copy your .as files and add them to your new project as Cameron has suggested.
If however you've written a pure AS3 Flex app that relies on any of the other SWCs (flex.swc, framework.swc, etc) it's not really possible, as CS4 can't use SWC files. If you google around you might find somebody who's disassembled the SWC into various .abc files and a SWF full of resources, but you'll probably end up having to embed the entire Flex framework and all support code into your final SWF, which will bloat it big-time.