ActionScript 3.0 :: Routing Mouse Events Through A Sprite?

Jul 27, 2009

In a pure ActionScript 3 project, I have a sprite that overlaps another sprite. The lower sprite normally handles mouse clicks. The lower sprite no longer processes mouse events when it is overlapped by the higher sprite. I would like the lower sprite to handle mouse events when it is overlapped. (In my particular instance, the higher sprite is just a decorative piece; it has no normal mouse interactivity anyway.) Is this possible? Is there a way to route mouse events through the higher sprite?

View 3 Replies


Similar Posts:


ActionScript 3.0 :: Make A Sibling Sprite Transparent To Mouse Events?

Jun 10, 2010

Essentially, the simplified problem is this: I have a parent sprite "PARENT" with two children: One child sprite "A" that contains a number of children which respond to mouseover/mouseout and rollover/rollout events, and a second child sprite "B" that is shown/hidden based on the events in "A".

The problem is that "B" appears over "A" on the stage and when the mouse enters "B", the children in "A" throw mouseout/rollout events. Ideally, I would be able to make "B" completely mouse transparent so that the hit testing in AS3 will "see through it" to the underlying "A" sprite, but this doesn't seem possible.

Note that "B" has mouseEnabled and mouseChildren set to false... but the problem seems to be that the AS3 hit testing engine won't look at siblings when determining mouse hit testing. (i.e. It sees "B" under the mouse, sees the mouseEnabled=false setting, and then moves on to "B"'s parent ("PARENT"), but never checks to see if "A" is under the mouse (which it is)).

I can't make "B" a child of "A", because "A" is clipped and "B" needs to extend beyond this clipping area.

At this point I'm thinking I'm going to have to do my own hit testing, which is far from ideal given that "A" contains a large number of children.

View 4 Replies

Flash :: Transparent Parts Of Sprite Responding To Mouse Events

Jul 17, 2010

I'm making a puzzle game in Flash cs5/as3 which can have custom puzzle shapes. Basically, the user can draw basic protrusions of a puzzle. Then I create a black and white puzzle piece with a custom function like this var piece:PuzzlePiece= new PuzzlePiece(true,true,false,false); PuzzlePiece is a class that extends Sprite. The four arguments correspond to the four sides of a puzzle piece (up, down, left, right). If the argument is true, it means that protrusion should stick out of that side of puzzle piece. If it's false, it should have a hole on that side, so it fits the protrusion. I first attach the protrusions that stick out, then i flip the protrusions that stick in, attach them to a new sprite (in_part) and invert them with the following function:

[Code]...

View 2 Replies

ActionScript 3.0 :: Override Event Target - Move Other Sprite According To The Mouse Events On The Stage

May 27, 2009

i am trying to do a simple blackboard on mouse down, start drawing on mouse move, if drawing, draw line on mouse up, stop drawing i set the listeners on a simple clip with a rectangle. if i dont fill the rectangle, the mouse events wont fall into the rectangle, but if i fill the rectangle, it will paint behind the rectangle, so anyway i wont see any succesfull results. what i did was create another sprite and paint within it; something like

[Code]...

View 3 Replies

ActionScript 3.0 :: Textfield.htmlText Link Doesn't Receive Mouse Events Underneath Sprite?

Oct 28, 2010

TextFiled is not receiving mouseEvents, coz of the sprite on top:

[Code]...

View 3 Replies

ActionScript 3.0 :: Control Mouse Events With Other Mouse Events?

Feb 12, 2012

Right now all the sounds (78 of them) on my guitar play using the roll_over event but that doesn't give the user much control over what sound is played.
 
The actionscript im using to play my sounds is this;
 
for(var i:uint = 0; i < buttonArray.length; i++){
buttonArray[i].addEventListener(MouseEvent.ROLL_OVER, buttonRolledOver);
}

[Code]....
 
What i want to do is only play a sound with the roll_over event when the left click is held down.

View 18 Replies

Actionscript 3 :: Iphone - Touch Events Vs Mouse Click Events?

Jan 11, 2012

Just wanted to ask if there is any advantage for either using mouse click event or touch tap events, when writing apps for mobiles or tablets (for the iphone especially)?

I know that both of them should work fine, but in term of performance, is anyone better? Are there any things I should be aware of when choosing either?

By the way am using actionscript3 to implement the app.

View 3 Replies

ActionScript 3.0 :: Mixing Stage Mouse Events And Children Events?

Sep 30, 2009

I have an animation that I want to start when clicking on the flash window. However, I've also have some buttons on the stage. If I add an event listener for MouseEvent.CLICK on the stage, then it 'eats up' the events and the buttons don't work.

I've tried some tricks, by adding some invisible buttons on top of the real ones, and use the MOUSE_OVER event to selectively enable/disable the mouseEnabled flag for the stage, but didn't work because it complains that the property or method doesn't exist (which I find odd).

View 3 Replies

Flex :: Sprite Not Receiving Keyboard Events?

Jan 14, 2011

