Struggling with Flex Error 1000: Ambiguous Reference to…
I recently faced a Flex Error 1000: Ambiguous Reference to that puzzled me, I thought I’d share what was the issue and how to workaround it.
This error was raised by the compiler when I attempted to use a property for which I had defined a public getter together with a protected setter.
Using public::myProperty or protected::myProperty fixed the problem!
The Flex Error 1000: Ambiguous Reference to was raised whether I accessed the getter or the setter method from any method of my class.
When using the property getter from outside the class, everything was fine, no compiler complaint. And, of course, when using the property setter, the expected Flex Error 1059: Property is read-only was correctly raised.
It took me some time to realize that the error was due to my setter being protected while my getter was public. My investigations made me discover that this was a bug raised on the Flex 2 compiler! This is bug number 174646 for which the description, as available on this Adobe Tech Note, is:
If a class contains accessor functions with different access control namespace attributes, (for example, a protected setter and a public getter) using one of them causes a compile-time-error, for example,Compiler-Error 1000: Ambiguous reference to myVar
The workaround is to rename your getter or setter function to avoid the mismatch.
It seems that this bug is still not fixed in Flex 3! What about Flex 4 that I’m not (yet) using? Do you know if it’s still there?
Anyway, the easiest way to workaround this issue is, for me, not really to rename your getter or setter but to call them using a fully qualified namespace.
For you public getter, instead of writing:
var myVar:* = myProperty;
use:
var myVar:* = public::myProperty;
For using your protected setter, replace the usual:
myProperty = value;
by:
protected::myProperty = value;
No more nasty Flex Error 1000: Ambiguous Reference to while keeping my getters and setters as expected!



FYI the 4.x SDK supports having a getter and setter with different access levels.
@Brian Kotek
Thanks Brian for the confirmation!
@Brian Kotek
I could no confirm that this issue is none-existent in Flex 4.x SDK.
Tested both on Flex 4.1 and Flex 4.5.17077
Now the compile message when accessing protected getter (the setter is declared as public) within TestClas class is as follows:
TestClass.as 1059: Property is read-only.
TestClass.as 1178: Attempted access of inaccessible property prompt through a reference with static type TestClass.
The old workaround with explicit declaring of variable namespace still works.
Related bug at Adobe JIRA submitted not that long ago:
Different access levels for properties throws build errors.
https://bugs.adobe.com/jira/browse/ASC-4118
ps Nice legacy of the class namespace from compiler (found in issue comments) – macromedia.asc.semantics.ReferenceValue =)
Thanks for the follow-up Jabby!
With Flex3.5 I had the problem with my own interface that is extended through two other interfaces and same provide same method.
public interface IDataListCollectionView extends IList, ICollectionView
If you try to use the length (ie.) that need to be implemented by both interfaces, error 1000 is shown. Then I need to cast an object that implements the own interface to IList(collection).length first…
it might exist in flex 4 as well i am facing this problem and above mentioned solution also not worked…………. please help if any one can ……………….