Singleton-esque, self-aware ‘Kind’ Classes

I recently started a project of converting an older flex app to an AIR app. This app has to scan through a bunch of files, and classify certain types of media based on the location and file extension. Then it saves a manifest of the media to an xml file that can be loaded (without scanning every time).

I started out with a Kind class (think CollectionEventKind) that had the types as strings… but then I had to figure out how to store the regular expressions to make them easily accessible… Then I remembered that while everyone just uses Strings, static const vars can be any class, including it’s own class. So I came up with this class that you can use constants, or locate a specific constant. Code after the fold.
Continue reading →

Launching Files from Adobe Air

So, this takes the long way around, and is not a good solution for mass-distributed applications, but if you’re lucky enough to have a managed environment that you can push installs down the pipe, this is a way to let your users launch files from AIR.

First, download Switchboard.

Second, add Switchboard to your libs.

Third, use this script:

private function openFile(f:File):void{
Client.init(super.applicationID);
var message:Message = new Message();
var script:String = "var runScript = function(fileName){\n" +
" var theFile = new File(fileName);\n" +
" if(!theFile.exists) return false;\n" +
" theFile.execute();\n" +
"}\n" +
"runScript(\"" + f.url.substr(7) + "\");";
message.body = script;
message.target = "bridge";
message.onError = function( msg: Message ) : void {
// put the error message into the result box
trace("Error: " + msg.body);
}

message.send();
status = “Opening ” + f.name;
Client.close();
}

This opens up bridge, then uses Bridge to run the “execute()” command that ExtendScript (or whatever they’re calling it) has available.

Now… while this is neither simple or elegant, it gets the job done. I’d rather use Merapi, but my app has to ship before Merapi can go stable.

Flex Code Jam – Now with ∞ more open source code.

The Flex Code Jam Google Code Project is officially LIVE!

I’ve added all of our source code to the repository, including the code from the Seattle 2007 Code Jam (which is unfortunately unfinished…).  We’re heading towards a 1.0 release for the Second Harvest food bank, then after 1.0 we’ll be abstracting some of the pieces, so that it can be a plug-n-play widget for any organization that wants to offer a slick location-based-search. (Though it WILL be tailored to non-profits)

The code is free to download and try out.  We don’t have documentation on how to set up the AMF-PHP yet, but it’s coming… it shouldn’t be too hard, however. We have 7 open tickets as of this post, so feel free to dig in and help us release 1.0.  If you work on one of the tickets, let me know… I’ll add you to the project as soon as you have code to commit.

flash.system.Capabilities

Ever need to know if you’re running in debug mode (programmatically)? What screen resolution the user is running?

flash.system.Capabilities has everything you need.

<mx:Canvas visible=”{Capabilities.isDebugger}” /> will give you a canvas that is only displayed when you are debugging. You can check the flash player version, check to see if audio is enabled, many other things that can really tailor your application to enhance the user experience.

Debugging AIR Drag and Drop

So… you thought you’d be cool and throw a break point on some DRAG_ENTER code, but after you’re done debugging, you’re left with a little floating icon on your desktop.

Debugging Drag and Drop

Never fear, you don’t have to restart your entire computer, open up Taskmanager and you’ll see an application called ‘Drag’. You can kill this application and the icon will disappear. If you don’t see this app, close Eclipse and find the process called ‘adl.exe’ and kill this process.

Restart averted, Yay!

BlazeDS + Flex – First Draft

Welcome SeaFlex’ers and other MXNA visitors. I haven’t gotten around to finishing up my article, but I’ve posted it on my BlazeDS + Flex page 

It’s really a draft right now, you’ll see strikeouts and everything.  Most of the content is in there, but I need to add a page or two about debugging the project, as getting an Ant-built project to debug properly in Flex can be a pain.  I’ll also be adding some info about how to debug your java code at the same time you are debugging your flex code.

Take a look, and feel free to leave comments.

BlazeDS + Flex, From a Java Newbie’s Perspective (Background)

I’ve recently committed to speaking at the Seattle Flex User Group meeting in Feb, and in preparation, I will be posting my ‘notes’ here. Hopefully I will be able to take you from knowing no java to being able to have a simple yet useful application working in BlazeDS. This application will utilize Java, Hibernate and MySQL to power the Resource Manager graph from ILOG Elixir. For Java newbies like myself, I can recommend the following reading materials (I recommend signing up for OReilly Safari):

