Namespace and the "in" operator?

I’m trying to figure out how to use namespaces with the “in” operator. My problem is that I’m using dynamic objects and can’t get a reference to the target namespace without an error being thrown.

this is essentially what I’m trying to do…


var obj:IEventDispatcher = IEventDispatcher(e.target);
var info:Object = Object(edinfo[obj]);
var f:String = info.callbackPrefix + func;
var d:* = info.callbackDelegate;
var ns:Namespace = d.event_handler; //event_handler is the namespace in "d". This causes problems because d is not typed??
trace(f in ns);

That code doesn’t tell you much about context of what I’m doing. But that’s what I need to do with this namespace situation…

Any ideas?
Thanks.

package {
	import flash.display.Sprite;
	import flash.utils.describeType;
	
	public class Foo extends Sprite {
		
		public namespace abc = 'abcd';
		
		public function Foo () {
			super();
			var methods:XMLList = describeType(this).*.(attribute('declaredBy') == "Foo" && name() == "method").@name;
			for each(var s:XML in methods){
				try {
					this.abc::[s]();
					trace('using NS');
				} catch (e:Error) {
					this[s]();
					trace('not using using NS');
				}
			}
		};
		
		abc function fooFunc ():void {
			trace ('I\'m fooFunc');
		}
		public function barFunc ():void {
			trace ('I\'m barFunc');
		}
	}
}

Don’t know how helpfull this is, but… can you tell a bit more about your task? May be the solution is more simple…

yeah that’s somewhat helpful. My biggest concern was having to use a try catch. Because of what I’m doing, there could potentially be a lot of exceptions raised. and try catch’s are slow. But that describe type might lead me down the right path… let me know if you think of anything else.

cool that got me what I needed… like so:


var d:XMLList = describeType(callbackDelegate).*.(attribute('uri') == event_handler && name() == "method");

that gives me all methods in the specified namespace. so i don’t need the “in” operator anymore, I just use the xml…

thanks.