Compiling a Stock Flex Component.

I work a lot with MXML, but even I still think there’s a little bit of chicanery going on when it comes to getting it to play nice with the other kids. Due to all the various problems that normal TextFields have with image support (via htmlText), at work I decided to replace the stock Rich Text Editor with a custom-built version that uses an estended TextArea instead of the stock TextArea. Because the extended TextArea is literally an extension of TextArea, I hoped I’d be able to just grab the source for the RTE, copy it into my source tree, fix the package, and swap out any references for the mx:TextArea with my own. So that’s what I did… only for some reason I decided to test this as a standalone instead of trying to immediately integrate it with our other code. The new RTE file compiled with no complaints, but whenever I ran it I wold get a Run Time Error (the OTHER RTE):

TypeError: Error #1006: getInstance is not a function…

Figuring that there was some sort of reference to something internal, I started pulling code out. A lot of code out. Eventually I stripped out all of the Meta, all of the Script code, and was left with pure MXML… with anything not core (i.e. function calls) also dumped. It still wouldn’t work. Eventually I had it stripped to the following, and that’s when the “DUH” gods struck:

Of course it should throw an error–I hadn’t wrapped my Panel in any sort of application. I reverted back to the stock Adobe code, made another mxml file with an application in it to load the hacked-RTE, and it worked like a charm the first time out. Because I went into the conversion thinking it would take some nudging to work, I missed my own silly error.

I guess it could be worse, though–it’s not like I have to write my own RTE component from scratch.

del.icio.us:Compiling a Stock Flex Component. digg:Compiling a Stock Flex Component. newsvine:Compiling a Stock Flex Component. fark:Compiling a Stock Flex Component. Y!:Compiling a Stock Flex Component.

Leave a Reply