A friend of mine was getting an error in FlexBuilder that, quite frankly, didn't make any sense. Here's the rundown of how we fixed it.
Friend: Would you happen to have any idea why when i include 'import flash.external.ExternalInterface;' i can't use it, like 'ExternalInterface.available' gives me 'Access of possibly undefined property available through a reference with static type Class.'
Me: hmm, smells fishy.
Friend: yeah i'm thinking something is hosed with my fbuilder or something
Me: I wonder if it's one of the .swc library files, like playerglobal.swc, in the framework lib directory
Me: Have you installed something that might've overwritten that, like apollo?
Friend: yeah, apollo
Me: maybe it just got overwritten by a bad version then, check to see when it was last modified
Friend: i don't think that's it, same date as the others
Me: hmm, ok, nevermind then
Friend: when I i do ExternalInterface. something
Friend: nothing comes up
Me: are you sure its the EI class that the error is coming from?
Me: and not a different compiler error?
Me: sometimes that happens when you have a syntax error in the file
Friend: oo maybe
Me: like, FB can't process the code hints because of a previous error (previous meaning in time, not necessarily earlier in the file)
Friend: let me try something
Me: if you're not getting code hints, check to make sure you have matching {}'s, ()'s, etc.
Friend: that's it, it works now
Me: I'm going to blog this quickly :-)
Friend: haha, i work with this clown that can't write code that compiles and asks me why it doesn't work
Me: nah, I won't mention you by name, unless you want me too.. haha
Friend: oo the problem was that my project was named ExternalInterface as well
Moral of the story: I have multiple personalities, and I'm really just talking to myself. Wait.. no....
Moral of the story: If you ping me on IM be aware that I just might make an example of you on my weblog! Wait.. that's not it either!
Real moral of the story: Sometimes the error you're getting from FlexBuilder is misleading. If all of a sudden something stops working such as code hints, or you get an error message that just doesn't make sense, check to make sure the rest of the file has correct syntax. Sometimes there are situations where FlexBuilder erroneously reports one error when it should've reported something else.
Also, check to make sure that you don't have an mxml file with the same name as another class you're trying to use. Remember, all mxml files are compiled into ActionScript 3.0 classes behind the scenes. You might have to use a fully-qualified name for a class if you have a conflicting mxml file that shares the same name. For example, use flash.external.ExternalInterface.available if you already have an ExternalInterface.mxml file.
These types of errors don't happen often, but when they do hopefully the above information will help you to fix them!

Leave a comment