jan_flanders

Untitled

Aug 15th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.addEventListener(MouseEvent.CLICK, onBtnClick);
  8.     dict[mc] = mc.animation.currentFrame;
  9. }
  10.  
  11. var correctSolution = 50;
  12. function onBtnClick(event:MouseEvent)
  13. {
  14.     var nr = dictionary[event.currentTarget];
  15.     trace(nr);
  16.     if(nr==correctSolution)
  17.     {
  18.         trace('correct');
  19.     }
  20.     else
  21.     {
  22.         trace('wrong');
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment