Description of Error
This error comes up when a variable or function name could potentially be referring to more than one thing, and the compiler needs clarification as to which one you need. You may run into this if you are using namespaces, for instance – if you have two methods called method(), but one is in the foo namespace and one is in the bar namespace, then you need to specify the desired namespace when calling method().
Adobe’s Official Writeup
A reference might be to more than one item. For example, the following uses the namespaces rss and xml, each of which defines a different value for the hello() function. The trace(hello()) statement returns this error because it cannot determine which namespace to use.
private namespace rss;
private namespace xml;
public function ErrorExamples() {
use namespace rss;
use namespace xml;
trace(hello());
}
rss function hello():String {
return “hola”;
}
xml function hello():String {
return “foo”;
}
Correct an ambiguous reference by making the reference specific. The following example uses the form namespace::function to specify which namespace to use:
public function ErrorExamples() {
trace(rss::hello());
trace(xml::hello());
}
(Adobe Error Reference)
Cause of the Error
The compiler doesn’t know which of several methods you are referring to. This could mean that you have a namespacing issue – foo::method() and bar::method() are both available to you, but you are just calling method() and the compiler doesn’t know which one you want.
Note that this error code does not come up with ambiguities relating to packages. If you have package com.test1.SomeClass and com.test2.SomeClass, then refer in your code to SomeClass.method() then Flash CS4 will simply use the first one it comes to. Flex, on the other hand, will give you an unnumbered error in the Problems panel to the effect of “Can not resolve a multiname reference unambiguously.”
Solutions to the Error
This is pretty straightforward – it’ll tell you what method or property name is throwing the error, so figure out the namespace you want to use and change your code to use the namespace in the method call – so foo::method() or bar::method() rather than simply calling method().
Other Articles About This Error
If you’ve read a useful writeup of this issue elsewhere on the internet, leave a comment and I’ll add it to this list.
Most Recent Comments