Показать сообщение отдельно
Старый 24.04.2008, 01:22
codecast вне форума Посмотреть профиль Найти все сообщения от codecast
  № 1  
Ответить с цитированием
codecast
Banned

Регистрация: Mar 2008
Сообщений: 24
По умолчанию переменная в package

привет.
исходя из документации флеша:
Код:
ActionScript 3.0, however, supports not only classes at the top level of a package, 
but also variables, functions, and even statements. One advanced use of this feature 
is to define a namespace at the top level of a package so that it will be available to 
all classes in that package. Note, however, that only two access specifiers, public and 
internal, are allowed at the top level of a package. Unlike Java, which allows you to
declare nested classes as private, ActionScript 3.0 supports neither nested nor 
private classes.
я могу размещать в package не только классы, но и переменные. Я хочу сделать переменную, к которой могли бы обращаться все классы моего package.

т.е. что-то типа...
Код:
package engine {
	public var _root:MovieClip; //моя переменная, думаю из названия очевидно, как я ее хочу использовать
	public class MainPreloader extends MovieClip {
		var mcPreloader:MovieClip;
		function MainPreloader (){
			_root=this;
			stop ();
 ...
на что мне компилятор пишет "5006: An ActionScript file can not have more than one externally visible definition: engine.MainPreloader, engine._root"
что я неправильно делаю?