Archive

Posts Tagged ‘Flex Builder’

Success! Fixing the ja_JP locale from being set in compiler arguments

January 26th, 2009 Gareth No comments

Ha ha! I figured out (after just blogging my frustration in my previous post) how to change the Additional compiler arguments that automatically are added when creating a new project from ja_JP to en_US.

There is a file called config.xml (on my PC it is located in C:\Program Files\Adobe\Flex Builder 3 Plug-in\eclipse\plugins\com.adobe.flexbuilder.flex_3.0.214193) that gets installed when updating via the Adobe updater. I’m not quite sure what happened, but it decided that my compiler arguments should be set to ja_JP. In order to fix this problem, just change this line from

<locale>ja_JP</locale>

to

<locale>en_US</locale>

This will now add en_US as an additional compiler argument instead of ja_JP. Now I can get back to coding again :)

Why is locale set to ja_JP?

January 26th, 2009 Gareth 2 comments

This is annoying the heck out of me. For some reason, I’m not sure when, my locale got set to ja_JP instead of en_US I did the update in eclipse and I’m wondering if it somehow got the japanese version of the SDK instead of the US version.

Each time I create a new project I get -locale ja_JP added to the compiler arguments. It’s an easy fix, just remove that or change it to en_US, but I have to do that each time I create a new project. If I could even find the file that’s making that setting, I would be happy to manually alter it, but I haven’t even been able to find that. My flex-config.xml file appears to be set to en_US also, so I have no clue how ja_JP is getting in there.

If anyone has any ideas, I’d be extremely grateful.

Remove View Source From Context Menu

December 14th, 2008 Gareth 1 comment

I had decided to create a demo application for my Flex Date Utils library. I thought it might be nice for people to just be able to see exactly what the library can do without having to download it and compile it. Right now it is just for the DateUtils portion of the library, but I’ll be adding Holiday and BusinessDay to the mix soon.

In order to make what I did more visible, I decided to enable the source code view when exporting the release build of the project. After exporting the file and FTP’ing it to the server, I started to have some difficulties getting the source code view working properly. Rather than wasting more time trying to get it working, I decided to just uncheck the Enable View Source check box, and re-export the project. However, when I went to my swf and right clicked on it, “View Source” was still an option in the Context Menu. I went back and tried cleaning my project, re-exporting it, deleting the swf and recreating the project. Nothing seemed to be working.

I then figured I would try creating a new project and placing it under there. As I was pasting the new application file, I noticed one new line had been added to my file
viewSourceURL=”srcview/index.html”

Apparently when the compiler enabled “View Source”, it adds this line of code. However, when it re-compiles the code with “View Source” disabled, it does not remove that attribute from the application tag. 30 minutes and lots of yelling later, this has now fixed the problem. It would be nice if Adobe included this little tidbit in their livedocs as “make sure to check this”.

The demo app can be viewed here for anyone interested.

Debug vs. Release Build

December 6th, 2008 Gareth No comments

Last week I ran into an issue (or so I thought) with my debugger. I was trying to debug some code on my local machine, but for some reason, the debugger in Flex Builder could not seem to find the SWF that was being built. I would click debug, a new window would open, but nothing happened in my Flex Builder to indicate that it had reached a breakpoint. After playing around with it for a little while, I decided to close out of Flex Builder and reopen it, in hopes that *something* would happen that would indicate why nothing was happening. After restart, and trying to run the debug again, Flex Builder decided to actually let me know what was happening.

In my work environment, my exported release builds and my debug builds are both built to the same spot, which is due to our upgrade process to Flex being an incremental process (from our current HTML + CFM app). In order to add some values to the Flex app, I write them to the HTML page, thus I decided to build them to the same spot. I had not realized at the time that I had exported a release build right before lunch, then when I returned, I was trying to debug the release build. Due to the very nature of the release build, the debug is removed, thus Flex Builder was not able to stop at the breakpoints. For some reason, Flex Builder wasn’t telling me this initially though (even after I had cleaned the project).

My steps to fixing most Flex weirdness (i.e. something isn’t happening that I feel should be happening), is to clean a project first, then restart Flex Builder, if neither of those work, restarting my PC is next. One of those will usually fix the problem :) .

Enable line numbers in CFEclipse

December 1st, 2008 Gareth 2 comments

Don’t know how many people this affects, but it’s been annoying me for a while.
When using CFEclipse in Flex Builder/viewing ColdFusion files, line numbers do not show up in the gutter, no matter how many times (or places) that you select “Show Line Numbers”.

In order to fix this, close out of Flex Builder or Eclipse and go to wherever you have Flex Builder preferences installed (which for me was in my “My Documents” on my C: drive), not the main Program Files directory.

This was where mine was located C:\Documents and Settings\(my logged in account)\My Documents\Flex Builder 3\.metadata\.plugins\org.eclipse.core.runtime\.settings

Once you are in this directory, back up then open up
org.cfeclipse.cfml.prefs

Once inside this, add the line
lineNumberRuler=true
and save the file

Now you can open Flex Builder/Eclipse again, and line numbers should be showing up for you when view ColdFusion files.

Just want to thank Francois Levesque over at http://blog.critical-web.com/blog for this.  This has saved me many headaches.

Regular Expressions in Flex Builder

April 15th, 2008 Gareth 2 comments

Up until a couple of months ago, I had not really used the regular expression Find/Replace in Eclipse. I’d read several blog posts about it, but hadn’t really played around with it much. This all changed after I was, once again, manually replacing some items in Eclipse (setting multiple properties of an object to those of an item that had been passed in to the function). About halfway through, I figured I would try using regular expressions to automate the task a bit. From this point on, just about every find/replace I did was using a regular expression.

All of these examples are for ActionScript, by the way, but could easily be converted to be useful in any other programming language:

For example: (Make sure to remove the double quotes from these examples also.)

I prefer curly braces in my functions to be on the same line as the actual function definition rather than on the next line so I wrote this

Find: "\s+\{"
Replace: " {"

This will take something like:

function testing():void
{

and change it to

function testing():void {

Not a huge deal to most, but my code OCD :) and our in-house coding standards like it on the same line. If I don’t have to manually do this, it certainly makes things easier.

Now this isn’t that complex and in most other IDE’s could be handled pretty easily. However, try doing something like this next example without using some kind of regular expression :)

(This example is pretty long, so make sure to remove the carriage return before the “return this” statement when pasting into your Replace field)

Find: "public var (\w+):( )?(\w+)( ?= ?[^;]+)?;(([^\t])+(\t)(\t+)?(\s+)?)"
Replace: "private var _$1:$3$4;$5$5public function get $1():$3 {$5$7
return this._$1;$5}$5$5 public function set $1( value:$3 ):void {$5$7this._$1 = value;$5}$5$5"

This example will take something like:

public var companyId:uint;
public var companyName:String = "";
public var isLegit:Boolean = false;

Will be converted to multiple accessors (i.e.setters and getters). I won’t show all 3, but this is what the first one would be converted to:

private var _companyId:uint;
 
public function get companyId():uint {
    return this._companyId;
}
 
public function set companyId( value:uint ):void {
    this._companyId = value;
}

That has saved me so much coding time.

Anyway, I wish I had started using these earlier as I’m now setting up a nice little library of scripts that I can run whenever I need to modify my code. I’m sure someone has set up a site with a library of these things, but these are just a few that I’ve set up.

And one very important thing to remember with these:

Make sure to check the Regular Expressions checkbox in Find/Replace or it will probably never find anything :)