[Laszlo-dev] applyConstraintMethod problem

P T Withington ptw at pobox.com
Wed Dec 17 11:32:57 PST 2008


Here's the clue:

On 2008-12-17, at 14:01EST, Lee Lundrigan wrote:

> incubator/scrolledittext.lzx#79/30 @incubator/scrolledittext.lzx#92

The transformation you have to make (and this is if you ever want this  
to work in swf9) is to take the functions that are being applied as  
constraints there, make them into named methods on the class instead  
(you'll have to make up your own names, like __constrainX,  
__constrainStepSize, etc.) and then call applyConstraintMethod, e.g.:

   <method name="__constrainX">this.setAttribute("x",  
this.parent.width - this.width );</method>

...

   this.applyConstraintMethod('__constrainX', [p, "width", this,  
"width", p, "border"]);

I don't understand what the original designer was trying to do here.   
It looks like they took some normal constraints (in the comments ` x="$ 
{parent.width - this.width - parent.border + 1}"`) and hand-expanded/ 
fudged them to do something similar but different.  There might be a  
simpler way to acheive this by simply writing normal constraints, but  
I can't tell.  Clearly writing them as normal constraints, the  
compiler handles all the magic of making methods, etc.  It's because  
these constraints were written out by hand that they are running into  
the deprecation warning.


More information about the Laszlo-dev mailing list