ForumsProgramming ForumAdvanced question - packages messed up

1 3140
PixelSmash
offline
PixelSmash
566 posts
Nomad

Hi all, by now I've been working quite some time on a game. However, by now the amount of separate class files is growing a bit too large: 20+ in one folder. Not so good, and not very clear either.

So I figured I'd toss all of the files in a few packages. And that's where things went wrong. When using FDT, it gives the following error: 'the import (...) is internal and not visible'. Flash itself just gives a compiler error that the package could not be found.

I have a hunch it has something to do with how package structures are supposed to be done, but reading the official documentation didn't help me at all.

The error happens like this:

package com.pixelsmash.devour{

import flash.display.MovieClip;
import com.pixelsmash.devour.utils.NewMouse;

public class Devour extends MovieClip{
var newMouse:NewMouse = new NewMouse();
}
}

Where the NewMouse gives the error. Could this be related to Devour already being inside com.pixelsmash.devour? What I don't understand is how you're supposed to import classes that are 'further down' your package tree...

I hope someone has any ideas. Thanks!

  • 1 Reply
PixelSmash
offline
PixelSmash
566 posts
Nomad

Well, seems like I found the answer myself. And the stupid thing is, I actually did read about it, it just didn't hit home so to say.

Anyway, what I'd done (@NewMouse) was declare it as 'class NewMouse'. I thought that in doing so it would be implicitly declared as a public class - and since it didn't give any errors before I poured it into the renewed package structure I guess it did. Nevertheless, afterwards it didn't, since explicitly declaring as 'ublic class NewMouse' fixed my problem.

Anyway, hope someone might find this useful.
Cheers!

Showing 1-1 of 1