flash predefined_symbols_definition_code
Code definition in a symbol
In previous versions of ActionScript, the following code definition was possible on instances in the following way:
on (release) { trace("clicked"); }
Even if this technique was advised against in large projects, it allowed you to simply attach code to objects. In ActionScript 3 the definition of code is impossible on instances, but it is possible to reproduce the same comportment in ActionScript 3.
By placing the following code on the timeline of a MovieClip we find the same behavior:
// listens to the MouseEvent.CLICK event addEventListener ( MouseEvent.CLICK, click ); // activation of the button behavior buttonMode = true; click function ( pEvt:MouseEvent ):void { trace("clicked"); }
We will come back to the buttonMode property in the article entitled Interactivity.
Mediabox Training Centre © 2000 - 2008 All rights reserved.
Adobe Authorized Training Centre. State convention under number 25 14 02167 14.
Mediabox : SARL au capital de 62.000€ - Activity number: 25 14 02167 14 - SIRET : 493 716 468 00027
MEDIABOX, 102 Avenue des Champs Elysées, 75008 PARIS - Tel. +33(0)2.31.91.96.89 - Fax. +33(0)2.72.68.56.42


