PDA

View Full Version : internal class question



kamcknig
May 25th, 2008, 11:33 AM
I have two class files. One is called MP3Player.as, and the other is InfoBox.as.

Both have "package com.kyle.mp3player" as their pacakge. I am creating an InfoBox inside of the MP3Player class, and I tried declaring InfoBox as internal instead of public. My understanding is that because they are in the same package that should work, but it only works if I make it public. Do the classes have to be PHYSICALLY defined in the same .as file in order for internal to work?

And if that is the case, then a second question.

InfoBox is actually a MovieClip symbol in my library, with the linkage set to the InfoBox class... if I have to put the InfoBox definition inside of the MP3Player.as file, then how do I link that symbol to that definition?

This all might not be necessary, because I can get it to work with the public keyword, I'd just like to know these things for my own information!

Thanks!
Kyle

senocular
May 25th, 2008, 02:01 PM
Internal does mean that if in the same package, the class will be accessible.

Given that you're using a movie clip in the library, that could be causing some conflicts. For one, make sure that movie clip is not being used anywhere else. Secondly, go into your publish settings for ActionScript 3 and turn off Automatically declare stage instances. With this on, Flash will declare movie clip instances for you, and in doing so it will always be public. Turning this off will force you to declare your instances manually, but you can then use internal or whatever you want. Otherwise, just keep the class public

kamcknig
May 25th, 2008, 10:01 PM
OK, i turned off the automatically declare stage instances. it no longer gives me that error, though now it gives me "1120: Access of undefined property <movie clip name>" for the other MovieClips that I already have on the stage. How do I declare them manually?

Kyle