How do I display content assist in flex builder for all classes? - apache-flex

I have a components and classes project library. Within the library, flex builder only seems to display content/code assist options for top level classes (e.g. arguments, Array) but not other classes such as VBox. Also, within the non top level classes, class properties are not provided by content assist.
In my other flex projects in the workspace, content assist works fine.
Any help would be greatly appreciated!

Flex / Flash Builder is often inconsistent in stuff like this; but I have never seen the exact situation you describe.
Have you tried closing down and relaunching Flex Builder?
Have you tried launching Flex Builder with the '-clean' attribute?
Have you tried cleaning your workspace?
Are you sure you do not have a syntax error somewhere causing issues? Are all the classes in the library included in your library class? Sometimes error don't show up if the class is not used, and therefore not compiled into the file SWC.

Did you save your source files? I don't think Eclipse updates its index until you save - so, if you just wrote class X with function Y, but didn't save X.as, then Eclipse won't know what to do with X.Y(...
Sometimes when I've run into the problem you're describing, it's been because FB wasn't able to determine what type of object I was using (for example, obj["toto"] = ?).
Another idea may be to update your version of eclipse ("Software Updates" or something like that under the Help menu).
Finally, there's an annoying issue that happens to me sometimes where the content assist will appear for about half a second, then disappear like the window tried to scroll and lost the pop-up. Do you get anything when you press Ctrl-Space?

Related

TornadoFX: Label text not updating

One of the issues I'm currently experiencing is that I can't seem to change the text of a Label which is implemented in a dynamically loaded AnchorPane. I assume this might be related to the controller and how JavaFX/TornadoFX works, but I can't seem to find what I'm doing wrong.
The issue itself occurs in this class, and happens in the showSystemDetails() method. What I would expect to happen is that upon pressing the "System Details" button in the sidebar, the labels would update to the required value, but this isn't happening for some reason.
Please feel free to point me to what I'm doing wrong, or provide any constructive criticism. The project is still in full development so a lot of things are still messy/broken.
The reason this isn't working is that you're manually loading a new version of the FMXL file every time you select something in your menu. The FXML file originally loaded by SystemDetailsViewProxy is updated correctly, but that's not the one you're showing on screen anymore.
To see the updated View, make sure you put the root node of the SystemDetailsViewProxy instance back.
You could for example change your DrawerMenuButton enum to contain references to SystemDetailsViewProxy::class instead of those two strings, and use add(viewClass) to add the correct root node to your view when clicking the menu buttons.
Furthermore, you should be using ViewModels and binding instead of manually updating the text property of the labels. You're doing an awful lot of manual/error prone work that the framework can help you with for free.
Your application is not using best practices in several important areas, and you're rolling your own solutions for stuff that the framework already does very well :)
Views are singletons when managed by the framework, but you instantiate them yourself instead of using inject/find. The result is that important life cycle methods are not being called.
I would also suggest looking into type safe builders instead of FXML.
Hope this helps :)

>500 lines in <fx:Script> and it all stops working

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.

Difference in building swf through FlexBuilder and mxmlc(ANT build)

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.

How to create/use themes in a Flex project

