This is probably a compiler bug, if not a language bug. Instance
initializers were ill defined in AS3. In the draft ES4 spec we pinned them
down to be scoped to the class static scope, so references to 'this' or
instance variables would not be resolved in instance initializers. That
said, AS3 did allow them with some what vague initialization semantics. The
bug here is that 'this' is not allowed in instance initializers in strict
mode.

There are two workarounds: 1/erase the 'this.' prefix; 2/turn off strict
mode.

Jeff



On Mon, Jul 9, 2012 at 11:34 AM, Ryan Frishberg <fri...@gmail.com> wrote:

> In ActionScript, it looks like this doesn't work:
>
> class A
> {
>
> public var minHeight:Number = 9;
>
> protected var minHeight2:Number = this.minHeight;
>
> }
>
> Someone who knows ActionScript in more detail can probably explain why the
> compilter/runtime can't figure out what "this" should refer to when
> initializing class properties.
>
> -Ryan
>
> On Wed, Jul 4, 2012 at 5:53 PM, Justin Mclean <jus...@classsoftware.com
> >wrote:
>
> > Hi,
> >
> > > BTW, is this an issue in Adobe Flex 4.6 as well?
> > Yep issue with both 4.6 and 4.8 and couldn't find an existing JIRA report
> > for it.
> >
> > Justin
>

Reply via email to