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
Similar Posts:
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
Oct 3, 2010
I'm a bit boggled by a MouseEvent/layering problem.
I have a filled Shape, with alpha 0.5, on top of a Sprite. The Sprite has various MouseEvent listeners attached to it.
I'd like the user to be able to click on the Sprite. Unfortunately, Flash doesn't pass the events to the Sprite. (It does, of course, if the shape is unfilled.)
Is there any way to tell Flash to treat this object like an unfilled object, rather than a filled one, for the purpose of MouseEvents?
View 5 Replies
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
Dec 20, 2011
What I have is a bitmap as render cache for a sprite, and there're many of them present on the stage. I expected that they would react like sprites with mouse-click event, but they didn't. They're like rectangles all around, matter what the original sprite look like, And I tried put bitmap cache into sprite container and use sprite's hitArea property like [code]...
View 1 Replies
Aug 25, 2009
I have objects that the user can click&drag. They're PNGs, mainly rectangular, no problem till here.But I then had to put an L-shaped object (a PNG with a lot of transparency), so i've made a movieclip with an shape with the same L shape than the png, and use it as its hitArea:
shape.visible= false;
shape.mouseEnabled= false;
obj.addChild(shape);
obj.hitArea= shape;
This works PERFECT, the mouse events respond as expected, and I can click on objects that are below/above the transparent area of the png/object.All objects are inside a Sprite called playgroundLayer1. The issue comes when I take the L-shaped object and put it on another Sprite (playgroundLayer2), that is above the playgroundLayer1.I this case, I can click&drag on the L, but no object below the transparent area of the L receives mouse events.
View 8 Replies
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
Mar 30, 2011
having problems adding parts of a snake on through timer events
package {
import flash.display.Sprite;
import flash.events.KeyboardEvent;[code]....
View 1 Replies
Oct 28, 2010
TextFiled is not receiving mouseEvents, coz of the sprite on top:
[Code]...
View 3 Replies
Nov 13, 2009
I found an old post from January that suggested saving the original image as an SWF via Illustrator. I tried it, but my clip is still registering clicks in transparent areas.
Here's a link. [URL]
All I'm trying to do is allow the drawing to be dragged around the screen, but I don't want it to be clickable in the transparent areas where the green background shows through.
how to eliminate the pale cast that the transparent areas are making? The background to the drawing shows totally transparent in Photoshop, but the boundaries of the movie are visible because the supposedly transparent areas of the movie are slightly masking the background.
View 7 Replies
Feb 4, 2011
I have some code that builds a shape and adds a shadow filter. If I use a single call to make the shape, like drawRect() or drawRoundRect() all looks fine including the shadow. However, when I do something like:
Code:
shape= new Shape();
shape.graphics.beginFill(0xfffffff, 1);
shape.drawRect();[code]...
The boundaries of these draw calls do overlap each other. The final shape by itself looks fine. But as soon as I add the shadow filter, parts of the shape get transparent. I belief it has to do with the various draw calls within begin and end fill.
View 1 Replies
Apr 11, 2012
Is it posible to custom flash to behave like powerpoint ? can it move to next and previous scene by clicking on keyboard arrows or by using the mouse wheel?
View 1 Replies
Dec 27, 2011
I have a actionscript "Sprite" class which load a transparent png. When i set a "mouseover" event over the Script, it is throw when the mouse goes over the "square" containing the transparent png. I would like a glow effect to be displayed on mouseover, but only when the mouse is on the displayable part of my transparent .png. How can i do to throw the event only when the mouse is not over the transparent part of the png? Do i have to check by myself in the mouseover handler then do what i have to do?
View 2 Replies
Oct 11, 2009
So I've got this function to make a sprite walk:
[Code]....
But what do I have to do to get the function to adress various versions, such as
chibi.bluejeans1.rtleg._y = 4 + walk; chibi.bluejeans1.ltleg._y = 5 - walk;
so that I can address each type for walking accordingly, through something like
wlk(tunicpants1);
wlk(bluejeans1);
wlk(tuxedopants1);
[Code]....
View 1 Replies
Jan 18, 2011
I am attempting to use custom cursors with AS3. I created a movie object that i position using:
function mouseMoved(event:MouseEvent) {
mousePointer.x = this.mouseX;
mousePointer.y = this.mouseY;
}
and calling Mouse.hide()
This works fine in that the custom cursor follows the mouse, but I am having troubles using events with the cursor. I have several click events on several buttons. The events do not trigger when using the custom cursor. In my ignorance I would imagine the problem is that the custom cursor movieclip is on top of the button, and so click events are only generated for it, and not the button.
View 4 Replies
Oct 2, 2011
I have a Sprite that contains opaque objects surrounded by transparent pixels. I also have a Rectangle that represents a part of the Sprite that I want to render using BitmapData.draw(). The problem is that the Rectangle that I obtained also contains transparent parts. How can I narrow the Rectangle to only include the opaque parts and ignore the transparent surroundings?
kapep's answer is just what I want to do, but the problem is that the source is a Sprite, not a BitmapData object, and I don't have getColorBoundsRect() on a Sprite.
View 2 Replies
Feb 3, 2010
I have a flash that has a background symbol that responds to CLICK event. On top of that symbol I have a sprite that contains a Bitmap with transparent pixels. Both of them are added to the stage, so they are not related directly.
I want clicks on the transparent pixels on the sprite to go straight through to the background. I have read about mouseEnabled / mouseChildren but have not been able to make these work. The symbol ignores the mouse events when I use them, but does not pass it along as if its transparent.
Is this possible to do with flash? Or will I have to re-route mouse events?
View 2 Replies
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
Apr 3, 2010
I have loaded an swf A into swf B where it is placed at the bottom of the stack
usingsetChildIndex(loader,0)
And masked by MovieClips within swf B using
setChildIndex(myMC,numChildren - 1);
Swf A by itself works fine, but when it is loaded into swf B the arrow keys still work, but the Mouse doesn't seem to be detected by swf A. [URL]
View 3 Replies
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
Jan 11, 2011
I got this expendable Bigbox I made for my client. All works well. The only problem I have is that, where there is a quick mouse (not event THAT quick) rollout, the action (closes the expended portion) doesn't work.It get's stuck and doesn't gotoAndStop(1).
[Code]...
View 1 Replies
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
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
Mar 25, 2010
I would like to make a flash movie with a picture, where when the user holds down the mouse button, part of another picture will emerge in that general area (like a magnifying glass looking into another dimension).
Technically, my idea was to make a flash file with two images, and then code the mouse to be able to make the top picture transparent in a circle-like area around the cursor, while the mouse button is down.
But how to do that? I am using Flash CS4, but I don't really care if the solution is in AS2, or AS3, as long as it works
View 2 Replies
Nov 6, 2010
I dont know if it is possible, but I need to disable reaction on mouse.
Here is the example. Dont worry about the second snowboard. If mouse remains on the first, movie still replay over and over. How do I stop it?
[URL]
View 1 Replies
May 18, 2010
I'm working with actionscript 3 and have a trouble. I need to write player where users will see text on the front of the movie. The text is text field of type "Dynamic text". The problem is that I need to make this text object transparent for mouse move and clicks.
I tried:
.mouseEnabled=false;
.selectable=false;
when I click on it - it does not pass clicks through it.
View 1 Replies
Jul 8, 2010
Here's a link to a particle explosion generator with many options to play with and it saves a transparent png sprite sheet: [URL] The same particle engine is used in my latest game:Tank Rush. But since my next game will use only sprite sheets for effects, I created this generator out of the tank rush engine.
View 2 Replies
Feb 21, 2012
In my isometric flash game I have some models with long shadows. I want to ignore the mouse events (move, click, down and up) when the user performs any action on the shadow part of the image. (see sample image) I know there is a way we can do it by creating a mask in flash. But what if I want to handle it on the .png images (bitmap)? Do I need to create a mask image for all such images? I think it will be very big deal unless there are easy ways (using tools in Photoshop).
[Code]....
View 1 Replies
Dec 5, 2011
I have a flash object which dimension and position are as same as the HTML button. The button is under the flash object. I want when the flash is clicked and hovered, the button has the styles as if it is clicked and hovered at the same time. I am trying to call: ExternalInterface.call("mouseEventHandle", elementId, eventName); in flash to pass event to JS. And in JS(coffeescript): window.mouseEventHandle = (elementId, eventName) -> id = '#' + elementId switch event when "down" then console.log("down") when "up" then console.log("up") when "enter" then console.log("enter") else console.log("leave") # leave the function is responsible for styling the HTML button. The question is how to style the button under in JS? Or is there other way to achieve the goal?
View 1 Replies
Sep 14, 2011
i have a question about the mouse down / mouse move events in Flash. I've developed a small intreractive that requires mouse co-ordinates to be captured when the mouse is down and when the mouse is moved anywhere on the screen. It was working fine like this until recently when I checked my interactive in Safari and it no longer recieves mouse co-ordinate information when the mouse cursor leaves the Flash interactive stage area.However, it still works fine in Firefox. Is there anything I can do to get this functionality back when using it in Safari?
View 4 Replies