Vector class in a Flex Library Project
i seem to be having some problems with the 开发者_运维问答Vector class in actionscript 3
in a Flex Project or an ActionScript Project it is possible to do this
var v:Vector.<String>;
But when i do the same thing in a Flex Library Project (to create an SWC) then i get the following error on that line of code 1046: Type was not found or was not a compile-time constant: String.
so when using Flex Library Project it fails..., but when i compile the same thing using compc there are no problems
any idea why only the library project is complaining about Vector ?
btw this happens with all kinds off Vector declarations , not just String
var v:Vector.<String>
var v:Vector.<Number>
var v:Vector.<Object>
etc, all fail...
(i am using flex 4 sdk)
You might need the latest Player Globals SWC: http://labs.adobe.com/downloads/flashplayer10.html
Similar to this issue?
add:
"-target-player 10,0,0"
under "Properties -> Flex Library Compiler -> Additional compiler arguments !
Then it works with Flex B. 3
Check if your are publishing for a version flash >=10
ok it seems with Flex Builder 3 it is not possible to specify a minimim required flash player version for a Flex Library project , that's why it wasnt working.
i have tested the same thing in Flash Builder 4 , and now it is possible to specify that player version , which it possible to compile the Flex Library Project.
Thx for the answers Tegeril and Patrick you pushed me in the right direction.
Make sure you set the "-target-player" compiler argument to "10,0,0".
Adding "-target-player 10,0,0" in Flex Builder 3 gives an error "configuration variable 'target-player' must only be set once".
To resolve it add the following line in Project -> Properties -> Flex Library Compiler -> Additional compiler arguments
-dump-config "C:\Program Files\Adobe\Flex Builder 3\sdks\3.5(AIR 2.0)\frameworks\flex-config.xml" -target-player=10
this would dump the current configuration settings.
精彩评论