Здравствуйте. Подскажите как правильно использовать namespace.
Суть задачи хочу в отдельном классе создать блок неймспейса и использовать их из любого места в коде. Может я конечно не правильно понял назначения неймспейса...
Main.as

Код AS3:
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.text.TextField;
import flash.display.DisplayObject;
import inpictures.logger.Logger;
import inpictures.UserInterface;
import inpictures.connector.External;
import inpictures.events.ChannelEvent;
import inpictures.Channel;
import flash.events.MouseEvent;
public class Connector extends Sprite {
inpictures var ex:External = new External();
private var ui:UserInterface;
private var channel:Channel = new Channel();
private var cache:Object;
private var log:Logger;
public function Connector() {
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event=null):void {
removeEventListener(Event.ADDED_TO_STAGE, init);
log = new Logger();
addChild(log);
log.attach(channel);
ui = new UserInterface();
addChild(ui);
channel.connect(inpictures::ex,true);
}
}
}
inpistures.as

Код AS3:
package {
public namespace inpictures;
}
Channel.as

Код AS3:
package inpictures {
import inpictures.Core;
import dev.IDE;
import inpictures.events.ChannelEvent;
use namespace inpictures;
public class Channel {
public var log:*;
private var core:Core = new Core();
private var ide:IDE = new IDE();
public function Channel() {
trace(inpictures::ex); // output ReferenceError: Error #1065: Переменная inpictures::ex не определена.
}
public function connect(e:*,init:Boolean=false):void {
if (!e.hasEventListener(ChannelEvent.USING))
e.addEventListener(ChannelEvent.USING, manager );
if (log && !e.hasEventListener(ChannelEvent.LOG))
e.addEventListener(ChannelEvent.LOG, log.channel );
if (init) e.init();
}
public function set ei(e:*):void {
}
public function manager(e:ChannelEvent):void {
//trace(e.type+" "+e.eventType+" Data"+e.data);
if (log) log.add("ChannelEvent: Type <b>"+e.type+"</b> eventType <b>"+e.eventType+"</b>");
switch (e.eventType) {
case "setIde": {
core.auth(ide.user);
break;
}
case "JSReady": {
break;
}
}
}
}
}