I just started out with Flex, and while I have worked with Actionscript2 for a few years, I'm still getting my head around Actionscript3. I've been diving into Flex for the past week, and can't figure this one thing out.
I am looking into the best way (or 'a' way) to allow me and other folks working on this project to easily create new themes for kind-of an video player. I show two videos, and need to be able to reposition them, style them, add images and anything else, really. I'm not looking to create a full-on templating engine, but if I could have a separate file/folder for each template, that would totally make my day.
I imagined having a solution in which I would have a folder inside src/templates/, and inside that folder I would have view.mxml that contains everything I need to display the videos. I would then be able to add other files such as images and such to make this template look the way it should.
Which template should be used should be defined by a variable in the main video file. This will either be provided to the swf file on playback, or provided by the video loading an external configuration file (but this is not part of my question :).
So, in short; How do I include mxml files that are inside one or two sub-folders inside src, and how do I do this in a way that the file I wish to include can be chosen via a variable.
Thanks so much in advance!
-Dave
You'd be surprised to what degree a Flex application can change its appearance through styling. Check out the following project:
http://www.fillcolors.com/
If you need more flexibility still, you could have an application with multiple views, one for each theme you want to show. An easy way to do this in Flex is to make use of the ViewStack component which basically layers view displays, showing only one at a given time.
As a very simple example, you could have something along these lines:
<mx:ViewStack selectedIndex="{currentIndex}">
<themes:CustomTheme1/>
<themes:CustomTheme2/>
<themes:CustomTheme3/>
</mx:ViewStack>
Here, currentIndex is a variable bound to the ViewStack, determining which of the three children is currently visible, each of which represent a custom MXML component (in your case, a theme).
Response to comment:
Yes, the above example is designed to do exactly that, but it's really not a feature of Flex, but of AS3. The CustomThemeX components are located using the themes namespace. The namespace is defined within the parent components root tag. In this example, the parent is a Canvas component:
<mx:Canvas xmlns:themes="themes">
This tells the compiler to look for these custom components within the themes sub-folder of your application; in other words, the src/themes folder, which contains the CustomThemeX components.
If the preceding paragraph didn't really sense to you, I'd recommend picking up a book/reading through the documentation about AS3/Flex and learning more about some of the core concepts of AS3 and object oriented programming. I wish I could help out more, but this question is starting to get a little too broad. I hope you understand. :)
I'm not an expert on Flex. But I've seen a tutorial on skins in Flex on gotoAndLearn.com. Maybe that kan give you some hints: Introduction to Flex: Part 3

flex preloader not working with # in the url (deep linking)

I can't get flash preloaders to work when there is a a # in the url of my page (even without any deep linking libraries or logic). I am using flex 3.3. Flash plugins 9 and 10, all browsers.
There is this bug regarding # in the url preventing preloaders from working:
http://bugs.adobe.com/jira/browse/SDK-14162
However, somehow, someone, somewhere has ways around this. Here are somewhat working examples (remember to clear your cache to ensure you see the preloader awesomeness):
http://www.adobecards.com/index.html#wtf
http://www.escriba.es/base_en.html#wtf
http://www.sonypictures.com/movies/onceuponatimeinmexico/site/mexico.html#wtf
http://instinct.ru/flash.html#wtf
http://www.alternativedesign.tv/plant5.html#wtf
However, these do not work (no preloader at all or momentarily stuck on 100%):
http://www.flashmagazine.com/articlefiles/preloader_finished.html#wtf
http://www.mariaclaudiacortes.com/colors/Colors.html#wtf
http://whoswestudios.com/flashsite.html#wtf
http://www.iotashan.com/examples/NotSoCustomPreloader/index.html#wtf
So, what is going on here? I suspect the flex framework.
Anyone know where to look in the flex code? Or is this bug deeper than anyone but adobe can fix?
Few things going on here.
(1) Looks like the quickest pre-loader from my #wtf examples is from Adobe. They load a very small container.swf, which then loads their 3mb main swf (amongst other biggies).
(2) Some of the others "preloaders" aren't really preloaders. Their opening animations play when the whole thing is loaded.
I believe the problem you are having is that you have your assets loading into the same frame as your preloader assets and code. Flash doesn't display a frame until it has been loaded to its entirety, cause your preloader not to be seen during load, and then covered up by the new asset after.
As a flex developer you do not have a timeline, so this is why it is important to use a small "container" as you call it or as loader movie. This movie is to have a tiny foot print so that it is available asap. Upon completion of load, the container can then call the main movie into itself, tracking the incoming data with the ProgressEvent.
It is hard to know exactly what the issue is from what you have said, but this is a common problem. Fonts, and any other embedded items either need to be embedded on frame 2 or laterm which I believe you can only do with the flash IDE, or you require the extra loader swf, lightweight and quick to load!
I have successfully deeplinked the following with preloaders
http://www.madagascargame.com
http://www.kungfupandagame.com

Resources