actionscript 3 - The this must be used to reference the bindadle property -
if using {result} instead of {this.result}, binding mechnism can't work. didn't find doc describing thing. using flex3.5. know reason?
<?xml version="1.0" encoding="utf-8"?> <mx:panel xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300"> <mx:script> <![cdata[ [bindable] public var result:string ="b"; function confirm():void{ result = "changed text"; } ]]> </mx:script> <mx:textinput text="{this.result}"/> <mx:button label="confirm" buttondown="{confirm();}"/> </mx:panel>
this not problem of binding. far know, should avoid using "result" variable name, because used components. if rename result result1, work regardless of "this" keyword.
to see difference between "result" , "this.result" can try define "result" variable static one. this:
so if there uncertainty concerning variable, "this" means member variable , not static one.
this expression can show difference between 2 variables well:
<mx:textinput text="{this.result === result}"/>
it returns false in case.
Comments
Post a Comment