Class Initialized Properties Become Functions?

0 views
Skip to first unread message

James Ward

unread,
Aug 17, 2010, 3:51:10 PM8/17/10
to Jangaroo Users
Hi all,

I have an AS3 class which contains the following property:
protected var _dayButtons:Array = new Array();

In JavaScript this becomes:
"protected var",{ _dayButtons/*:Array*/ :function(){return( new
Array());}},

Problem is that when my code tries to do:
this._dayButtons.push(btn);

I get:
this._dayButtons.push is not a function


Shouldn't _dayButtons be a property instead of a function?

Thanks.

-James

Andreas

unread,
Aug 17, 2010, 4:50:12 PM8/17/10
to Jangaroo Users
Field initializers are wrapped by the Jangaroo compiler into a
function which is evaluated at instance creation time.

Where do you call this._dayButtons.push? Maybe the initializer has
not been evaluated at that point.

To further analyze the problem it would be helpful if you post the
complete source code of your class .

-- Andreas

Reply all
Reply to author
Forward
0 new messages