0
votes

I am new to Flash Builder so this is an easy question for anybody who has some experience with flash builder and actionscript 3.0.

So basically I have a folder with .as files. The directory of it is -

...\src\assets\Stadium\MyClass

Now I want to use it in my Flash Builder Project, but when I import like this -

import assets.Stadium.MyClass.PrefabProject;

There are warnings ... look in the image below. How can I possibly use the contents of the folder in my as3 code. How can I use the folder as a package?

Click here for the image

EDIT: I went ahead and tried to use the stuff from the package in the code - This is the error I got -

A file found in a source-path must have the same package structure 'assets.Stadium.MyClass', as the definition's package, ''.   MyClass.as  /proj_away_alpha_new/src/assets/Stadium/MyClass Unknown Flex Problem
1
Note that those warnings are the "pre-compile" warnings (not actual compiler errors). They are sometimes wrong :( Do you get errors when you try to compile? (You'll see a red circle with an "x" in it instead of that orange circle w/a "?")Sunil D.
@SunilD. Thanks for pointing that out. But I still get an error. Edited the question to add the error.Joe Slater

1 Answers

1
votes

The error you have posted in your edit seems to imply that your package statement in MyClass is empty. The package statement should contain the same path that your class is in.

Since MyClass.as resides at the path (relative to your project): assets/Stadium/MyClass

The package statement (at the top of MyClass.as) should be the same:

package assets.Stadium.MyClass

I may have interpreted that error incorrectly. Just make sure that the package statement in MyClass.as is the same as the location of the class file on disk (relative to the project's src directory).

PS: The only time you use an empty package statement is when your class resides in that special "default package" (where your main app is).