February 3, 2012

FlashBuilder, the yellow question marks, the import “foo.bar” could not be found – find touch as a temporary workaround?

Filed under: flash, flash builder — Tags: , , , , , , , — michaelangela @ 11:22 pm

I was working on a Flash Pro project, coding in FlashBuilder. The way to go. The nearest I can tell is when running a debug build for some reason the project lost something. The legendary yellow squiggles with the ? marks appeared all over the place. I couldn’t get it to go away. It’s in git so I just checked it out in a new folder without the project files and could keep moving. After another debug build, it happened again. Not sure on that bit. But I found that doing ANY change in the file and saving the imported file would suddenly make the file usable again.

import com.foo.bar.MyClass

Open up MyClass and do anything that allows FlashBuilder to save it. The quickest was space/delete/save. If you have FlexFormatter on make sure auto format isn’t on if you don’t want to reformat 3rd party libraries when doing this. So it seemed that anything you change, so that it saves, brings the file back into FlashBuilder’s list of valid imports. But when you close the project and reopen it, the invalid imports are back.

That got me to thinking… if I just touch the file would that do it? It did. Now we’re in business.

find . -type f -print0 | xargs -0 touch

That did the trick. All the files are back in business. It’ll happen again but at least I have a quick way to get it working so refactoring, finding usages, hiearchy and all that goodness works again.

This is FlashBuilder 4.5.1.

August 13, 2010

FlashBuilder 4 jump directly to API documentation tip

Filed under: Uncategorized — Tags: , , , — michaelangela @ 4:30 am

I was wondering if it is possible to jump directly to the ASDoc of a Flash/Flex component. Seems it is possible.

Oh my. Very nice. Place your cursor in the code of interest and press Shift + F2. And there you go. Previously I used FluidApp to wrap the AS3 reference documentation locally as noted below. But now this is not needed. On my box FluidApp’s search is faster sometimes than the Adobe Help depending on what’s running, but jumping right to the docs in question is very helpful.

Big Spaceship | Labs Blog – AIR App: AS3 Language Reference

I found the scrollbars in the air app to be shoddy, so I downloaded the offline version of the AS3 docs:


and then created a fluid app from my local version.


now runs perfect offline and even has a search.

Simplest, cleanest singleton

Filed under: Uncategorized — Tags: , , — michaelangela @ 12:31 am

This is the simplest and cleanest singleton patter I have seen to date for AS3. Let’s you set it up and get right to coding. The author does make a request for a singleton metadata tag to automatically make classes into singletons. Well we sort of have that with RobotLegs. With the injection rules you can just tell RobotLegs that any time you inject an instance of a particular class just to make it a singleton and it’ll do that in the background for you. Sweet and simple. But this code linked below is the closest non-framework solution I have seen that gets close to that in its simplicity.

ActionScript 3 Singleton Redux – darron schall

It was actually a combination of other factors (and personal preference) that made me revisit the singleton pattern. The singleton technique that I prefer was developed to address the other issues I was running into and to reflect my personal coding style. While I was at it, I figured I might as well address the private constructor issue too. After all, we all love being smacked around by the compiler sometimes.

The technique I prefer has the following highlights:

  • Usage of static instance read-only property instead of a static getInstance() function. This is somewhat a matter of style and personal preference, but I prefer the succinctness of the read-only property. This is especially obvious when the singleton is used in binding expressions. Plus, getInstance() is so 1990s Java which ActionScript is most definitely not. I kid, I kid. But seriously, “.instance” is cooler.
  • Usage of a private lock class to prevent outside construction. While this is a common theme in the above links, my approach is slightly different. Instead of passing an instance of the private locking class to the constructor, I just pass the Class reference itself. This does two things. First, it clarifies the conditional check in the constructor. The test for the proper locking Class reference communicates the code’s intent better than the traditional check for not null. Second, it encapsulates the private locking class itself. The constructor’s argument is simply lock:Class which doesn’t expose the name of the private locking class to the outside world, but still communicates that the constructor is locked.
  • Removal of ‘Unable to bind’ warnings in Flex 2. When you use a singleton in a binding expression, it’s typical to have the Console log flooded with warning messages indicating that binding to the instance property will not be able to detect updates. My singleton version fixes these warnings.
  • Use of const instead of var for the instance storage. This one is pretty obvious, but using const here communicates intent better. The variable storing the singleton instance is not allowed to change so const is the better choice.

August 12, 2010

Customizing ASDocs

Filed under: Uncategorized — Tags: , , — michaelangela @ 10:19 pm

Documentation is great. Writing it is not. Writing notes in code then pulling that into some sort of printed reference is even worse. But there are solutions. For Flash/Flex devs there are ASDoc comments. Now if you want to add your own little tweaks to it, it seems, at least in the past, this was possible.

ASDoc Enhancements | www.boristhebrave.com

I’ve put in a few customizations to the standard ASDoc template, that I’m going to share here, as they are generally useful. You will need to customize the files a bit for your own project, though.

F*CSS is more than just CSS for Flash

Filed under: Uncategorized — Tags: , , , , — michaelangela @ 4:25 pm

I had seen the author’s original writeup on Camouflage and that was already very cool. This goes beyond that and again just beyond CSS properties. The idea that any public property can be set via an external file and it’s not XML, that’s much cleaner. But even the idea of just changing positions, sizes, etc., in such a clean and fast way and with inheritance as well? Merging?! Very nice.

F*CSS |  About

F*CSS is a custom CSS parser for Flash based on the PropteryManagement System in Flash Camouflage. The main class called StyleSheet (found inside of the com.flashartofwar.fcss.stylesheets package), goes well beyond the native StyleSheet class by supporting style inheritance, pseudo selectors, and merging styles on the fly. The goal of the StyleSheet is to make styles something you can apply to any of your classes instead of just TextFields. CSS is a great way to define your class’s properties in an external file and F*CSS helps convert these css styles into property/value pairs you can apply to any Object.

Create a free website or blog at WordPress.com.