Is that a space between get and Account?  You definitely can't do that,
you've named the getter the same as a class name (with a capital
letter).  If you wanted getAccount that would work though, or get
account.

 

Matt

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of shaun
Sent: Thursday, February 22, 2007 5:23 AM
To: [email protected]
Subject: Re: [flexcoders] is it a Flex compiler bug?

 

Mark Piller wrote:
> We ran into something that looks like a compiler bug. Please take a
> look at the code below and correct me if I am wrong. The object model
> and the class names of the code below may not make any sense, I put it
> together to demonstrate the problem.
> 
> Here's a class with a static property:
> 
> package
> {
> public class StaticClass
> {
> public static function get Account():String
> {
> return "my account name";
> }
> }
> }
> 

That staticfunction looks a bit strange i think. Shouldnt that function
be:

public static function get account():String{
return "my account name";
}

> Here's a class inheriting from the class shown above:
> 
> package
> {
> public class NonStaticClass extends StaticClass
> {
> public var _parentAccount:Account;
> 
> public function NonStaticClass()
> {
> _parentAccount = new Account();
> }
> }
> }
> 
> And finally the Account class used in the NonStaticClass:
> 
> package
> {
> public class Account
> {
> public var name:String;
> }
> }
> 
> The compiler reports two problems with the code. Both in the
> NonStaticClass:
> 
> 1. "Type was not found or was not a compile-time constant: Account."
> This one shows up for the _parentAccount field declaration

Isn't that caused by a simple scope problem?

> 
> 2 "Call to a possibly undefined method Account"
> This error shows up for the initialization of the _parentAccount field
> in the NonStaticClass constructor.

see above.

> 
> It looks like there are two problems in the compiler:
> 1. Compiler attempts to inherit static declarations
> 2. As a result of (1), the compiler gets confused between the static
> property and a class type
> 
> Cheers,
> Mark
> 

I'm new to Flex and AS so its possible Ive missed the point..

regards,
- shaun

 

Reply via email to