I have a Sprite which is a child of a Flex object, and acts as the main "game window". So during game-play it should get keyboard input but at other times not. When I add a keyboard listener to it, it never fires.

Do I need to stop parent objects 'eating' the events somehow, or something similar? I get the same thing with mouse-wheel events, but mouse-click events are fine. Sprite doesn't seem to have the concept of focus unless I missed it.

More generally in this kind of approach, are there any suggestions on the best way? For instance some keys might still be needed to be intercepted before getting to the game-window, like ESC or F1 or something... the aim is the game-window isn't aware of other UI.

View 3 Replies

ActionScript 3.0 :: Duplicate A Sprite With All Its Children And Events?

May 10, 2011

I am trying to duplicate a sprite that I loaded a bunch of images in from an xml.

I even tried senocular's way of duplicating display objects and it just returned an empty sprite.

View 2 Replies

ActionScript 3.0 :: Movieclip Being Dragged Is Blocking The Mouse From Initiation Mouse Events Properly?

Jun 2, 2010

In a project i'm doing I have a custom cursor, using the start drag command and mouse.hide. the issue being that the movieclip being dragged is blocking the mouse from initiation mouse events properly.

View 3 Replies

ActionScript 3.0 :: MOUSE_OVER Listener - Animation Is Triggered Both On Mouse Over And Mouse Out Events

Aug 2, 2009

I have a movie clip I am using as a button (instance name btn1) and I added an event listener to it (using the following line): btn1.addEventListener(MouseEvent.MOUSE_OVER, animate1); the function "animate1" triggers some small animation when the mouse is over the movieclip. my problem is that the animation is triggered both on mouse over and mouse out events.

View 5 Replies

ActionScript 3.0 :: Mouse Events Fail To Trigger If Mouse Move Too Fast?

Nov 18, 2009

It has been awhile since I have worked in flash.Right now I am working on something where I would like a panel to disappear when someone mouses off the stage.stage.addEventListener(Event.MOUSE_LEAVE, leaveHandler); It usually works fine but if I move my mouse really fast it doesn't fire. I have also tried the same thing using a custom invisible button that surounds the perimeter of the stage and I have tried ROLL_OVER and MOUSE_OVERand again, if I do it too fast my event doesn't fire (I am using trace)I can't find anything on the net about this - is this typical of flash that if you move your mouse too fast you break it? Do I need to increase my frame rate (I would really rather not because I have perfectly timed animations - I am at 30 frames per second)

View 1 Replies

ActionScript 3.0 :: Using Mouse Events (mouse Leave) For Conditional Statements?

Dec 14, 2010

I have a menu drawer at the edge of the screen that shows when the user rolls the mouse over it, but if the user overshoots it an moves the cursor slightly outside the browser window this is unfortunenatly registered as a mouse out.

I want to stop this by using event.MOUSE_LEAVE, but i need to use it as a condition not to triger a "leaveHandler".

View 3 Replies

Javascript :: Routing Different Youtube Videos Sound To Different Outputs?

Feb 22, 2011

I want to have 2 different youtube videos (instantiated using the js api) on a page and I want to route the sound from one of them to the regular speakers and the sound from the other one to the headphones.

View 1 Replies

Flash - Flex 3: Preventing Keyboard Events From Reaching A Sprite?

Feb 9, 2012

I'm working on a Flex 3 app, implemented in Actionscript 3 and MXML, that includes an embedded video player, which is essentially a black box--I load it as a SWF from another site on demand, and I don't have access to its source code. It does, however, inherit from Sprite.The problem is that, when focus is on the Flash app, the video player is somehow receiving and processing keyboard events, even when the player itself isn't in focus.So when users are typing text elsewhere in the GUI, if they hit the space bar, the video pauses.

I've tried intercepting key events in the Sprite's parent, and setting tabEnabled = false, tabChildren = false, and buttonMode = false on the Sprite, but nothing seems to work. It's as if the Sprite is getting keystrokes through an alternate Event path.how I can prevent the player from receiving keyboard events or input events entirely? It's fine with me if no input events reach the player, since I've implemented my own,separate video controls.

View 1 Replies

ActionScript 3.0 :: Spurious Mouse Out Events When Moving The Mouse Down Or Right

Dec 4, 2008

why i am getting spurious mouse_out events when moving the mouse down or right but not up or left over a Sprite?

View 3 Replies

Flex :: Mouse-event - Using 2 Distinct Mouse Events?

Mar 14, 2011

I am looking to provide some UI functionality using the mouse- I have two distinct UI events to be achieved via mouse

a) change value
b) delete object

I don't seem to have sufficient mouseclick events for both. I am avoiding using the right click as it has some default options(whose signing off will affect the whole project- not just this). I have mouse click used for change value- how do I use the doubleclick as the single-click events seems to get invoked prior?

View 2 Replies

Sprite Y Based On Mouse Position?

Jul 20, 2011

