ActionScript 3.0 :: Timers And Event Propagation?

Feb 8, 2010

I have a container named circleHolder_mc. Inside I have four circles named circ0_mc circ4_mc. My goal is to have each circle blink on mouseover. The closest I've got is the following code which causes all of the circles to blink at the same time.

circleHolder_mc.addEventListener(MouseEvent.MOUSE_OVER, onBlink)circleHolder_mc.addEventListener(MouseEvent.MOUSE_OUT, unBlink)
var timer:Timer = new Timer(1);timer.addEventListener(TimerEvent.TIMER, onTimer);
function onTimer(evt:TimerEvent):void{    alpha +=7;}
function onBlink(evt:MouseEvent):void{    timer.start();}    function unBlink(evt:MouseEvent):void{    timer.stop();    alpha = 100;}

View 16 Replies


Similar Posts:


Flex :: Why Need To Use Event Propagation

Feb 25, 2010

Why we need to use event Propagation?

View 1 Replies

ActionScript 3.0 :: Any Way To Prevent Event Propagation?

Feb 5, 2009

I have a movieclip containg several containers with other objects attached to them. Those containers have different levels of nesting. Now I want to add an EventListener to the top-level MovieClip and the called function uses attributes of this MovieClip. Because
of that I cannot just retrieve the MovieClip by saying e.target.parent but have to stop the propagation. I know there is a stopPropagation() method but I don't really get how (and when) to use it.

If I have sth like this:
function myResponse(e:Event):void {
//Things happening
} myMC.addEventListener(MouseEvent.CLICK, myResponse);

Where do I have to stop the propagation?

View 1 Replies

Actionscript 3.0 :: Event Propagation In PV3D?

May 18, 2009

how event propagation works in PV3D its definitely not like the conventional Flash style. On a quick search i have been able to find out that its possible using the InteractiveSceneManager Class, but unfortunately

View 1 Replies

ActionScript 3.0 :: Reach All The Children When Using Event Propagation?

Feb 24, 2010

I'm using Event Propagation in order to change the alpha of each Child on MOUSE_OVER, MOUSE_OUT, and MOUSE_DOWN using... evt.target.alpha On OVER the Child's alpha increases from 0 - 0.5. On OUT it goes from 0.5 - 0. On DOWN it goes to 0.5 and stays there even with a MOUSE_OUT. What I'd like to do is then add a button to the main stage which takes the visibility of all Children back to 0, a basic type of Clear button.

I have one way to do it where I list each Child in a function (all 9!). But can I re-write this so that all Children are effected writing so much code? Ideally I'd like to send a request to find the number of Children (9) and then use this variable to write a function which says (where 'n' is the Instance name of each Child) that n(0-numChildren).alpha = 0

[Code]...

View 3 Replies

ActionScript 3 :: Event Bubbling And Stop Propagation

Oct 18, 2011

What is the difference between event.bubbles to false for any event, And Setting event.stopPropagaion() or stopImmidiatePropagation() while handling event? I am using flex4 with as3.

View 3 Replies

ActionScript 3.0 :: Event Propagation With Masked Objects?

Sep 23, 2009

I have just learnt about event propagation and have made a few successful tests. However, I have encountered a problem when trying to use event propagation with several MovieClips that are masked and nested in a movieclip. The display list like so:
hd_cont > cndMask > cndThumbs > 9 movieclips with instance names box0, box1, etc etc.
I am attempting to scale the 9 movieclips at the bottom.

