Correct way to pass a reference?

Hi,

Can someone please set me straight on how to communicate properly over different classes. Lets say I have two classes, one is “photo” and the other is “album”… in this instance, both classes are instantiated from my “main” class. Currently, in order to get “photo” to communicate (read variables, start methods) I’ve been setting them up in my main class like so:


public static var photoClass:photo = new photo();
public static var albumClass:album = new album();

And then inside of photo I would code:


main.albumClass.method();

This works fine, but I am told using static variables is a bad idea, and a better way to do it would be to pass each class as a reference, for example:


public static var photoClass:photo = new photo();
public static var albumClass:album = new album();

photoClass.init(albumClass);

Please help! I like using the first method, but if it’s bad then I’d rather get out of the habit now!

Thanks