Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function fl_ClickToHide(event: MouseEvent): void {
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.IntelligenceW.visible = false;
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.AgilityW.visible = false;
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.StrengthW.visible = true;
- }
- button_7.addEventListener(MouseEvent.CLICK, fl_ClickToHide_2);
- function fl_ClickToHide_2(event: MouseEvent): void {
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.StrengthW.visible = false;
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.IntelligenceW.visible = false;
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.AgilityW.visible = true;
- }
- button_8.addEventListener(MouseEvent.CLICK, fl_ClickToHide_3);
- function fl_ClickToHide_3(event: MouseEvent): void {
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.StrengthW.visible = false;
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.AgilityW.visible = false;
- Idle_mc.Idle_hw_mc.CrystalW_mc.Attribute_mc.IntelligenceW.visible = true;
- }
- package
- {
- import flash.events.Event;
- import flash.events.EventDispatcher;
- public class AppData
- {
- static public const D:Object = new Object;
- static public const E:Event = new Event(Event.CHANGE);
- static public const I:EventDispatcher = new EventDispatcher;
- static public function has(key:String):Boolean
- {
- return D.hasOwnProperty(key);
- }
- static public function read(key:String):*
- {
- return D[key];
- }
- static public function write(key:String, value:*):void
- {
- if (value === null)
- {
- delete D[key];
- }
- else
- {
- D[key] = value;
- }
- I.dispatchEvent(E);
- }
- }
- }
- import AppData;
- import flash.events.Event;
- // The last argument is important, because timeline objects are
- // auto-removed if their parent's timeline instructs so, thus
- // you won't be able to locate them and unsubscribe, which,
- // in turn, means they will hang in the memory forever.
- // Still, if you subscribe them with useWeakReference
- // set to true, they will be removed normally
- // and unsubscribed automatically.
- AppData.I.addEventListener(Event.CHANGE, onChange, false, 0, true);
- // Call once in order to forcibly sync the object with the data.
- onChange(null);
- function onChange(e:Event):void
- {
- if (AppData.has("red.alpha"))
- {
- alpha = AppData.read("red.alpha");
- }
- else
- {
- alpha = 1;
- }
- }
- import AppData;
- AppData.write("red.alpha", 0.3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement