Instance de vue OpenLaszlo controlée par un script
Avec OpenLaszlo, on peut créer des instances de classe (de "view" ou de tout autre élément) trés simplement en utilisant la commande new
Un petit exemple ci-dessous vous montre comment controler ces instances grace à un script.
<canvas>
<class name="mySmiley" resource="hdg.png" />
<simplelayout axis="y" spacing="5" />
<view id="container" width="400" height="300" />
<button>
une vue de plus!
<method event="onclick">
var newX = getRandomPosition( container.width );
var newY = getRandomPosition( container.height );
var smileyPointer = new mySmiley( container, { x: newX } );
smileyPointer.setAttribute( 'y', newY );
</method>
<method name="getRandomPosition" args="max">
return Math.round( Math.random() * max );
</method>
</button>
</canvas>
Ressource en anglais sur le forum OpenLaszlo ici