Recently while piddling around in the day-to-day tasks I handle here at DecisionLens I was deep within the List class when I came across something I had never seen before – a SandboxMouseEvent [gasp]. Upon seeing all the wonderous events I could listen to I thought- this is amazing! I can listen for all kinds of stuff happening outside of my sandboxed flash window! So I whipped together a little demo to see what this magical new event could do… [Click Here for Source]:
As you can see, not performing as advertised! It seems the only even it captures is MouseUpSomwhere, and that fires when you roll out of the window? Very weird. I thought maybe it was an issue with being trapped in a browser window, so I threw the same code into an AIR application, and same thing- only event fired was MouseUpSomewhere. I don’t know if this is a bug (seems to be since mouseUp isn’t really occuring, its more of a RollOverSomewhere), or I’m just misunderstanding the functionality of this event, but in either case, it was certainly a letdown to see I was still pretty much trapped within my tiny SWF prison.
In a recent project of mine I had the need for a vertical resize cursor. Flex has a very nice vertical resize cursor already packaged along with the VDividedBox. There is a similar horizontal resize cursor for the HDividedBox. After some googling and a little sample project, I found out how to access the cursor assets of these components for independent use without an H or V DividedBox. Simply use the embed from below along with a CursorManager.setCursor() call and you’ve got pretty native horizontal and vertical resize cursors!
Ran across an interesting problem last night that had me almost tearing my hair out, so I though I’d share to save others the pain. I have a fully licensed version of both Flex 3 Professional and Flash Builder 4 Professional on my machine. When compiling an old Flex 3 project which uses the “Data Visualization” components it suddenly had this ugly watermark on it!
For those of you who don’t know, this is the watermark shown when you are using beta or trial versions of the IDE with the DV components. Anyway, I had to get rid of this stupid watermark so I decided to do some googling. I applied the fixes outlined in this article to flex-config.xml and license.properties but the watermark was still showing! It was driving me crazy, literally. You know what the problem was? Flash Builder 4. Take a look at the license.properties file (located in C:\ProgramData\Adobe\Flex on Win7 machines) and you will see that it contains license information for both Flex Builder 3 and for Flash Builder 4. In order to remove the watermark when compiling the DV components through Flex 3 on a machine with Flash Builder 4 also installed, you must edit the license.properties file and remove all references to Flash Builder 4.
After you have corrected the file, compile the app that uses the DV components [in Flex3] and voila! No watermark. Keep in mind that every time you launch Flash Builder 4 it will re-insert its license information into the license.properties file, thereby restoring the watermark in your future Flex 3 compilations unless you edit the license.properties file again. Hope this helps some people!
Using the Flex 3 logging API is not really cut and dry. It is made to be rather extensible and flexible but at the same time it manages to be completely painful and hard to understand. The Log, ILogger, LogLogger, TraceTarget, LogEvent and LogEvent level classes and be rather cumbersome.
An example of a straight up ‘log write’ would be:
var mylog:ILogger = Log.getLogger("my.package.MyClassName");
if(Log.isDebug()){
mylog.debug("Hello from the logger");
}
This would get you [DEBUG] level output with the message “Hello from the logger”. The problem with this approach is that I wanted to be able to log from any class, without having to create ILogger instances in all classes. I also wanted the logging to be dynamic so I could hide the class package if I wanted, I also wanted the LogEvents to carry all the information that the actual ‘log write’ contained.
So I created CustomLogger and CustomLogEvent classes that are built on the pre-existing logging API. This simple goal of these classes is to make logging easier. Now you can directly call:
CustomLogger.debug("Hello from the custom_logger");
or you can access it with a Singleton instance:
varlog:CustomLogger = CustomLogger.getInstance();
log.debug("Hello from the custom_logger");
So thats all good and well but how does this make things easier? By using the CustomLogger you now have FULL control over the log messages as opposed to handing them off to a Flex ILogger/LogLogger and letting it do what it will with the log messages. Also, you do not need to instantiate a new ILogger for every class that wants to write log output. Additionally the expanded CustomLogEvent class gives whatever is listening the full rundown on what is happening in terms of logging as opposed to just a glimpse.
Here is an example that shows how useful the new CustomLogger/CustomLogEvent classes are especially when it comes to directing log output to a different target (in this case, a List component).
Been a while since a tech-related post so I thought I’d stop by and drop a new one in the box. Recently at work there was a need for tooltip-based text and combobox components for our latest Flex project. Although flex provides some pretty solid tooltip support for Labels, their implementation on other components is a little weak. I took the time to extend the base Flex components to allow Text and ComboBoxes to have some enhanced tooltip support, check out the result below. If people need these I’d be happy to share, just post in the comments.
Life has been a little crazy balancing taking so many credit hours [20], wrapping up my final quarter at RIT, my day job, TCBN, and keeping my blog up to date but its almost 1am and I finally have time to post!
I found these pretty cool “load test” flash movies [a while ago] that serve as an awesome example of how much more efficient actionscript 3 is over actionscript 2. I am currently a huge AS2 junkie, but with my recent coursework in Flex and current project in AS3 based flash, I am getting more and more fond of it. There are some differences from AS2, don’t expect a point and click transition from one version of actionscript to the other. If you are familiar with object-oriented design in AS2 the move is nearly painless (off the top of my head: Document class, event handlers, and * var type [yes, *]).
Flash is here to stay, and it’s good to see that the language that powers it is maturing as well.
* Only run one load test at a time for accurate results