Button Loop actionscript 2.0


/ Published in: ActionScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var cur:Number;
  2. var played:Boolean = false;
  3.  
  4. for (x = 1; x <= 3; x++)
  5. {
  6. eval ("clip_" + x + "_mc.hit").onRelease = play_clip;
  7. }
  8.  
  9. function play_clip ()
  10. {
  11. cur = this._parent._name.charAt (5);
  12. played = true;
  13.  
  14. for (x = 1; x <= 3; x++)
  15. {
  16. if (x != cur)
  17. {
  18. eval ("clip_" + x + "_mc")._alpha = 0;
  19. eval ("clip_" + x + "_mc.hit").enabled = false;
  20. }
  21. }
  22. //this.enabled = false;
  23. this._parent.play ();
  24. if (cur == 1){
  25. pic_frames.scaleTo(233, .5, 'linear');
  26. pic_frames.xSlideTo(124, .5, 'linear');
  27. pic_frames.ySlideTo(-26.8, .5, 'linear');
  28. pic_frames.frame_2.alphaTo(20, .5);
  29. pic_frames.frame_3.alphaTo(20, .5);
  30.  
  31. }else if(cur == 2){
  32. pic_frames.scaleTo(233, .5, 'linear');
  33. pic_frames.xSlideTo(-500, .5, 'linear');
  34. pic_frames.ySlideTo(-117, .5, 'linear');
  35. pic_frames.frame_1.alphaTo(20, .5);
  36. pic_frames.frame_3.alphaTo(20, .5);
  37. }else{
  38. pic_frames.scaleTo(233, .5, 'linear');
  39. pic_frames.xSlideTo(-1119, .5, 'linear');
  40. pic_frames.ySlideTo(-26.8, .5, 'linear');
  41. pic_frames.frame_2.alphaTo(20, .5);
  42. pic_frames.frame_1.alphaTo(20, .5);
  43. }
  44.  
  45. if(played && this._parent._parent._parent.instruction_mc._alpha != 0)
  46. {
  47. this._parent._parent._parent.instruction_mc.alphaTo(0, .5);
  48. }
  49. else
  50. {
  51. //do nothing;
  52. }
  53. }
  54.  
  55. function reset ()
  56. {
  57. pic_frames.scaleTo(100, .5, 'linear');
  58. pic_frames.xSlideTo(-12.1, .5, 'linear');
  59. pic_frames.ySlideTo(24.4, .5, 'linear');
  60. pic_frames.frame_1.alphaTo(100, .5);
  61. pic_frames.frame_2.alphaTo(100, .5);
  62. pic_frames.frame_3.alphaTo(100, .5);
  63. for (x = 1; x <= 3; x++)
  64. {
  65. eval ("clip_" + x + "_mc").gotoAndStop (1);
  66. eval ("clip_" + x + "_mc")._alpha = 100;
  67. eval ("clip_" + x + "_mc.hit").enabled = true;
  68. }
  69. }
  70. clip_1_mc.input_animation.enter_btn.onRelease = function() {
  71. trace(clip_1_mc.input_animation.input_txt.text);
  72. };

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.