I get this compiler error all the freaking time on a large scale application whenever I use Vector.<*> as a return type on a function inside a Flex 4 Library project, and attempt to use that function in the main Flex 4 project. Vector.<Object> dosen't work here as a return type as I get cast conversion errors. Only thing that seems to work at all is just *, but then that bypasses vector type checking during compile time which also ins't ideal. Oh well, another problem due to the half baked implementation of vector's by the player team. It's really frustrating not being able to write generic list functions, work with vector interfaces, and in generally write any sort of re-suable code using vectors with out just putting *'s everywhere and praying. Isn't this the whole point of vectors was for type-safety? I wish Adobe would take a few clues from c# already.
Damn, this problem is bothering me since years but finally I found at least a note about it here. Within my private library I have a VectorUtil class which does some tasks like removing all items or only push one item if it's not already in the vector instance.
public static function lengthMax( vector : Vector.<*>, length : uint ) : Vector.<*>
while ( length < vector.length )
Usually it works as expectet but sometimes I get weird compile time errors, then I need to clean the flex compiler an recompile everything.
But now I need to provide a precompiled SWC to other developers but compiling separate projects doesn't work at all. Since using Vector.<Object> results in different type casting errors I hopefully will fix this by not typing vector at all. But that is definitely annoying! It would be really great if somebody could check the Vector implementation...