antun
07-18-2003, 09:43 AM
If you need to create a constraint based on a user action, you can do so using the applyConstraint() method:
<canvas>
<view x="100" width="20" height="20" bgcolor="blue">
<method event="oninit">
var f = function () {
this.setAttribute( "y" , m.y);
}
var d = [ m , "y" ];
this.applyConstraint( "y", f , d );
</method>
</view>
<view id="m" x="10" width="20" height="20" bgcolor="red">
<dragstate apply="true"/>
</view>
</canvas>
"f" is a callback function that is required for the applyConstraint() method. "d" is an array consisting of a pointer to a reference node, and the attribute to bind to.
Enjoy!
<canvas>
<view x="100" width="20" height="20" bgcolor="blue">
<method event="oninit">
var f = function () {
this.setAttribute( "y" , m.y);
}
var d = [ m , "y" ];
this.applyConstraint( "y", f , d );
</method>
</view>
<view id="m" x="10" width="20" height="20" bgcolor="red">
<dragstate apply="true"/>
</view>
</canvas>
"f" is a callback function that is required for the applyConstraint() method. "d" is an array consisting of a pointer to a reference node, and the attribute to bind to.
Enjoy!