**update** I’ve moved everything to a static page, view it here: BlazeDS + Flex
Continue reading →

Adding Build, Build Date, Revision and Revision Date in your Flex App

I have recently started branching my code out for multiple customers, and I needed an easy way for the Project Managers to be able to see more info about the deliverables, and be able to send that data back to me for bugfixes, feature requests, etc…

I’ve been using Ant for a while, it’s great for packaging up my Flash/AS2 applications, without including the .as, .fla, swd, etc.. files. And since so many java devs use SVN, I knew there had to be some sort of integration between the two. I eventually stumbled upon SVNANT, but was unable to get the 1.0.0 working on my machine. I found many references to 1.1.0, however, so I downloaded the source and compiled it (Thanks to Jeff at Alagad). This worked right away for me, so with the help of this post from Howard Scholtz, I was able to add in revsion #/time directly into the app without using svn keywords!

Code included after the break. Continue reading →

Accessing items created by a Repeater

So, I’ve got some components that will need to be updated by non-programmers, so in the interest of keeping things easy to understand for them, I’m using Repeaters when I need to create multiple items based on Data (rather than creating my own component that creates these items itself through the data, which would be much more efficient, and less vexing).

So, using Repeaters creates many issues you don’t usually come in contact with. Here are some of the things I’ve run into, and the workarounds.

  • Repeater.currentItem not available in the click handler
    • Same as with a list and an ItemRenderer, but because I just need a button, and nothing fancy, this is annoying. I got around this by setting the “data” property (FB won’t suggest data as a property, but it’s there!) to Repeater.currentItem.
  • Repeater isn’t on the display list, and doesn’t have an array of ‘children’, so it’s hard to get at the items that were created.
    • A mysterious feature of Repeaters is that if you set the id of the items created, AS3 will see an array based on that ID
      This means that if I use <Button id=”buttonArray” /> I will be able to do a “for each(b:Button in buttonArray)” loop to get access to those buttons. This works just like the groupName property of RadioButtons.
  • Button property ‘selectedField’ only gets the state, and does not set the data’s value when ‘selected’ is changed.
    • I’m not sure how I feel about this. Part of me expects that when the button changes to ‘selected’, the data’s field should be changed too. Then the pedantic, MVC Loving part of me kicks in and wants to strangle anyone who lets the interface directly change the model… so I end up half-strangled and completely exhausted.

Null Exceptions silently fail in data bindings.

So, I’m sure it’s necessary, as bindings can happen at strange times, but null exceptions fail silently and can cause lots of debugging headaches when dealing with Data Bindings.

For me, I had forgotten to set an initialize value, so I was attempting to reach object.value, but object was null. Normally this throws an error, a quick and easy fix, but when this happens during Data Binding, no error, so you’re left scratching your head wondering why the hell your function is finishing on the 2nd line of code.

4 hours later, you look up and see that you forgot to initialize the var.

