Groups | Blog | Home
all groups > flash actionscript > september 2007 >

flash actionscript : Using my Custom Package?


Rich Morey
9/29/2007 5:08:44 PM
Hi --

I have created some code in Flash CS3 using AS 3.0 to create form elements
dynamically but now I am having trouble accessing the package I have created
from another Flash movie.

My package setup is like this...

package formbuilder
{
public class forms
{

public function createCheckBox() {

}

}
}

The AS file is saved as FormElements.as

and I am attempting to call the package like this

import FormElements

This seems to work as the IDE had me make some small changes to the code
when I first tested my movie.

However, once I have added this code:

var useForm:forms = new forms()

I get an error, "1046: Type was not found or was not a compile-time
constant: forms."

I am not sure if I need to have my package name and my file name the same?
Do I need to change my import statement? Do I need to change my call? Do I
need to add a constructor to the package?

Please help!!

Thanks

Rich


kglad
9/30/2007 1:38:24 AM
your file name MUST be the same as the class name, which in the above code is
forms. ie, your file name must be forms.as.

because you use a package named formbuilder, forms.as must be in a directory
named formbuilder.
Rich Morey
10/1/2007 12:11:29 PM
Great! Thank you for this info.

Rich

[quoted text, click to view]

kglad
10/1/2007 7:20:42 PM
AddThis Social Bookmark Button