Can't use import with package_as3

92 views Asked by At

For some reason, when I use package_as3 in FlasCC I can't import any classes to use as a var.

package_as3
(
    "#package private\n"
    "import flash.system.MessageChannel;\n"
    "var mc:MessageChannel;\n"
);

When I try to build anything that has this code in it, I get this:

Error: Type was not found or was not a compile-time constant: MessageChannel.

whenever I use the compiled SWC in Flex.

EDIT:

This doesn't just apply to flash.system.MessageChannel; it seems to happen to anything that gets imported.

1

There are 1 answers

1
visibleman On

A few things to try out

Syntax

I don't think you are supposed to wrap each line in quotes, nor add \n for string termination, so that's one thing that need mending.

SDK

The MessageChannel class requires SDK version 4.6 and above so did you select the correct SDK and add it to your buildpath?

Runtime

Also the MessageChannel interface did not get run-time support until version 14.0.0 (AIR or Player), so in project properties -> ActionScript Compiler, did you set the 'Require Flash Player Version' to version 14.0 or above?