what is term life insurance
taxes on life insurance
global life insurance
new york life insurance
Banlieue 13 Watch Online
universal life insurance company
types of life insurance
evergreen life insurance
life insurance on business
discount term life insurance
Be Kind Rewind Watch Online
limited pay life insurance
life insurance with no medical
connecticut general life insurance co
allstate life insurance
london life insurance edmonton alberta canada
Balls of Fury Watch Online
metropolitan life insurance co
free life insurance quote
canada life insurance
life insurance secrets
decreasing life insurance
life investors insurance
insurer disclaims life insurance coverage
hartford life insurance company
level term life insurance
life insurance over 50
life insurance without medical exam
life insurance coverage denied
protective life health insurance
gauranteed life insurance
life insurance on business taxes
texas life insurance company
bankers life insurance
skandia life insurance
Boy A Watch Online
sun life insurance company
northwestern mutual life insurance
life insurance dividends cash value
what is universal life insurance
american family life insurance
mutual life insurance companies
aviva life insurance
standard life insurance company
nationwide life insurance
split dollar life insurance
Bangkok Dangerous Watch Online
aids life insurance
Backdraft Watch Online
aarp term life insurance
mega life and health insurance company
life insurance training school bellevue washington
dividend insurance life whole
sue life insurance company
Airplane! Watch Online
globe life insurance service center
best life insurance
A Few Good Men Download
Battle of the Bulge Watch Online
first to die life insurance
second to die life insurance
pet insurance for life
life insurance statistics
term life insurance no medical exam
A Nightmare on Elm Street Download
A Beautiful Mind Download
life insurance company failures
sterling life insurance
life insurance no exam
nys life insurance guarantee corp
denied life insurance
federal employees group life insurance
home auto life business insurance
american general life insurance credit rating
monumental life insurance company
valley forge life insurance
life insurance cost
metropolitan life insurance
life insurance whole life
american general life insurance danville va
gulf life insurance
life insurance renewal training in connecticut
Behind Enemy Lines Watch Online
what is life insurance
reliastar life insurance company
life insurance company ratings
life insurance trust
pacific life insurance company
life insurance agents
stonebridge life insurance
ranking of life insurance companies
unison life insurance
whole life insurance quotes
life insurance ads
valley forge life insurance company
washington state life insurance renewal
central united life insurance company
financial american life insurance company
Big Trouble in Little China Watch Online
american general life insurance company
Body Heat Watch Online
life insurance denial lawsuit
american life insurance
life insurance courses
define term life insurance
hartford life insurance employee
life insurance basics
great american life insurance company
national life insurance richland hills tx
Blood Diamond Watch Online
zurich life insurance
veterans group life insurance
midland mutual life insurance
principle life insurance
whole of life insurance
cheap life insurance
tracking life insurance policies
Beautiful Girls Watch Online
isaiah life insurance
beneficial life insurance
life insurance commissions
life insurance quote
term life insurance company
Blade Runner Watch Online
connecticut life insurance renewal classes
whole life insurance quote
mortgage life insurance
compare life insurance
life insurance law
investment grade indexed universal life insurance
t-d n-s life insurance rating
online life insurance quotes
A History of Violence Download
term life insurance website
life insurance no medical exam
life insurance and irrevocable trusts
Blue Thunder Watch Online
life insurance policy in san francisco
pruco life insurance
american general life insurance
gerber life insurance
Blue Streak Watch Online
connecticut life insurance renewal of license
guardian life insurance
american general life insurance co
phoenix life insurance
life insurance settlement
new york life insurance company
life insurance for teenren
life insurance term
principal mutual life insurance
homesteaders life insurance
aviva life insurance 2009 complaints
ing life insurance and annuity company
kansas city life insurance company
life insurance license renewal in connecticut
instant term life insurance
cheap term life insurance
protective life insurance co
american travelers life insurance
lincoln life insurance company
western southern life insurance
whole life insurance policy
life insurance claim
kotak life insurance
branch offices of london life insurance
life insurance coverage
genworth life insurance company
life insurance sales leads
no medical exam life insurance
Black Hawk Down Watch Online
allianz life insurance
american life insurance company
guaranteed acceptance life insurance
reliance standard life insurance
combined life insurance
term life insurance quotes
life insurance corporation
great american life insurance
history of life insurance
life insurance coverage attorneys
globe life insurance
how does life insurance work
A Knights Tale Download
low cost life insurance
term life insurance
cash value life insurance
georgia allstate life insurance
life insurance calendar system
life insurance coverage lawyers
survivorship life insurance
life insurance in wales
principal life insurance
mega life and health insurance
over 50s life insurance
life insurance devide
southland life insurance company
life insurance scam dacey
transamerica life insurance co
veterans life insurance
taylor v national life insurance co
bankers casualty and life insurance
life insurance residual income
life insurance quotes
lost life insurance policy
top life insurance companies
ratings hartford life insurance company
life insurance claim rejected
term life insurance rates
Batman Watch Online
federal employee life insurance plans
american international life insurance
dai-ichi life insurance advertising
life insurance comparisons
john hancock life insurance company
safeco life insurance headquarters seattle wa
dispute life insurance claim
printed life insurance ads
monumental life insurance
crump life insurance
surety life insurance company
joint whole life insurance
life insurance ratings
columbus ohio life insurance companies
shenandoah life insurance
liberty national life insurance company
Black Rain Watch Online
presential life insurance co
Blue Velvet Watch Online
cancelling life insurance
empire life insurance homepage
life insurance for over 50s
genworth life insurance fixed annuity
life insurance comparison
aig life insurance
group universal life insurance
integon life insurance
liberty life insurance
allstate life insurance company
life insurance dispute litigation
west coast life insurance company
midland national life insurance
Baraka Watch Online
Battle of Britain Watch Online
mass mutual life insurance
level term life insurance quotes
selling life insurance
government federal employee life insurance
jackson life insurance
indexed universal life insurance
Big Daddy Watch Online
the paul revere life insurance
no medical life insurance
life insurance company of north america
vermont life insurance
term life insurance quote
liberty national life insurance
lafayette life insurance company
life insurance taxable
life insurance malaysia
life insurance lawsuit
life insurance ads
high risk life insurance
dai-ichi life insurance
dispute life insurance claim denial
met life insurance
life insurance types
life term insurance
sun life insurance
advertising life insurance in japan
aetna life insurance
cheap life insurance 55
get cash for life insurance
wife as beneficiary of life insurance
national life insurance company
peoples benefit life insurance
globe life insurance quote
penn mutual life insurance
country life insurance company
irrevocable life insurance trust
term life insurance rate
ninja life insurance
aaa life insurance company
life insurance premium financing
unclaimed life insurance
shenandoah life insurance company
life insurance scam williams
variable life insurance
over 50 life insurance
A Time to Kill Watch Online
met life auto insurance
guardian life insurance company
globe life and accident insurance company
western southern life insurance company
life insurance calculator
united of omaha life insurance
reassure america life insurance company
Being There Watch Online
instant term life insurance quote
farmers mutual life insurance
split-dollar life insurance
life insurance texas
prime america life insurance
gleaner life insurance
insurance life insurance
liberty life insurance company
protective life insurance company
lincoln national life insurance company
Amadeus Watch Online
stonebridge life insurance company
uk life insurance
life insurance online
denied life insurance claim attorney
florida life insurance
franklin life insurance
Alpha Dog Watch Online
life insurance leads
life insurance rates
american investors life insurance company
life insurance companies
american health and life insurance company
life insurance claims lawyer
american heritage life insurance company
pan american life insurance co
metropolitan life insurance company
agent payout for life insurance
first colony life insurance
Back to School Watch Online
Batman Forever Watch Online
denied life insurance policy
life insurance health screening
insurance life mortgage online quote
savings bank life insurance
whole life insurance explained
what is whole life insurance
credit life insurance
california life insurance
northwestern mutual life insurance havre montana
cash value on life insurance policies
american fidelity life insurance company
fidelity life insurance companies
connecticut general life insurance
life insurance policy
co-operators life insurance
philadelphia united life insurance company
insurer rejected life insurance claim
Babylon A.D. Watch Online
pennsylvania life insurance
Batman Returns Watch Online
loans against whole life insurance
international life insurance co
american income life insurance company
Babel Watch Online
mega life insurance
creditors and life insurance
conseco life insurance
american heritage life insurance co
transamerica life insurance
national benefit life insurance company
amex life insurance co
mutual of omaha life insurance
public domain life insurance by name
riversource life insurance
life insurance au
homesteaders life insurance
colonial life insurance
scottish widows life insurance
morgage life insurance
instant life insurance
met life insurance company
sign on to globe life insurance
lincoln life insurance
Bobby Watch Online
life accident insurance
life insurance confirmation
life insurance bring back rule
nippon life insurance
who has received life insurance payouts
standard life insurance
american income life insurance
unum life insurance
reliastar life insurance
no exam life insurance
life insurance brokers
life insurance company
cuna mutual life insurance
life insurance no medical
rio grande national life insurance
Beowulf Watch Online
Across the Universe Watch Online
aetna life insurance company
midwestern united life insurance company
reverse life insurance
banner life insurance
fep life insurance program
empire life insurance homepage overland kansas
hartford life insurance
west coast life insurance
ohio national life insurance
Bolt Watch Online
life insurance corporation of india
london life insurance company edmonton branch
colonial penn life insurance
life insurance with no physical exams
affordable life insurance
national service life insurance
mississippi life insurance exam test
failure to pay life insurance