You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2013/03/25 20:39:59 UTC
[1/3] git commit: Try to change app to workaround FalconJS bug
Updated Branches:
refs/heads/develop b7325ceb7 -> 146dc0ac4
Try to change app to workaround FalconJS bug
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/dfa5aaf4
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/dfa5aaf4
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/dfa5aaf4
Branch: refs/heads/develop
Commit: dfa5aaf4946f14f39add248e2fed4e5eab5c3df2
Parents: b7325ce
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 25 12:38:38 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Mar 25 12:38:38 2013 -0700
----------------------------------------------------------------------
examples/FlexJSTest_again/src/MyInitialView.mxml | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dfa5aaf4/examples/FlexJSTest_again/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/FlexJSTest_again/src/MyInitialView.mxml b/examples/FlexJSTest_again/src/MyInitialView.mxml
index 22ce66b..246918e 100644
--- a/examples/FlexJSTest_again/src/MyInitialView.mxml
+++ b/examples/FlexJSTest_again/src/MyInitialView.mxml
@@ -26,7 +26,7 @@ limitations under the License.
import org.apache.flex.events.Event;
import org.apache.flex.utils.Timer;
- public var timer:org.apache.flex.utils.Timer = new org.apache.flex.utils.Timer(1000);
+ private var timer:org.apache.flex.utils.Timer;
public function get symbol():String
{
@@ -38,6 +38,13 @@ limitations under the License.
return input.text;
}
+ public function startTimer():void
+ {
+ timer = new org.apache.flex.utils.Timer(1000);
+ timer.addEventListener('timer', timerHandler);
+ timer.start()
+ }
+
public function timerHandler(event:org.apache.flex.events.Event):void
{
timerLabel.text = timer.currentCount.toString();
@@ -61,7 +68,7 @@ limitations under the License.
destinationPropertyName="dataProvider" />
</basic:beads>
</basic:List>
- <basic:TextButton text="Start Timer" x="100" y="75" click="timer.addEventListener('timer', timerHandler);timer.start()" />
+ <basic:TextButton text="Start Timer" x="100" y="75" click="startTimer()" />
<basic:TextButton text="Stop Timer" x="100" y="100" click="timer.removeEventListener('timer', timerHandler);timer.stop()" />
<basic:Label id="timerLabel" x="100" y="125" />
[2/3] git commit: Add new classes to SWC
Posted by ah...@apache.org.
Add new classes to SWC
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/fa1a15a0
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/fa1a15a0
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/fa1a15a0
Branch: refs/heads/develop
Commit: fa1a15a0c9de9b8c56724730d418d4ceac487d01
Parents: dfa5aaf
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 25 12:39:04 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Mar 25 12:39:04 2013 -0700
----------------------------------------------------------------------
frameworks/as/src/FlexJSUIClasses.as | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fa1a15a0/frameworks/as/src/FlexJSUIClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/src/FlexJSUIClasses.as b/frameworks/as/src/FlexJSUIClasses.as
index 3f62593..015e4df 100644
--- a/frameworks/as/src/FlexJSUIClasses.as
+++ b/frameworks/as/src/FlexJSUIClasses.as
@@ -41,6 +41,8 @@ internal class FlexJSUIClasses
import org.apache.flex.html.staticControls.beads.models.ToggleButtonModel; ToggleButtonModel;
import org.apache.flex.html.staticControls.beads.models.ValueToggleButtonModel; ValueToggleButtonModel;
import org.apache.flex.html.staticControls.beads.models.ArraySelectionModel; ArraySelectionModel;
+ import org.apache.flex.events.CustomEvent; CustomEvent;
+ import org.apache.flex.utils.Timer; Timer;
}
}
[3/3] git commit: JS side of Timer and app
Posted by ah...@apache.org.
JS side of Timer and app
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/146dc0ac
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/146dc0ac
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/146dc0ac
Branch: refs/heads/develop
Commit: 146dc0ac49c656a944bdc80b3adf029e2bfc456a
Parents: fa1a15a
Author: Alex Harui <ah...@apache.org>
Authored: Mon Mar 25 12:39:20 2013 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Mar 25 12:39:20 2013 -0700
----------------------------------------------------------------------
.../src/org/apache/flex/events/EventDispatcher.js | 22 ++
.../js/FlexJS/src/org/apache/flex/utils/Timer.js | 157 +++++++++++++++
2 files changed, 179 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/146dc0ac/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
index dba2c3c..b686db2 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/EventDispatcher.js
@@ -47,6 +47,28 @@ org.apache.flex.events.EventDispatcher.prototype.addEventListener = function(typ
/**
* @this {org.apache.flex.events.EventDispatcher}
+ * @param {string} type The event type.
+ * @param {function(?): ?} fn The event handler.
+ */
+org.apache.flex.events.EventDispatcher.prototype.removeEventListener = function(type, fn) {
+ if (!this.listeners_.type) {
+ return;
+ }
+
+ var listeners = this.listeners_[type];
+ var n = listeners.length;
+ for (var i = 0; i < n; i++)
+ {
+ if (fn == listeners[i])
+ {
+ listeners.splice(i, 1);
+ break;
+ }
+ }
+};
+
+/**
+ * @this {org.apache.flex.events.EventDispatcher}
* @param {Object} event The event to dispatch.
*/
org.apache.flex.events.EventDispatcher.prototype.dispatchEvent = function(event) {
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/146dc0ac/frameworks/js/FlexJS/src/org/apache/flex/utils/Timer.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/utils/Timer.js b/frameworks/js/FlexJS/src/org/apache/flex/utils/Timer.js
new file mode 100644
index 0000000..ca18e8e
--- /dev/null
+++ b/frameworks/js/FlexJS/src/org/apache/flex/utils/Timer.js
@@ -0,0 +1,157 @@
+/**
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+goog.provide('org.apache.flex.utils.Timer');
+
+goog.require('org.apache.flex.FlexGlobal');
+goog.require('org.apache.flex.events.EventDispatcher');
+
+/**
+ * @constructor
+ * @extends {org.apache.flex.events.EventDispatcher}
+ */
+org.apache.flex.utils.Timer = function(delay, repeatCount) {
+ org.apache.flex.events.EventDispatcher.call(this);
+
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this.timerInterval = -1;
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this._delay = delay;
+
+ /**
+ * @private
+ * @type {number}
+ */
+ this._currentCount = 0;
+
+
+ if (typeof(repeatCount) != 'undefined')
+ {
+ this._repeatCount = repeatCount;
+ }
+
+};
+goog.inherits(org.apache.flex.utils.Timer,
+ org.apache.flex.events.EventDispatcher);
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * Stops the timer and sets currentCount = 0.
+ */
+org.apache.flex.utils.Timer.prototype.reset = function() {
+ this.stop();
+ this._currentCount = 0;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * Stops the timer.
+ */
+org.apache.flex.utils.Timer.prototype.stop =
+ function() {
+ clearInterval(this.timerInterval);
+ this.timerInterval = -1;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * Starts the timer.
+ */
+org.apache.flex.utils.Timer.prototype.start =
+ function() {
+ this.timerInterval = setInterval(org.apache.flex.FlexGlobal.createProxy
+ (this, this.timerHandler),
+ this._delay);
+};
+
+/**
+ * @private
+ * @this {org.apache.flex.utils.Timer}
+ */
+org.apache.flex.utils.Timer.prototype.timerHandler =
+ function() {
+ this._currentCount++;
+ if (this._repeatCount > 0 && this._currentCount >= this._repeatCount)
+ this.stop();
+
+ var evt = document.createEvent('Event');
+ evt.initEvent('timer', false, false);
+ this.dispatchEvent(evt);
+
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * @returns {Number} The currentCount.
+ */
+org.apache.flex.utils.Timer.prototype.get_currentCount = function() {
+ return this._currentCount;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * @returns {boolean} True if the timer is running.
+ */
+org.apache.flex.utils.Timer.prototype.get_running = function() {
+ return this.timerInterval != -1;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * @returns {Number} The number of milliseconds between events.
+ */
+org.apache.flex.utils.Timer.prototype.get_delay = function() {
+ return this._delay;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * @param {Number} value The number of milliseconds between events.
+ */
+org.apache.flex.utils.Timer.prototype.set_delay = function(value) {
+ this._delay = value;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * @returns {Number} The repeat count.
+ */
+org.apache.flex.utils.Timer.prototype.get_repeatCount = function() {
+ return this._repeatCount;
+};
+
+/**
+ * @expose
+ * @this {org.apache.flex.utils.Timer}
+ * @param {Number} value The repeat count.
+ */
+org.apache.flex.utils.Timer.prototype.set_repeatCount = function(value) {
+ this._repeatCount = value;
+};