views:

1066

answers:

5

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)

A: 

Check if your are publishing for a version flash >=10

Patrick
yes i am for the Flex an ActionScript projectsbut with a Flex Library project it is not possible to specify a flash version in the compiler settings
Aaike
+1  A: 

You might need the latest Player Globals SWC: http://labs.adobe.com/downloads/flashplayer10.html

Similar to this issue?

Tegeril
i have downloaded and addedd the new Globals SWC to the Library path of the Flex Library Project , but still the same.i find i weird that it is complaining about not finding the String class... the Vector class seems to be ok.does anybody else have the same problem btw ?this can be tested by just creating a new Flex Library Project and creating a Vector variable of any kind.
Aaike
i checked out the link you included, i could use -external-library-path with compc , but compc doesnt give me any errors.and i think adding SWC to one of the paths in the Library Panel of the project is the same right ? or do i need to add it as a additional compiler argument ?
Aaike
A: 

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.

Aaike
Glad you got it worked out. I know with Flex Builder you can target a specific SDK, but yeah, not a player revision.
Tegeril
A: 

Make sure you set the "-target-player" compiler argument to "10,0,0".

James Ward
+1  A: 

add:

"-target-player 10,0,0"

under "Properties -> Flex Library Compiler -> Additional compiler arguments !

Then it works with Flex B. 3

bergi