Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 3.0 (http://www.flasher.ru/forum/forumdisplay.php?f=83)
-   -   переменная в package (http://www.flasher.ru/forum/showthread.php?t=111378)

codecast 24.04.2008 01:22

переменная в 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"
что я неправильно делаю?

BlooDHounD 24.04.2008 02:01

Код:

package engine {
        public var _root:MovieClip;
}



Часовой пояс GMT +4, время: 05:15.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.