Not 100% sure, but QNames have special privileges in AS as they
generally get evaluated before applied as a property lookup.  If you do

 

d[http://foo::bar <http://foo::bar/> ], what happens?

 

Also, if you apply the qname to an Object does it work?  If the
dictionary doesn't use weak keys, there's really no difference.

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Greg McCreath
Sent: Thursday, June 14, 2007 6:36 AM
To: [email protected]
Subject: [flexcoders] Why can't I use a QName as a Dictionary key ?

 

Hi All,

 

var nameSpace: Namespace = new Namespace("http://foo <http://foo/> ");
var qname: QName = new QName(nameSpace,"bar");
var d:Dictionary = new Dictionary();
d[qname] = "why does this blow up?";


gives an explosion:

 

ReferenceError: Error #1056: Cannot create property http://foo::bar on
flash.utils.Dictionary.

 

you simpy cannot use a QName as a Dictionary key.  I've tried it in 10
different ways (namespaces with/without prefixes etc etc). 

 

Why is this so?  It extends Object ... and I can use Objects for keys in
a Dictionary.

 

All help appreciated.

 

Greg.

________________________________

This email and any files transmitted with it may be confidential and are
intended solely for the use of the individual or entity to whom they are
addressed. This email may contain personal information of individuals,
and be subject to Commonwealth and/or State privacy laws in Australia.
This email is also subject to copyright. If you are not the intended
recipient, you must not read, print, store, copy, forward or use this
email for any reason, in accordance with privacy and copyright laws. If
you have received this email in error, please notify the sender by
return email, and delete this email from your inbox. 

 

Reply via email to