So I'm working on my portfolio and I got this problem. The code posted scrolls the sprite "cellContainer" based on the position of stage.mouseY. Perfect.Problem is that I want stage.mouseY to equal the entire cellContainer height. Kind of like how a small tablet equals a huge monitor. So when stage.mouseY = 0,cellContainer.y = 0 and when stage.mouseY = stage.stageHeight, cellContainer.y = stage.stageHeight - cellContainer.height. Right now, it scrolls, but it takes a while to scroll throught the entire height of cellContainer. I want it to be proportional to stage.mouseY.

Actionscript Code:
private function scrollStart(e:Event)[code]....

View 4 Replies

Catch Mouse Event On Sprite?

Sep 14, 2009

i want to know how to catch mouse event on sprite.I have created a class which extends Sprite and then tried to catch mouse event on it. but not successful.so is it neccessary to draw something on it to catch events?

View 1 Replies

ActionScript 2.0 :: How To Disable Mouse On A Sprite

Oct 2, 2006

I have a Sprite with a collection of bitmaps wich i addChild and removeChild according to the script. However, i need it to not interfer with the buttons with MOUSE_OVER Sprites below.There is a property in the DisplayObjectContainer wich is .mouseChildren, however, i want the container itself to be false, not the children (wich is only Bitmap's anyway

View 1 Replies

ActionScript 3.0 :: Scale Sprite With Mouse?

Jan 23, 2010

How might I go about making a sprite scale by dragging on it with the mouse? All my attempts so far have led to unexpected scaling effects...

View 1 Replies

ActionScript 3.0 :: Detect Whether The Mouse Has Been Clicked Outside Of A Sprite?

Oct 28, 2008

Version: CS3, Flash AS3.

I want to detect whether the mouse has been clicked outside of a sprite (ie. a mouse click event anywhere on the screen except the sprite).

The idea is that you click outside an activated sprite to deactivate it. This is how menus and comboboxes function, but I can't see any way of doing it in actionscript.

View 2 Replies

Flex :: How To Create Up / Down Movement Of Sprite With Mouse

Mar 11, 2010

I need to move a sprite only vertically on mouse move. How do I implement it with as3?

View 3 Replies

ActionScript 3.0 :: Values Of Mouse X / Y Changing For Same Sprite?

Jan 2, 2010

I'm confused that values of mouseX&Y properties for a same sprite are changing as its scaling (when you make scaleX out of 1.0). I would like to know the precise mechanism (or detailed definition) of MouseX, MouseY property.

View 6 Replies

ActionScript 3.0 :: Clearing A Sprite On Mouse Click?

Mar 4, 2011

I am new at AS3 and for a simple task it seems I have a lot of code but here is my problem.The code below displays wind direction and the speed of it, but I want to convert that code into a re-usable function where each time displaySprite (after adding and event listener ie: displaySprite.addEventListener(MouseEvent.MOUSE_CL ICK, clearAndRedraw); ) gets clicked it will redraw the same sprite with new information.

Code:
import flash.text.TextField;
import flash.text.TextFormat;

[code].....

View 2 Replies

Actionscript 3 :: Mouse Over Change Sprite Graphics Color?

Sep 16, 2010

I have created a sprite as below:

var arrowHeadRight:Sprite = new Sprite();
with(arrowHeadRight.graphics){
beginFill(0xDDDDDD, 1);
moveTo(50,0);
lineTo(0,50);

[Code]...

On Mouse Over, I wish to change the color of the fill on this shape? Can this be done or do I have to re-draw the graphics with an updated beginFill line?

View 1 Replies

ActionScript 3.0 :: Fading A Sprite Based On Mouse Location?

Dec 11, 2009

The idea is there are two buttons(Sprites), one on the left & one on the right, when either button is moused over a the script should start setting the alpha of the relevant visible element. (i'm not worried that they both would be fading out as the mouse moves left to right at this point)

ActionScript Code:
private function turnOnInterfaceHinting():void {
this.addEventListener(Event.ENTER_FRAME, InterfaceHinting);
}

[Code].....

View 3 Replies

ActionScript 3.0 :: Mouse Event For Bitmaps Within Sprite Container?

Jul 21, 2011

I have stuck a bitmap into a display object container (Sprite). On a given mouse event (i.e. mouse click), I would like to display the x and y coordinates of the bitmap. However, I've realized upon clicking on the bitmap, the event is only recognizing the higher level Sprite container. I suspect this could be attributed to the simple fact that bitmaps are not InteractiveObjects.If it's I have attached the code. I am loading a master image and cloning it to produce a thumbnail image (bitmap). Mouse events with the container holding the master image recognize the image itself while the container holding the thumbnail only recognizes the Sprite container.

Code:
var ldr1:Loader=new Loader();
var url1:URLRequest=new URLRequest("PhotoGallery0/picture0.jpg");

[code].....

View 9 Replies

ActionScript 2.0 :: Mouse Events In CS3

Feb 11, 2011

I used to play around with flash during the early days of action script 1.but now i can't seem to find my way around it. Used to be able to add the script to the button itself.[code]what I want to do is to have a toggle button show and hidethe objects on the movie.

View 1 Replies







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