Weird stuff. I would not have thought that private and protected would be different here.
Harbs On Jul 9, 2012, at 10:14 PM, Desai, Ashish S wrote: > Different decompiler can give different results. Somehow what you gave in > source happens to work. Even this works > > private static var myvarfirst:String = "testing"; > > private var myVar:String = this.myvarfirst; > > It allows assigning static values in non-static way and non-static values in > static way. Java allows both ways below: > > private String s3 = "jpm"; > private String s2 =s3; > > private static String s3 = "jpm"; > private String s2 = this.s3; > > Thanks, > Ashish > > > -----Original Message----- > From: omup...@gmail.com [mailto:omup...@gmail.com] On Behalf Of Om > Sent: Monday, July 09, 2012 3:05 PM > To: flex-dev@incubator.apache.org > Subject: Re: Odd undefined property via reference to static type compilation > error > > FWIW, I ran the compiled code through a decompiler and this is how the same > code gets converted as: > > *Source*: > > package > { > public class A > { > > public var minHeight:Number = 9; > public var minHeight2:Number = minHeight; > > } > } > > *After decompilation*: > > package > { > public class A > { > public function A() > { > this.minHeight2 = this.minHeight; > } > public var minHeight2:Number; > public var minHeight:Number = 9; > } > } > > > Next, I tried this (compiles fine): > > *Source:* > > package > { > public class A > { > > public var minHeight:Number = 9; > public var minHeight2:Number = this["minHeight"]; > > } > } > > *After decompilation:* > > package > { > public class A > { > public function A() > { > this.minHeight2 = this['minHeight']; > } > public var minHeight2:Number; > public var minHeight:Number = 9; > } > } > > > Not sure if we learned something here, but it just makes it more interesting > :-) > > Om > > > 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 >> > This email is confidential and subject to important disclaimers and > conditions including on offers for the purchase or sale of > securities, accuracy and completeness of information, viruses, > confidentiality, legal privilege, and legal entity disclaimers, > available at http://www.jpmorgan.com/pages/disclosures/email.