Binding in Flex via Actionscript

Here’s an example I created to bind a text field with a label. This needs to be done with you are dynamically creating components inside of your app instead of using MXML. Be sure to use the if statement on the unwatch function to avoid an error for null pointing.

private var watcher:ChangeWatcher;

private function watch():void {
var SampleLabel:Label = new Label();
SampleHBox.addChild(SampleLabel);
watcher = BindingUtils.bindProperty(SampleLabel,"text", sampleText,"text");
}

private function unwatch():void {
if (watcher != null) {
watcher.unwatch();
}
}

Automatic Logger via Trace for Flex

Here’s a great tool to help with Flex debugging. Put <mx:TraceTarget /> into your code and run your app in debugging mode.

You will see valuable debugging information appear in the console area. Great for hassling with remoting like ColdFusion CFC’s.

Form more info: Adobe Flex 3 Language Reference TraceTarget

Flex Project Not Saving Project Properties

I have a Flex project that I copied in from another source to work on. I changed around some output properties and library paths via the Properties context menu for the project. The changes would hold while Flex was open, but it would never update the .actionScriptProperties file, thus when Eclipse was restarted, the changed would revert.

After doing a little bit of Googling on the issue and not finding much help I ended up making a backup copy of the folder, deleting the folder, and importing the files into the new folder via Flex Builder. This fixed the issue. Not sure what caused this, but it works now.

 

Tag Insight Not Working for CFEclipse Beta

I am using CFEclipse 1.3.2beta with Eclipse SDK version 3.3.2 with Aptana. The tag insight (tag completion) feature was not working. After a little research I found that if you right click on the project and select Add/Remove CFE Nature, tag insight will start working again.

Now if only it would add automatic slashes at the end of self-closing tags and give me standard tag property option insight life would be great. I miss you Dreamweaver!

 

Font Annoyance

Issue:
While doing a little copying/pasting with some modifications of ColdFusion pages with HTML output, I could not figure out what was causing my fonts to go all screwy. The font for that page was showing up almost twice as big than what it was supposed to be! This issue was found in Internet Explorer 7, while FireFox 3 was showing properly, making it all that more difficult to diagnose.

Resolution:
I was including a ColdFusion page as an event handler before anything else, including the pages head section. What I found was a “<!— blah —>” being inserted as the first thing in the HTML code. Using the process of elimination, I silenced the output and TA-DA!

Conclusion:
Don’t put HTML comments before the head section!