Always close your lines with a semi colon!
On September 23, 2008, Flex - No CommentsToday I encountered some strange behaviour when using the [ArrayElementType] tag. I had a piece of code which looked like this:
package { import mx.collections.ArrayCollection; [Bindable] public class MetaData { public var ac:ArrayCollection [ArrayElementType("nl.flexperiments.test.TestObject")] public var ac2:ArrayCollection; } } |
Every time I tried to compile, Flex Builder (2.01 that is) gave an ‘Internal Build Error’. The error disappeared when I removed the ArrayElementType metadata, so I thought there was something wrong in my class nl.flexperiments.test.TestObject, but couldn’t find anything. Then I found out that the problem was not the metatag, but the line preceding it. Because Actionscript isn’t really strict in closing your lines with a semi colon, you sometimes forget it. So did I (line 5 of the example isn’t properly closed).
It turns out that Flex Builder (2) can give some strange behavior when you don’t close your lines in combination with MetaData tags.
This evening, I tried to reproduce it with Flex Builder 3, but couldn’t, it’s a bug in the FB2.0.1 compiler.
Bottom line: always use a semi-colon to close your actionscript lines, it spares you a headache!
Leave a Reply