Gah! The class or interface 'Ship' could not be loaded. (locked)

5 posts

Flag Post
this is in the ‘Kongregate’ section … because I want a response fast.

Heheheh.

Well, exactly what are you using? The Shootorials are pretty damn old, and may be out of date by now.

 
Flag Post

What does your Ship.as file have in it? You might have made a typo on the class. Also, this belongs in the Kongregate Labs Forum.

 
Flag Post

I’m having the same problem!

 
Flag Post

I’m doing shootorial and I’ve bumped into this rather unclear error several times. Here’s how I fixed it:

Basically the “Symbol=X” part is telling you that it is looking for the name X somewhere and not finding it. Either the matching X item doesn’t exist yet, or it does exist and the name doesn’t match. The name won’t match if you forget to put a name on it, if you gave it a different name, or if you misspell the name. Note that ActionScript is very picky that CAPITALIZATION must match exactly. !!!This means “Ship” and “ship” fail to match!!!

When you import graphics (like the ship) you’ll need two entries in the library. You’ll have the Ship.png and the symbol Ship. The Ship.png does not need any export properties. Check the properties on the symbol copy. Make sure the symbol is exported for ActionScript and exported for frame 1. Then check how everything is named. I’m not sure if these all have to match, but I have the Name, Identifier, and Class all exactly matching “Ship”. Double and triple check the capitalization, that killed me more than once. That should give you a Ship.as file, if not then fix your .as name to match too. Later in the Shootorial will mention an “instance” name and direct you to place a different name onto the picture of the ship sitting on the stage. The Shootorial tells you to name it “ship” – note the lowercase. The capitalization difference can be extremely easy to miss and it can create confusion.

Using both capital “Ship” and lowercase “ship” makes it too easy to type the wrong one, and even worse you can spend a ridiculous amount of time looking for the problem and not seeing it. When you label the stage-instance of the ship I strongly suggest using the name it something like “ShipInstance” instead of “ship”. Later on you will have code outside of Ship that wants to access Ship’s variables and functions. The Shootorial code for that will be “_root.ship.whatever”, but if you take my advice here then you will need to rewrite that code as “_root.ShipInstance.whatever”. The “_root” accesses the stage level, the “ShipInstance” gets you into the specific copy of the ship (in theory there could more than one), and then the “whatever” would be the name of one of Ship’s variables or functions.

When you draw a graphic inside the Flash software, like in the the Missile lesson, you will only have ONE entry in the library. The Flash-vector-drawing of the Missile becomes part of the Missile symbol. You still have to check properties to sure things are exported properly and check that the property names match just like above. The only difference is that there’s no second library entry to name match.

 
Flag Post

The solution is simple. 1) The ship.as file must be in the same folder in which the game is.
2) check on “class ship…” if you wrote “ship” correctly. If you are having problems, pm me. I am always glad to help you mates!