Hi, We are using a different pattern for events. There should not be a Timer event in the core. Royale tries to use as few events as possible so classes reuse these event classes and store the event names in the class, not the event class.
Thanks, -Alex On 11/29/18, 6:01 AM, "[email protected]" <[email protected]> wrote: This is an automated email from the ASF dual-hosted git repository. carlosrovira pushed a commit to branch develop in repository https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&data=02%7C01%7Caharui%40adobe.com%7Cc82c8bab4eda4bcd732008d656032fb3%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636790969019175865&sdata=Ayc9pzAzdjc8jG03tiPCuRc63Xa5c8Ghk48BZgiNjV8%3D&reserved=0 The following commit(s) were added to refs/heads/develop by this push: new 2ec43a4 add TimerEvent and timerComplete event 2ec43a4 is described below commit 2ec43a4503588dd1b49019c1d75ba8ee3613982d Author: Carlos Rovira <[email protected]> AuthorDate: Thu Nov 29 15:01:30 2018 +0100 add TimerEvent and timerComplete event --- .../projects/Core/src/main/royale/CoreClasses.as | 1 + .../royale/org/apache/royale/events/TimerEvent.as | 68 ++++++++++++++++++++++ .../main/royale/org/apache/royale/utils/Timer.as | 1 + 3 files changed, 70 insertions(+) diff --git a/frameworks/projects/Core/src/main/royale/CoreClasses.as b/frameworks/projects/Core/src/main/royale/CoreClasses.as index e28bbda..ac4158b 100644 --- a/frameworks/projects/Core/src/main/royale/CoreClasses.as +++ b/frameworks/projects/Core/src/main/royale/CoreClasses.as @@ -155,6 +155,7 @@ import org.apache.royale.events.ItemRemovedEvent; ItemRemovedEvent; import org.apache.royale.core.StyleChangeNotifier; StyleChangeNotifier; import org.apache.royale.events.CustomEvent; CustomEvent; import org.apache.royale.events.Event; Event; + import org.apache.royale.events.TimerEvent; TimerEvent; import org.apache.royale.events.CloseEvent; CloseEvent; import org.apache.royale.events.CollectionEvent; CollectionEvent; import org.apache.royale.events.ProgressEvent; ProgressEvent; diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/TimerEvent.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/TimerEvent.as new file mode 100644 index 0000000..c20b491 --- /dev/null +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/TimerEvent.as @@ -0,0 +1,68 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to You 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 +// +// https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.apache.org%2Flicenses%2FLICENSE-2.0&data=02%7C01%7Caharui%40adobe.com%7Cc82c8bab4eda4bcd732008d656032fb3%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636790969019175865&sdata=9eyfZ3Ilh21WbAe7gIT7uf%2FtMQRFSj%2FFpbQtay3A%2BYQ%3D&reserved=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. +// +//////////////////////////////////////////////////////////////////////////////// +package org.apache.royale.events +{ + public class TimerEvent extends Event + { + /** + * Defines the value of the type property of a timer event object. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public static const TIMER:String = "timer"; + + /** + * Defines the value of the type property of a timerComplete event object. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public static const TIMER_COMPLETE:String = "timerComplete"; + + /** + * Creates an Event object with specific information relevant to timer events. + * + * Constructor. + * + * @param type The name of the event. + * @param bubbles Whether the event bubbles. + * @param cancelable Whether the event can be canceled. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.0 + */ + public function TimerEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) + { + super(type, bubbles, cancelable); + } + + COMPILE::JS + public function toString():String + { + return "[TimerEvent type=" + type + " bubbles=" + bubbles + " cancelable=" + cancelable + "]"; + } + } +} \ No newline at end of file diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Timer.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Timer.as index ddbee84..ab4e1fe 100644 --- a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Timer.as +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/Timer.as @@ -185,6 +185,7 @@ public class Timer extends EventDispatcher _currentCount++; if (repeatCount > 0 && currentCount >= repeatCount) { stop(); + dispatchEvent(new Event('timerComplete')); } dispatchEvent(new Event('timer'));
