SHOW:
|
|
- or go back to the newest paste.
| 1 | import flash.utils.dictionary; | |
| 2 | var container:MovieClip; | |
| 3 | var dict:Dictionary = new Dictionary(); | |
| 4 | for(var i:int=0; i<container.numChildren; i++) | |
| 5 | {
| |
| 6 | var mc = container.getChildAt(i); | |
| 7 | mc.mouseChildren=false; | |
| 8 | mc.addEventListener(MouseEvent.CLICK, onBtnClick); | |
| 9 | dict[mc] = mc.animation.currentFrame; | |
| 10 | } | |
| 11 | ||
| 12 | var correctSolution = 50; | |
| 13 | function onBtnClick(event:MouseEvent) | |
| 14 | {
| |
| 15 | var nr = dictionary[event.currentTarget]; | |
| 16 | trace(nr); | |
| 17 | if(nr==correctSolution) | |
| 18 | {
| |
| 19 | trace('correct');
| |
| 20 | } | |
| 21 | else | |
| 22 | {
| |
| 23 | trace('wrong');
| |
| 24 | } | |
| 25 | ||
| 26 | } |