It’s intentional right now that a getter/setter pair must have a matching visibility modifier.  You can’t change whether a variable is visible to the compiler based on whether it’s being read or being written.  While we understand the use-case (and debated it internally ourselves) this is the approach we’re taking right now.

 

Matt

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Michael Schmalle
Sent: Thursday, September 07, 2006 7:41 AM
To: [email protected]
Subject: Re: [flexcoders] Public getter, private setter?

 

Hi,

Ironically, I just ran into this same issue the other day.

I had a post I didn't finish yesterday and what you just wrote about Java style was what I was going to say I did. :)

This is just a guess but, I would be willing to bet this is a Player bug.

If you think about the error, it is the same error you would get if you had

public function get height():Number

and

public var height:Number;

... ambiguous

So, I would bet this will be working, right around the time they make private constructors. ;-)

Peace, Mike

private var _loadedState:int = ConfigModelLocator.LOAD_STATE_UNLOADED;

[Bindable(event="loadStateChanged")]
public function get loadState():int
{
return _loadedState;
}
private function set loadState(state:int):void
{
_loadedState = state;
this.dispatchEvent(new Event("loadStateChanged"));
}

On 9/7/06, thunderstumpgesatwork < thunder.stumpges@gmail.com> wrote:


Just wondering why I can't declare a property getter as public, and
the property setter as protected or private?

When I do so, I get "1000 Ambiguous reference to loadState"

Any work-arounds? I want to have the setter so that I can raise the
property change event when I set the state, but I'd rather not make it
public.

thanks.
Thunder

see code:

private var _loadedState:int = ConfigModelLocator.LOAD_STATE_UNLOADED;

[Bindable(event="loadStateChanged")]
public function get loadState():int
{
return _loadedState;
}
private function set loadState(state:int):void
{
_loadedState = state;
this.dispatchEvent(new Event("loadStateChanged"));
}




--
What goes up, does come down.

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to