Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. function fl_ClickToHide(event: MouseEvent): void {
  2. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.IntelligenceW.visible = false;
  3. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.AgilityW.visible = false;
  4. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.StrengthW.visible = true;
  5. }
  6.  
  7. button_7.addEventListener(MouseEvent.CLICK, fl_ClickToHide_2);
  8.  
  9. function fl_ClickToHide_2(event: MouseEvent): void {
  10. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.StrengthW.visible = false;
  11. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.IntelligenceW.visible = false;
  12. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.AgilityW.visible = true;
  13. }
  14.  
  15. button_8.addEventListener(MouseEvent.CLICK, fl_ClickToHide_3);
  16.  
  17. function fl_ClickToHide_3(event: MouseEvent): void {
  18. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.StrengthW.visible = false;
  19. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.AgilityW.visible = false;
  20. Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.IntelligenceW.visible = true;
  21. }
  22.  
  23. package
  24. {
  25. import flash.events.Event;
  26. import flash.events.EventDispatcher;
  27.  
  28. public class AppData
  29. {
  30. static public const D:Object = new Object;
  31. static public const E:Event = new Event(Event.CHANGE);
  32. static public const I:EventDispatcher = new EventDispatcher;
  33.  
  34. static public function has(key:String):Boolean
  35. {
  36. return D.hasOwnProperty(key);
  37. }
  38.  
  39. static public function read(key:String):*
  40. {
  41. return D[key];
  42. }
  43.  
  44. static public function write(key:String, value:*):void
  45. {
  46. if (value === null)
  47. {
  48. delete D[key];
  49. }
  50. else
  51. {
  52. D[key] = value;
  53. }
  54.  
  55. I.dispatchEvent(E);
  56. }
  57. }
  58. }
  59.  
  60. import AppData;
  61. import flash.events.Event;
  62.  
  63. // The last argument is important, because timeline objects are
  64. // auto-removed if their parent's timeline instructs so, thus
  65. // you won't be able to locate them and unsubscribe, which,
  66. // in turn, means they will hang in the memory forever.
  67. // Still, if you subscribe them with useWeakReference
  68. // set to true, they will be removed normally
  69. // and unsubscribed automatically.
  70. AppData.I.addEventListener(Event.CHANGE, onChange, false, 0, true);
  71.  
  72. // Call once in order to forcibly sync the object with the data.
  73. onChange(null);
  74.  
  75. function onChange(e:Event):void
  76. {
  77. if (AppData.has("red.alpha"))
  78. {
  79. alpha = AppData.read("red.alpha");
  80. }
  81. else
  82. {
  83. alpha = 1;
  84. }
  85. }
  86.  
  87. import AppData;
  88.  
  89. AppData.write("red.alpha", 0.3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement