/ Published in: ActionScript 3
Creates a Boolean that change to its inverted state after a specific time. Usage: var shouldIPop:TimeBoolean = new TimeBoolean(false, 200); if (!shouldIPop.state) return;
Expand |
Embed | Plain Text
package com.utils { /** * ... * @author Mattias Johansson * Creates a Boolean that change to its inverted state after a specific time. * Usage * var shouldIPop:TimeBoolean = new TimeBoolean(false, 200); * if (!shouldIPop.state) return; */ import flash.utils.Timer; public class TimeBoolean { private var _state:Boolean; public function TimeBoolean(defaultState:Boolean, milliSeconds:uint ) { _state = defaultState; var myTimer:Timer myTimer = new Timer(milliSeconds,1); myTimer.addEventListener("timer", function(){ _state = !defaultState; }); myTimer.start(); } public function get state() { return _state; } } }
You need to login to post a comment.
