Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mx.collections missing? ArrayCollection() in Flex4 (Flash Builder 4)

I have some code that uses an ArrayCollection, it imports:

import mx.collections.ArrayCollection;

then:

static protected var myAC:ArrayCollection = new ArrayCollection();

Seems straightforward, but in my project the import (and thus ArrayCollection) are not found/defined!

I am using Flash Builder 4 (Flex 4) - it's an ActionScript project, and project properties is set to Flex SDK 4.0. Everything should be default settings.

When I type "import mx." and press control-space (autocomplete), I see a list of choices such as core, geom and several others, but no 'collections'.

I must be missing something?

like image 810
Scott Szretter Avatar asked Jan 21 '23 12:01

Scott Szretter


2 Answers

By default, an "ActionScript Project" does not include the framework.swc which contains the flex packages such as mx.collections. If you really want to use ArrayCollection, you'll have add the swc and its corresponding resource bundle swc to your project library path. They are located at:

${FLEX_SDK_HOME}/frameworks/libs/framework.swc
${FLEX_SDK_HOME}/frameworks/locale/${locale}/framework_rb.swc
like image 99
dchang Avatar answered Apr 09 '23 21:04

dchang


  1. Export your project to zip
  2. Update to FlashBuilder 4.1
  3. Import your project from zip
  4. Forget about your error)
like image 30
Eugene Avatar answered Apr 09 '23 21:04

Eugene