I just woke up, I'll look at it after breakfast ;-) It looks to be a small change, but it's confusing to have to look at three sources (original, 'goog.events' and Carlos'), so I expect some errors to creep into the code after this merge. Shouldn't be too big of a deal to fix the ones we find, though.
EdB On Sat, May 4, 2013 at 7:33 AM, Alex Harui <aha...@adobe.com> wrote: > Should hopefully be a small change. How is it going? Did you get the > publisher to work again? > > > On 5/3/13 10:23 PM, "Erik de Bruin" <e...@ixsoftware.nl> wrote: > >> Thanks for waiting with this commit till after I land the >> 'goog.events' branch :-( >> >> EdB >> >> >> >> On Fri, May 3, 2013 at 11:48 PM, Carlos Rovira >> <carlos.rov...@codeoscopic.com> wrote: >>> Hi Alex, >>> >>> fixed in my latest commit, not JS and SWF works ok. Things look better at >>> daylight ;). >>> Only JS side need to improve applicationModel to be getter/setter. >>> >>> I change SimpleBinding fix to try catch as you suggested. >>> >>> Best, >>> >>> Carlos >>> >>> >>> 2013/5/3 Alex Harui <aha...@adobe.com> >>> >>>> Hi Carlos, >>>> >>>> I don't think the change to ViewBase.as was correct. The applicationModel >>>> property should be a getter. It looks like you reverted to a var. >>>> >>>> See if that fixes the SWF situation. >>>> >>>> -Alex >>>> >>>> On 5/2/13 6:17 PM, "Carlos Rovira" <carlos.rov...@codeoscopic.com> wrote: >>>> >>>>> Alex, >>>>> >>>>> I shared a branch with some changes "feature/applicationModel_refactor". >>>>> >>>>> applicationModel is the variable that makes createjs sample fail with the >>>>> change in simplebinding. I refactor to the way you show (hopefuly). >>>>> >>>>> In the JS version all is working right. But now SWF compilations fails in >>>>> runtime for both, _again and createjs sample (in different ways). >>>>> >>>>> Could you take a look and see if this refactor is in the way you >>>>> commented?. I'll take a look tomorrow and see why SWFs are failing. >>>>> >>>>> >>>>> >>>>> 2013/5/3 Carlos Rovira <carlos.rov...@codeoscopic.com> >>>>> >>>>>> Hi Alex, >>>>>> >>>>>> now I understand the problem. I was not aware of @expose and what you >>>>>> comment here. Very important information. Tomorrow I'll go back to the >>>>>> sample and see if I can change the sample to get working with that style >>>>>> and remove this fix since I think it's better to force people to make >>>>>> things in the good way. >>>>>> >>>>>> >>>>>> >>>>>> 2013/5/2 Alex Harui <aha...@adobe.com> >>>>>> >>>>>>> Hi Carlos, >>>>>>> >>>>>>> I saw the changes. >>>>>>> >>>>>>> I think it is a good fix, but you might want to add a comment that the >>>>>>> non-getter approach is likely to fail for non-public variables when >>>>>>> minified. >>>>>>> >>>>>>> Right now, binding in FlexJS only works for public properties and your >>>> fix >>>>>>> makes it work for public variables. Note that in some cases, the >>>> backing >>>>>>> variable for a public get/set is the same name because in JS the >>>> pattern >>>>>>> looks like: >>>>>>> >>>>>>> /** @private */ >>>>>>> var foo; >>>>>>> >>>>>>> /** @expose */ >>>>>>> function get_foo() >>>>>>> { >>>>>>> return this.foo; >>>>>>> } >>>>>>> >>>>>>> The question is, what did the AS look like? If it looked like >>>>>>> >>>>>>> private var _foo; >>>>>>> public function get foo() >>>>>>> { >>>>>>> return this._foo; >>>>>>> } >>>>>>> >>>>>>> Then the JS code for your failure case should be changed to look like >>>> the >>>>>>> recommended pattern and then you don't need the [this.sourceID] code >>>> path >>>>>>> as >>>>>>> there will be a get_ function. >>>>>>> >>>>>>> If the AS looked like: >>>>>>> >>>>>>> public var foo; >>>>>>> >>>>>>> Then the JS should be >>>>>>> >>>>>>> /** @expose */ >>>>>>> Someclass.prototype.foo; >>>>>>> >>>>>>> If they forget to use @expose then it will likely fail when minified. >>>>>>> >>>>>>> One more minor thing: Do you happen to know if try/catch is more >>>>>>> efficient >>>>>>> than doing a property lookup to see if it is undefined before making a >>>>>>> call? >>>>>>> >>>>>>> Anyway, thanks for contributing. We can use all the help we can get. >>>>>>> >>>>>>> >>>>>>> On 5/2/13 2:35 PM, "Carlos Rovira" <carlos.rov...@codeoscopic.com> >>>> wrote: >>>>>>> >>>>>>>> Hi Alex, >>>>>>>> >>>>>>>> I commit a solution that fixes the problem, but I don't know if is >>>>>>>> compliant with the motivation you make this change (minified version). >>>>>>>> >>>>>>>> I think binding should work even if we don't have a getter/setter >>>> setup, >>>>>>>> but I'm to new to this new framework that maybe this is not what you >>>>>>> have >>>>>>>> in mind. >>>>>>>> >>>>>>>> So it's up to you to change if you see some problem with this fix. >>>>>>>> >>>>>>>> >>>>>>>> 2013/5/2 Alex Harui <aha...@adobe.com> >>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On 5/1/13 3:40 PM, "Carlos Rovira" <carlos.rov...@codeoscopic.com> >>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Hi Alex >>>>>>>>>> >>>>>>>>>> this latest change in SimpleBinding: >>>>>>>>>> >>>>>>>>>> - this.source = this.document[this.sourceID]; >>>>>>>>>> + this.source = this.document['get_' + this.sourceID](); >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Makes the createjs sample to not generate controls far beyond a >>>>>>>>>> SimpleBinding. >>>>>>>>>> >>>>>>>>>> I need to change the sample code or it's a bug? >>>>>>>>> Well, using getters is correct. Are you binding to something that >>>>>>> isn't a >>>>>>>>> getter in AS? Maybe the JS version of that property should have >>>> been a >>>>>>>>> get/set pair. >>>>>>>>> >>>>>>>>> But if you want, you can also try to make SimpleBinding tolerant and >>>>>>> find >>>>>>>>> things that aren't getters. >>>>>>>>>> >>>>>>>>>> Thanks >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Alex Harui >>>>>>>>> Flex SDK Team >>>>>>>>> Adobe Systems, Inc. >>>>>>>>> http://blogs.adobe.com/aharui >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Alex Harui >>>>>>> Flex SDK Team >>>>>>> Adobe Systems, Inc. >>>>>>> http://blogs.adobe.com/aharui >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Carlos Rovira >>>>>> Director de TecnologĂa >>>>>> M: +34 607 22 60 05 >>>>>> F: +34 912 94 80 80 >>>>>> http://www.codeoscopic.com >>>>>> http://www.directwriter.es >>>>>> http://www.avant2.es >>>>>> >>>>> >>>>> >>>> >>>> -- >>>> Alex Harui >>>> Flex SDK Team >>>> Adobe Systems, Inc. >>>> http://blogs.adobe.com/aharui >>>> >>>> >>> >>> >>> -- >>> Carlos Rovira >>> Director de TecnologĂa >>> M: +34 607 22 60 05 >>> F: +34 912 94 80 80 >>> http://www.codeoscopic.com >>> http://www.directwriter.es >>> http://www.avant2.es >> >> > > -- > Alex Harui > Flex SDK Team > Adobe Systems, Inc. > http://blogs.adobe.com/aharui > -- Ix Multimedia Software Jan Luykenstraat 27 3521 VB Utrecht T. 06-51952295 I. www.ixsoftware.nl