Refactoring ActionScript #1
Refactoring isn’t easy. In fact, it’s one of the most difficult things you can attempt – either in Visual Studio or any other IDE. I was quite amused to come across this cry of pain from one of the FlexBuilder developers about an irate e-mail from a user querying the lack of refactoring in FlexBuilder:
“I was heads down working on the code for reference detection (base technology for refactoring) and I had just broken everything. I was staring at my code, trying to figure out what on earth I could have done and then up pops this e-mail. Honestly, if it were that easy, if all I had to do was flip a bit to make refactoring magically work, I would have been on a beach in Mexico getting a tan. And believe me, I’d love to be on vacation.”
Believe, me I have every sympathy!
But, after a good bit of pushing and shoving (and the odd cry of pain), we’ve now got the base ‘reference detection’ working in Amethyst. This goes by the name of Find All References in Visual Studio. And having got it working smoothly, I have to say it’s pretty damn cool!
Here’s how you select it (note the Refactor menu item at the top – I’ll have more to say about that next week):
and here’s the results :
It even works in MXML - here I’m doing a Find All References on the moveTo event. All references - the ActionScript definition and any references in the MXML code.
And here’s result for the TextArea variable ta:
I have to say that I don’t know how I managed without Find All References  before: it is just soo useful! Now about that holiday in Mexico ...
 there’s a minor error in the the line numbering in this version - it’s one out if you look carefully
 This will be in Amethyst Professional Edition only