You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Maurice Amsellem <ma...@systar.com> on 2013/10/12 02:23:10 UTC

Vector.map

Hi,

I know this is not Flex but Flash Player, but did someone already manage to use Vector.map() method ?

According to Adobe documentation

http://help.adobe.com/fr_FR/FlashPlatform/reference/actionscript/3/Vector.html#map()

function myFunction(item:Object, index:int, vector:Vector.<T>):T {
        // your code here
     }

The mapping function returns the same type as the original Vector type!

So this is totally useless, as map() main purpose is to turn elements of the vector into other elements, supposedly of a different type.

I tried casting the result,
Result = Vector.<TypeB> ( vectorA.map(...) );

but still gets a same error : cannot convert TypeB into TypeA   (where TypeA is the original type of the vector, and typeB, the mapped object).

Regards,

Maurice Amsellem
SYSTAR R&D - BusinessBridgeFX