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

flash actionscript : I just want my classes to compile.


mgoodes
10/1/2007 6:48:26 PM
Hello,
I'd just like to do something simple: compile a test class in AS3.0 (Flash
CS3 on Mac OSX 10.4).
Not having any luck, nor can I find any documentation. Hoping someone can
help here. Here is what I have set up:

- file structure: Inside a folder called "Notation" i have the files
"editField.as" and "editFieldTest.fla"
- class path: Points to the "Notation" folder
- code in the "editField.as" file is:

package Notation {
import flash.display.MovieClip;
public class editField extends MovieClip { //Compiler wanted me to extend
MovieClip
function editField() {
trace( "editField.class" );
}
}
}

- code in frame 1 of "editFieldTest.fla":
import Notation.editField;
var tf:editField = new editField();

I've played with this a lot and the error messages vary. All I need is the
correct way to set this up to get the class to compile.

Thanks.
Mark Goodes
Flash MX expert
Flash 3.0 newbie
kglad
10/1/2007 6:52:39 PM
mgoodes
10/1/2007 7:10:18 PM
Thanks for the quick reply, kglad. Love your site!

Unfortunately though when I tried your suggestion it didn't fix the problem.
I got the error message:
5001: The name of package 'Notation' does not reflect the location of this
file. Please change the package definition's name inside this file, or move the
file. /Users/markgoodes/Documents/Flash CS3 Projects/Notation/editField.as

I really wish the message would tell us which change was required instead of
making us guess.

Mark
kglad
10/1/2007 7:18:53 PM
sometimes that message is erroneously generated. i haven't figured out a
pattern, but simply copying and pasting code from one fla to a new one that's
saved in the same folder, i've found will remedy the error message.

if you have trouble here's zip file with your code working:

www.kglad.com/Files/tf.zip
mgoodes
10/1/2007 7:49:24 PM
Works! I thought it might be a Flash bug. Not that Flash tech support would
ever admit it.

Thanks kglad. You've got me coding now.

PS Do you know of a good resource for information on setting up files and
paths?
kglad
10/1/2007 8:10:24 PM
you're welcome.

i'm not sure what you mean, by setting up files and paths, but that is an
advanced actionscipt topic. there is an o'reilly book (actionscript 3.0 design
patterns) that deals with this topic.

there are, at least, two free chapters available on the internet. i found
them using google.
kglad
10/1/2007 8:37:44 PM
mgoodes
10/1/2007 8:59:17 PM
Thanks.
kglad
10/1/2007 10:13:29 PM
AddThis Social Bookmark Button