silly class error, probably easily resolved...

7 posts

Flag Post

i figure i am missing something quite obvious, but i can’t for the life of me figure out what it is.

i have two movie clips, one with name “Ship”, instance name of “SHIP”, identifier as “Ship” and an as2 class file called “Ship.as” that extends the “Ship” class. this class file and associated movieclip works fine, but for some reason my second movie clip isnt being linked to it’s class file. the second movie clip name is RPG, instance name of RPG1, identifier as “RPG” and the as2 class file called RPG which extends RPG movieclip. i’ve put a trace function on the RPG class file to output a variable i’ve written on an onLoad function, which works fine on my Ship class file, but it douesn’t output it when the RPG movieclip loads. so yeah, any help? i’m stumped, haha

 
Flag Post

Why is instance name SHIP again?
Tip: Don’t use numbers :P

 
Flag Post

because a lot of the variable’s ive assigned are for that specific instance of the Ship movieclip, which i’ve only used one copy of throughout, so it really doesn’t matter what it’s called as long as my other code can target that instance on the main timeline. and i used numbers because i intend to have multiple instances of the same movie clip which all use the same properties. and yes, i’ve tried renaming my instance to be without numbers ;)

 
Flag Post
the as2 class file called RPG which extends RPG movieclip

How about RPG.as :)

 
Flag Post

it has to be RPG.as if i’m saving it as an as file? i shouldn’t need to put the “.as” part for it to work, plus, it’s returning no compiler errors….

 
Flag Post

Try putting some rubbish in there and see if you get compile errors then. At least in FlashDevelop, files that aren’t linked don’t get compiled, so you can confuse yourself by thinking a file is valid but actually it’s not linked.

A good IDE will assume that the file is .as but you didn’t mention it in your post so I thought I’d point that out so you could check. Also, check that the package in the AS file matches where you’ve put it, that it’s in the classpath, etc.

I’ve never used Flash IDE, maybe you have to explicitly link a movie clip and a class? (Probably best if I yield the thread to someone who knows what they’re talking about then ;).)

 
Flag Post

hmms, you were right, the .as file wasn’t being compiled with the rest of my game, so it wasn’t linked. do you know how i’d go about linking them? haha

EDIT: nvm, i managed to figure out the blatantly obvious way to link them, thanks for the help though xD