So I have tried:
Code:
hd_cont.addEventListener(MouseEvent.MOUSE_OVER, boxGrow);
hd_cont.addEventListener(MouseEvent.MOUSE_OUT, boxShrink);
function boxGrow(e:MouseEvent):void {
TweenLite.to(e.target, 1.5, {scaleX:1.5, scaleY:1.5, ease:Strong.easeOut});
e.target.alpha = .5;
[Code] .....

But when I reference the cndMask I get a
Code:
TypeError: Error #1010: A term is undefined and has no properties.
at gallery_fla::MainTimeline/gallery_fla::frame3()
message in the output panel.

View 3 Replies

Flex :: Debugging Focus And Keyboard Event Propagation In AS3

Dec 18, 2009

I have a custom TitleWindow component that is registered to listen for keyboard events from the user (so that esc closes the window, enter saves, etc.). However, in my testing I've found a couple cases where my keyboard event handlers don't fire. My best guess as to why this is happening is that there is some child component somewhere that has stolen focus and is stopping the keyboard events from propagating.

Unfortunately, due to the large number of components in my TitleWindow, I have no good way of knowing who has stolen the focus. My question then is, are there any good tips / techniques / tools for debugging focus issues and event propagation in Flex? Basically, I need something that will tell me who has the focus at any given time and who's handling an event at any given time... is that possible?

View 1 Replies

Flex :: Event Propagation Whilst Container Is Not Initialized

Jun 16, 2010

I have a Canvas (lets call it the Drop Box) which users can drag and drop external files onto. Next to this I have a ViewStack, of which one of the layers is a Canvas with a TileList. I have successfully managed to code it so that the items dropped onto the Drop Box appear in the TileList. I simply capture the darg drop event (lets call this event A) and dispatch a new one that the TileList is listening for (lets call this event B).

However, this only works if the ViewStack selectedIndex is set to that of the Canvas with the TileList. If the Canvas with the TileList isn't selected then the event listener which is added to the TileList at CreationComplete level (event B), won't be called until after the drag drop event has dispatched (event B). This means that something is firing before something even has a chance to listen for it!

I've tried looping until the Canvas with the TileList is completely drawn, but this causes the app to hang.

I've also tried passing the event to the Canvas and storing it locally, but when I attempt to access the clipboad of the event I get an error (dead clipboard).

Effectively I want to only dispatch the event to the Canvas after it's had a chance to load, and add the event listener to the TileList.

View 1 Replies

Actionscript 3 :: Flex 3 Event Propagation On A Composite Custom Component?

Jul 24, 2009

I have a custom component made up of a selectable control (radio button)and a text input. I want to perform some logic in response to the change events from both of those controls, but after that I want anything that is registered on the composite component's change handler to have a change to handle the events as well. The problem is, when I re-dispatch the events the event target has changed to my custom component, losing the originating event's target.

Here's my custom component:

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" label="{listItem.@text}" data="{listItem.@level.toString()}">
<mx:Script>

[code].....

In the event handler that receives change events from this component, I see that event.target is an instance of SpecifyRadioButton, not the TextInput or RadioButton, as I'd expect. How should I propagate the event to get what I want here?

Getting event [Event type="change" bubbles=false cancelable=false eventPhase=2]
from question0.tabSurvey.questionForm.questionContainer.Single94.VBox95.SpecifyRadioButton111

View 2 Replies

ActionScript 3.0 :: Propagation - Single Event Handler To Handle The Double Click

Jan 20, 2011

I have a couple of Sprites on my screen and I want to write a single event handler to handle the double click on any of those Sprites. The following approach works for every event type except DOUBLE_CLICK:

[Code]...

To make it work, because in my application I will have lots of Sprites. In my opinion, a single event and the target property are more efficient than hundreds of event listeners. Am I right or should add event listeners to every Sprite?

View 4 Replies

Flex :: Double Click Event Propagation On Datagrid Dependent On Component Order?

Mar 21, 2010

I'd like to have a double click event on a datagrid in Flex3. The following example only works if the Accordion (id = "mustBeSecond") container comes after the DataGrid. Why is the order of the components important and what can I do to prevent this behavior? (The example does not work. If you change the order of "mustBeSecond" and gridReportConversions" the example works fine)

<mx:Script>
<![CDATA[
import mx.controls.Alert;

[code].....

View 1 Replies

ActionScript 3.0 :: Timers Slowing - Making The Timers Reset At Lower Intervals?

Dec 13, 2010

In a game I'm making the timers that I use go one speed when I run it by pushing Ctrl-Enter in Flash but when I run the external .swf file created, the timers go considerably slower.I have managed to work around this by making the timers reset at lower intervals but I would rather not have to resort to this.

View 1 Replies

ActionScript 3.0 :: Mouse Event Propagation - Capture Independent Mouse Clicks On Both Of These Two Movie Clips?

Jan 22, 2009

I have a "large" movie clip and "small" movie inside a "large" movie clip but on it's let's say upper right corner:

Code:
largeMc.addChild(smallMc);[

If i try to catch Mouse.DOWN events on them the following way:


Code:
largeMc.addEventListener(MouseEvent.MOUSE_DOWN, largeClicked);
smallMc.addEventListener(MouseEvent.MOUSE_DOWN, smallClicked);

Then of course both event are captured no matter where i click.Is it possible to capture independent mouse clicks on both of these two movie clips and if so, how can i do that?

View 3 Replies

ActionScript 3.0 :: Mouse Event Propagation - Capture Independent Mouse Clicks On Both Of Two Movie Clips?

Jan 22, 2009

i have a following situation: I have a "large" movie clip and "small" movie inside a "large" movie clip but on it's let's say upper right corner:

Code:
largeMc.addChild(smallMc);

If i try to catch Mouse.DOWN events on them the following way:

Code:
largeMc.addEventListener(MouseEvent.MOUSE_DOWN, largeClicked);
smallMc.addEventListener(MouseEvent.MOUSE_DOWN, smallClicked);

Then of course both event are captured no matter where i click.Is it possible to capture independent mouse clicks on both of these two movie clips and if so, how can i do that?

View 5 Replies

ActionScript 3.0 :: Events - Propagation Equivalent For Siblings?

Aug 4, 2009

So I've got a project that loads some bitmaps and plonks each one on the display list with some events to allow me to drag them and click-to-front. It works fine by and large but if the bitmap is a PNG with transparency then normally clicking on a transparent bit will still trigger the events. I can get round that with a quick check of the pixel's alpha using hitTest no problem.

The issue I have is if there is a bitmap behind the front one showing through then I can't click on that. From Flash's POV I'm still clicking on the front-most clip as there is still something there, even if it is technically invisible, so the event is triggered 'properly'. From my point of view I want to click through that clip on the one behind it, like they were paper cutouts on a table.

I can't disable the top layer's mouseEnabled property because it still needs to listen for events. Either I need something like event propogation only with siblings on the display list or I'm going to have to maintain a list of all the relevant clips and keep checking they're under the mouse pointer. Obviously I'd rather the former at the latter is a kludge.

View 2 Replies

Make / Use 20 Separate Timers?

Jan 19, 2011

I need 20 separate timers, to be used with 10 separate objects, and need to be able to start, stop, and edit the delay time of each timer separately.

My question is; would having 23 timers going on simultaneously slow the program down, and is there a quick or easy way to mass-create and mass-edit timers (arrays? for/next loops? I'm pretty new to ActionScript...)

View 4 Replies

Actionscript 3 :: Making Timers Available For GC?

Dec 5, 2011

In a function that creates a new timer every time it is called, is this the correct way to dispose of it?

private var _timers:Vector.<Timer> = new Vector.<Timer>;
private var _timer:Timer
private function timer():void[code].........

View 2 Replies

ActionScript 3.0 :: Timers Acting Different Between OS?

Jan 7, 2010

I developed a flash/as3 animation recently which used a couple of timers. I devved on a mac and then transferred the fla to a pc. When I output the swf from the pc it acted different.The timers were much faster

View 0 Replies

ActionScript 3.0 :: Timers Acting Different With OS?

Jan 7, 2010

I developed a flash/as3 animation recently which used a couple of timers. I devved on a mac and then transferred the fla to a pc. When I output the swf from the pc it acted different. The timers were much faster. Has anyone seen this before?

View 1 Replies

IDE :: Use 2 Separate Timers In A Flash?

Mar 11, 2010

I'm trying to use 2 separate timers in a flash solution (CS4, AS3). The second timer won't fire. I need 2 constant events. one could drive the other

I'm displaying a different image every x seconds. I'm fading the old image out and then fading the new image in. Unfortunately, I've not been able to get these events to work in tandem. fade in and out times are both 2 secs & need to be sequential.

View 1 Replies

ActionScript 3.0 :: Looping Through Timers?

Mar 27, 2012

As far as I understand this should work, but it's not.The situation:A timer starts with a random number to determine how long it takes for a movieClip to spawn.When it spawns a second timer starts running for 2 seconds, after these 2 seconds the movieClip needs to be removed again and the first Timer starts again, again with a random number. But the comm between the Timers isn't running smoothly...The timer does get set to it's new value, it starts counting down again, but it never fires the if statement again.

PHP Code:
private function nBallTimerHandler(e:TimerEvent):void{nBallCnt--; trace(nBallCnt);if(nBallCnt = 0)

[code].....

View 14 Replies

ActionScript 2.0 :: Looping This Sequence Of Timers?

May 7, 2010

I would like a lightweight script that loops through an array, counting down to the next item in the array (over and over again).

Code:

countdown_dur = new Array ( [1,20,2,20,6] );

It would be perfect if this series of countdowns could repeat until the day is then done, and then start over again at 6:29AM the following day.[edit] The countdown_dur array holds the time (in minutes) for each countdown before the next begins.

View 2 Replies

ActionScript 3.0 :: How To Reset Multiple Timers

Oct 21, 2009

Action Script and I am having a rough time finding the solution to making my timersloop after the last timer has completed

Here is the code:
import fl.transitions.Tween;import fl.transitions.easing.*;
var learnDone:Timer=new Timer(3000);learnDone.addEventListener(TimerEvent.TIMER,

[code]......

View 11 Replies

ActionScript 3.0 :: Adding Countdown Timers?

Aug 30, 2011

I have this random movie player with 6 buttons that play the individual movies. The random movies have a title and a countdown timer that is working.I cannot make the timer work on the individual buttons.
 
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;[code]....

View 6 Replies

Flex :: Stop All Timers Running

Aug 11, 2009

I have a flex app that has several timers running for various amounts of time and for various reasons. I'd like to be able to stop all timers running if the user goes over a specified amount of time, but don't want to individually stop the timers using timer.stop(); Is there a way to stop all timers globally or find and iterate over all timers running and stop them?

View 1 Replies

Actionscript 3 :: Starting Many Timers At The Same Time?

Feb 2, 2012

var LevelCode:Array = [10,20,30,40,50,60,70,80,...,990,1000];
var Piece0:Timer = new Timer(50, LevelCode[0]);
var Piece1:Timer = new Timer(50, LevelCode[1]);
...
var Piece98:Timer = new Timer(50, LevelCode[98]);
var Piece99:Timer = new Timer(50, LevelCode[99]);

I want to start Piece0 timer, Piece1 timer, etc., at the same time. I tried Piece0+Piece1.start();, but it did not work.

View 3 Replies

ActionScript 3.0 :: Call Different Time For Timers?

Jun 18, 2009

I have a timer with a default value of 10 minutes. If the user selects some radio buttons, time should be able to change accordingly.

Problem is I don't know if it's possible to alter a timer once created. Using a switch/case I declared[code]...

View 6 Replies

ActionScript 3.0 :: Looping Multiple Timers?

Aug 5, 2009

There is probably an easier way to do this and I would be great full if someone has the solution. This code is on frame 1 and is the only frame in the .fla, I am trying to get it to start over once it finishes the last timer. What I really want to do is create a picture banner with 4 images visible at a time and each one transitions to 2 or 3 different images periodically. Is there a better way of doing this with code? I really don't want to animate this all on the time line. here is the code I have

ActionScript Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;

[code].....

View 2 Replies

ActionScript 3.0 :: Creating Timers Dynamically?

Oct 1, 2010

take an arbitrary variable, and create that number of timers, with a corresponding number of listeners? And then write a function to deal with the listeners?

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved