Skip to content


Conditional Statements inside Flex Binding

I was adding some extra functionality to my application and ran across an issue that took me a little while to figure out. Once I figured out the fix I thought I would share this with everyone.

Here is my mx:Button inside my application

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<mx:Button 
	height="15"
	id="cropMode"
	includeInLayout="{(maskedImage)? true:false}"
	selected="{imageBoundingBox != null}"
	styleName="btnCropImageMode"
	toggle="true"
	toolTip="Crop Image"
	width="21"
	x="547"
	y="24"
	click="onModeClick(event)"
	tabEnabled="false"
	visible="{(maskedImage)? true:false}"
	/>

Notice the binding on the selected attribute of the button. It has a conditional statement in it, but what if you want to add more conditional statements to a binding element, what do you do?

Well here is the fix. All you have to do is replace the normal && signs with the html version. So it would look like this.

1
selected="{(imageBoundingBox != null) &amp;&amp; (boundingBox.visible == false)}

Notice the html code that is in between the conditional statements. I tried to use <![CDATA[]]> but that didn’t work. So the only fix was to put the html code in there and it worked like a charm.

I hope this saves someone some time.

T

Share and Enjoy:
  • Facebook
  • Twitter
  • del.icio.us
  • Google Bookmarks

Posted in Flex.

Tagged with , , , , , .


Automator Scripts for Hide/Show Hidden Files, Mac

Here are two Automator scripts that I had written a couple of weeks ago for my mac. I have to turn on and off hidden files often at work so I decided this would be a lot easier then opening the terminal window all the time and typing the commands in. Now all you have to do is double click the icon and your Finder will refresh and you hidden files will be shown or hidden.

Let me know if these helped you out.

Todd

Share and Enjoy:
  • Facebook
  • Twitter
  • del.icio.us
  • Google Bookmarks

Posted in Postings.

Tagged with , , , , , .


Flex ComboBox Issues

So today I am working on a few bugs within our application that concerns the mx.controls.ComboBox.

So the problem is that we are loading a list of font names into a combo box for a user to select. We then pass the name of the font to a FontManager (that we have created) that loads the fonts and dispatches a Complete event when it is loaded. We also have a few other custom events that are being dispatched like FONT_READY, and FONT_ERROR. When we compile the app the user can select the combo box then pick a font and the font loads just fine, but if the user starts using the arrow keys to navigate through the combo box really fast, the fonts do not load and if they do, they usually are messed up.

I traced out everything and it was saying the fonts were loaded and the text was displayed, but it wasn’t. I tried loading the two previous fonts to no avail; it always seemed like it was a timing issue. No matter what I did, the user could always move through the list using the arrow keys too fast for the font to load.

So I thought I would just do a fontSelector.enable = false; until the font is ready and then do a fontSelector.enable = true;, (fontSelector being my ComboBox), but this did not work since it still thought the font was being loaded and the user still could cycle through the list regardless. So the issue remains. I even tried to go deeper into a few Adobe classes but that is way to much for this fix and would mess up some other comboBoxes we are using.

So the solution I came up with is to setFocus to something else on the stage. I have a Color Picker on the stage as well, so when the user picks a font, it sets the focus to the ColorPicker colorPicker.setFocus();. Then when the font was ready, I set the focus back on the fontSelector, fontSelector.setFocus();. This seems to solve the issue, and the user still is able to use the arrow keys and move through the ComboBox, but this time the font has time to load and display properly before it lands on the next font in the list.

Now this may be a hack in some peoples eyes, but it works and I could not come up with anything else. If you know of another way to slow down the user’s comboBox selection, please comment here and let me know. If not, I hope this helps someone.

T

Share and Enjoy:
  • Facebook
  • Twitter
  • del.icio.us
  • Google Bookmarks

Posted in Flex.

Tagged with , , , , , .


New Position

I started my new position and now my official title is Application Developer. I’m working in the Flex framework and loving every minute of it, and glad to be back doing Flex. It has been a long time since I worked in the Flex environment and now I get to polish my skills. 

Now that I’m back in Flex I’m going to start working on an AIR app for the Android phone. I think this will be a great excuse for me to start posting tutorials again and also start blogging a little more then I have been.

Also I’m trying out a new posting extension inside of Google Chrome and this seems pretty nice. Let’s hope it works.

Share and Enjoy:
  • Facebook
  • Twitter
  • del.icio.us
  • Google Bookmarks

Posted in Uncategorized.


New Chapter

I took a position at a new company this week and so far it has been a good experience. There were several reasons I took the job but one of the biggest is the fact that I will be working on a massive application and not smaller ones. I wanted to learn the skills for this type of development, as well as some new design patterns.

I am still going to be doing interactive work but mostly freelance stuff. I want to start posting some of my learning’s here so you all can gain the knowledge I am.

Until next time.

Todd

Share and Enjoy:
  • Facebook
  • Twitter
  • del.icio.us
  • Google Bookmarks

Posted in Postings.