Actionscript 3.0 - 用一个按钮改变不同帧的倒计时时间(Actionscript 3.0 -change the countdown time from a different frame with a button)

我有一个倒计时器在我的一个框架上,还有另一个框架上的两个按钮。 我想根据点击的按钮更改计时器。 例如:1分钟3分钟。 我还有一个导航按钮,可以放到定时器放置的框架上。任何想法?

i have a countdown timer on one of my frames and also two buttons on another frame . I want to change the timer based on the button clicked . For example : 1 min 3 min . I also have a navigation button which goes to the frame that the timer is placed.Any ideas?






The best way to propagate such event is by dispatching custom event when the button is clicked, while the frame that has the timer should be listening to that event.

To do so, you can extend the default "Event" class and create your custom event type that the timer frame should addEventListener to it and when the button is pressed, a dispatchEvent of the new event type should be called.

Or you can reuse any of the available events, for example when button1 is pressed, dispatch change event.

Hope this helps, goodluck.