ActionScript 3.0 :: MouseEvent.CLICK Blocked By Child Bitmap?

Jul 4, 2010

If anyone has come across this problem or is educated enough so that you may come up with a working solution then please post here. Okay so at the moment I have 2 swfs. One swf is the main swf, which contains a class called Avatar. This class extends Sprite and has 1 child, which is a bitmap image.
 
What I do is load the child swf into the main swf, create an object of the Avatar class and pass the Avatar object down to the child swf. The child swf takes this object and adds it to a Sprite object as one of it's children. Then I add an event listener for MouseEvent.CLICK to the Sprite object (the one containing the Avatar sprite) that is in the child swf.
 
Now when I go to click the Avatar bitmap inside the Sprite inside the child swf. The mouse click event does not fire.

View 2 Replies


Similar Posts:


Flash :: AS3 MouseEvent.MOUSE_MOVE Event Stops Responding After MouseEvent.CLICK Call?

Nov 6, 2010

I have several stage event handlers to enable mouseovers over several dynamically generated moviecilps on the stage that then change their alpha to indicate the mouse is over that particular mc... fairly trivial (mcOver handler). Additionally, I also want to know what MC is clicked, so I update a public variable (public var activemc:Number) with the ID of the dynamic movieclip when the mouse is over it (using a hitTest to check, which is why the EventListener is added to stage and not to the MC), which is checked in the mcClicked handler:This is in the constructor:

//stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
//stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);[code]....

However, the mouseover behaviour (alpha 0 when over, alpha 1 when out) stops working as soon as I click on any movieclip on the stage, and the mcClicked ID checking (below) stops working completely. I don't know if this is to do with focus:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
}

I then tried adding the event handler for the stage mouse_move again and this gets the mouseover working again but only for 1 more click, after which it stops again:

private function mcClicked(event:MouseEvent):void {
myTextField.text = String(activemc); // activemc is a public var:Number with the movieclip //ID
stage.addEventListener(MouseEvent.MOUSE_MOVE, mcOver);

View 1 Replies

ActionScript 3.0 :: Flex - Diffrence In MouseEvent.CLICK & MouseEvent.MOUSE_DOWN?

Oct 21, 2010

I'd like to know what is the difference between MouseEvent.CLICK & MouseEvent.MOUSE_DOWN. Because when i use MouseEvent.MOUSE_DOWN for a button to set full-screen view its doesn't work, instead of this MouseEvent.CLICK works. So what was the reason.

View 3 Replies

ActionScript 3.0 :: MouseEvent.MOUSEDOWN Works But MouseEvent.CLICK Doesn't

Nov 6, 2010

I'm making a button for the first time, and I wanted to use a full click to drive it. However, when I use addEventListener(MouseEvent.CLICK, onClickHandler); nothing happens when I click on it. When I use (with the rest of the code being identical) addEventListener(MouseEvent. MOUSE_ down, onClickHandler); it works like a charm.

View 6 Replies

ActionScript 3.0 :: Difference Between MouseEvent.MOUSE_UP And MouseEvent.CLICK?

Apr 7, 2009

What is the difference between MouseEvent.MOUSE_UP and MouseEvent.CLICK? Why should I use one of these over the other? 

Code:myButton_btn.addEventListener(MouseEvent.MOUSE_UP, fNavigate, false, 0, true);
myButton_btn.addEventListener(MouseEvent.CLICK, fNavigate, false, 0, true);

View 3 Replies

Actionscript 3 :: Cancelling MouseEvent.CLICK After MouseEvent.MOUSE-DOWN

Aug 11, 2011

I have a MOUSE_DOWN handler that creates a CLICK event listener on a child object. Naturally, as soon as you release the mouse button, if you happen to be over the child object, the CLICK event fires.I was disappointed to discover that event.stopImmediatePropagation doesn't interrupt the CLICK event from registering the MOUSE_DOWN as part of its detection cycle. It makes sense that it doesn't but still... disappointing.A MouseEvent.CLICK consists of detecting a MOUSE_DOWN on the object and then if it's followed by a MOUSE_UP without leaving the object, he event fires. I had hoped that by cancelling the MOUSE_DOWN event, it would clear that out of the CLICK buffer, but no such potatoes, alas.This could all be handled with a flag and a couple more MOUSE_UP and MOUSE_DOWN handlers, but dang, smacks of effort

View 2 Replies

ActionScript 3.0 :: Check Pixel Color Value Of Bitmap Through MouseEvent

Oct 5, 2011

I have a bitmap with many colors on it. When the user clicks each color needs to trigger a different method. However, I have no idea how to check the color value of the selected bitmap. I can create a new sprite and check the value of that fine through bitmapdata.getpixel() but when I need to actually check the actual bitmap I cannot get it to work.

View 2 Replies

Flash :: Forward MouseEvent In Transparent Bitmap To Underlying MovieClip

Mar 24, 2011

So I'm Bitmaping some heavy stuff to try bring down the [pre-render] and [render] which is quite high according to FlashBuilder's profiling. I thought this was going well until I realised that as soon as you change a MovieClip to a Bitmap, you lose the pixel based accuracy of the mouse move events (Over, Out, Move...), all your left with is the entire bounding box of the Bitmap, something which is less than desirable. I've got a game where many Bitmapped assets would be on top of each other in a scene, on the stage, arranged in various ways and need to have that pixel accuracy moving between each one and have exhausted my efforts as to how to achieve the same mouse move results with the Bitmapped guys as normal.

This, [URL], is a FLA which shows this operation, and you can see how it works here, [URL]. When it loads up, both items on stage are drawn Shapes, encapsulated in MovieClips, both that get a glow, if you hover over them. If you click the stage at all, the purple guy gets turned into a Bitmap and now, his 'hit area', when it comes to MouseEvents is his whole bounding box and you can only get through to the back green item at the edge slivers.

I'm also tracing the pixel which the mouse is over, so I can clearly tell when the mouse is over a transparent area, it's 0, but how can I tell the event to forward itself on down the chain to the green MovieClip?

Below is how it's now pretty much working for me,

var bitmap:Bitmap = this['bitmap'];
var shouldMouseOver:Boolean = bitmap.bitmapData.getPixel(event.localX - bitmap.x, event.localY - bitmap.y);
if(shouldMouseOver)

[Code].....

I shut off mouseEnabled for my item, when I know it's wrong, then I search for another item that properly fits the bill and if there is one, send an Event to that and break. If that one's also wrong, it'll do the same again, but each time taking themselves out of the loop.

This does work exactly how I want it to, but I'd always prefer to keep things like globalToLocal and looping, and reading from arrays for not frequently updated methods like listeners to MOUSE_MOVE. Is there a more efficient way to do this?

View 2 Replies

ActionScript 3.0 :: Add AddEventListener And MouseEvent  To Child MCs?

Feb 7, 2009

show a demo using Actionscript 3 where a child movieclip is added dynamically in a loop using addchild within a cotainer movieclip. Then the child movieclip has an addEventListener MouseEvent added to the child, not the container, in the code.

View 4 Replies

Flex :: Mouseevent - In OnMouseOut Is Trigerred On Child?

Jul 27, 2010

In flex, I am using the following code:

mx:HBox id="box1" mouseOver="onBox('box1')" mouseOut="outofBox('box1')"
// adding label
// closing HBox

[code].....

View 1 Replies

ActionScript 3.0 :: Detect If The Target Of A Mouseevent Is A Child Of A Movieclip?

May 29, 2010

I have a parent movieclip with a few other movieclips inside it. When I add a mouseclick eventlistener to the stage and click on one of the children, i want the target of the event to be the parent movieclip. I still need the children to be mouseEnabled.

how do you check if a movieclip is a child of another?

View 9 Replies

Flash :: Get The MouseEvent.localX And LocalY Of A Target But Not Its Child Objects?

Jul 24, 2009

I'm creating a simple drawing application that adds new Shape objects to a MovieClip "canvas" every time the user clicks and drags. The problem is, I'm noticing that even though the MouseEvent listeners are set to the MovieClip, the child Shape objects are being returned as targets as well. This disrupts the localX and localY as well, causing the drawing cursor to jump around as the coordinates change from being local to the entire MovieClip to local to the Shape the mouse is currently over.Is there any way to retrieve the most parental target from a MouseEvent?

View 1 Replies

MouseEvent.CLICK Not Registering For MovieClip?

Oct 4, 2009

I have th following code below. When the monster is clicked I would like to remove it but the MouseEvent.Click event never fires? I'm using flash cs4.
 
import fl.motion.Animator;import fl.motion.MotionEvent;var this_xml:XML = <Motion duration="30" xmlns="fl.motion.*" xmlns:geom="flash.geom.*" xmlns:filters="flash.filters.*">    <source>       [code].......

View 2 Replies

IDE :: Why A MouseEvent.CLICK Would Affect Only 1 Of 5 Items

Oct 28, 2009

Is there any reason why a MouseEvent.CLICK would affect only 1 of 5 items, whereas a MouseEvent.ROLL_OVER and MouseEvent.ROLL_OUT affect 5 of 5 items when each event listener is applied exactly the same way?For some reason, of the 5 images I've imported, only the last image is able to be clicked and have click actions applied, yet it is able to receive the ROLL_OVER and ROLL_OUT messages. So that leaves me thoroughly confused.

Here is the code I'm using, I'd greatly appreciate your help ---

Code:
import XMLManager;
import caurina.transitions.Tweener;
import MakeHand;

[code]...

View 1 Replies

ActionScript 3.0 :: MouseEvent.CLICK Would Affect Only 1 Of 5 Items

Oct 28, 2009

Is there any reason why a MouseEvent.CLICK would affect only 1 of 5 items, whereas a MouseEvent.ROLL_OVER and MouseEvent.ROLL_OUT affect 5 of 5 items when each event listener is applied exactly the same way? For some reason, of the 5 images I've imported, only the last image is able to be clicked and have click actions applied, yet it is able to receive the ROLL_OVER and ROLL_OUT messages. So that leaves me thoroughly confused.

[Code]....

View 6 Replies

ActionScript 3.0 :: .addEventListener(MouseEvent.CLICK Won't Work

Dec 15, 2009

I am trying to add a simple "getURL" type of functionality to a movieclip so that when it is clicked on, the user is taken to a url. i have tried 3 or 4 different ways to do this that all work when i test the movie clip in flash. However, when i embed the swf in a webpage, the click function does not work.I created a function:

Code:
function gotoPage(event:MouseEvent):void
{
var targetURL:URLRequest = new URLRequest('http://www.metteradvertising.com/marketing-help.html');
navigateToURL(targetURL);
}

and I'm calling it this way ("Bmeasure" is the movieclip name):

Code:

Bmeasure.addEventListener(MouseEvent.CLICK, gotoPage);

am i not able to attach "click" functionality to a movieclip?

View 10 Replies

ActionScript 3.0 :: Canceling MouseEvent.ROLL_OUT On CLICK

Jan 13, 2012

I am using an event listener for both rollOut and rollOver to a button, on roll over it populates a text field, roll out clears the field, however I would like on click to populate the field and leave it persistant untill another roll over event happens, curently the roll_out event takes priority and when I move my mouse it clears the field, regardless of click.

what is the best way to cancel the roll_out event?

View 1 Replies

ActionScript 3.0 :: MouseEvent.CLICK With Custom Cursor

Jan 19, 2011

In my project I have 14 buttons which are added by adding the background image their in. So I have a var bg which i addChild(bg) thus also adding 14 buttons.
 
their listeners are set to Mouse.event CLICK, and they work fine unless i add a custom cursor then their dont work any more.

View 1 Replies

ActionScript 3.0 :: MouseEvent.MOUSE_WHEEL Requires CLICK?

Mar 4, 2011

I have the following code:

import flash.events.MouseEvent;
import flash.events.Event; 
var mouseWheel_mc:MouseWheel_mc = new MouseWheel_mc();
var over:Boolean=true;
addChild(mouseWheel_mc);

[Code]...

there is a MovieClip named mouseWheel_mc which is being called at runtime from the library with 30 frames in it, sequential animation frames.I would like the MouseWheel motion to play these frames forward or backward depending on which direction the mousewheel is being pulled or pushed.

Everything works just fine, but the problem is that the event won't start until you actually click in the SWF window (inside).  I thought I could remedy that by using an Event.INIT or Event.ACTIVATE call but neither of those remedy the situation.

How can I get the event to fire once the SWF is in the browser without having to first click within the SWF?

View 3 Replies

ActionScript 3.0 :: AddEventListener(MouseEvent.CLICK, ) Not Responding?

Mar 9, 2011

got stuck on this for a while now: have this code but my mouse event is not responding:

function wrongRight(evt:MouseEvent):void
{
flap_Control.flap.mouseEnabled = flap_Control.flap.mouseChildren = false;

[code]....

View 1 Replies

Actionscript 3 :: MouseEvent's CLICK Versus DOUBLE_CLICK?

Apr 11, 2010

is it not possible to have both CLICK and DOUBLE_CLICK on the same display object? i'm trying to have both for the stage where double clicking the stage adds a new object and clicking once on the stage deselects a selected object.

it appears that DOUBLE_CLICK will execute both itself as well as the first CLICK functions in the path toward DOUBLE CLICK (mouse down, mouse up, click, mouse down, mouse up, double click).in other languages i've programmed with there was a built-in timers that set the two apart. is this not available in AS3?

UPDATE:here's some code. essentially what i would like is have one or the other, not both with double click

stage.doubleClickEnabled = true;
stage.addEventListener(MouseEvent.DOUBLE_CLICK, twoClicks, false, 0, true);
stage.addEventListener(MouseEvent.CLICK, oneClick, false, 0, true);

[code]....

View 2 Replies

Flash :: MouseEvent.CLICK Not Responding On Stage

Feb 25, 2011

When I listen to mouse click event on the stage, it seems it's not always responding to my mouse click event. what I have is:

stage.addEventListener(MouseEvent.CLICK, Test);
function Test(event:MouseEvent):void
{
trace("test");
}

I usually have to click a few times randomly on the stage to get the trace statement.
I thought when I add this event listener to the stage, it should respond to any mouse click within the swf area, no?

View 2 Replies

Actionscript 3 :: Button With A MouseEvent.CLICK Listener?

Aug 8, 2011

I have a button with a MouseEvent.CLICK listener. The CLICK event is being triggered when the button is pushed, mouse is down while rolled out, then released when rolled in on the button again. I do not want this to happen, the click event should not occur when the button is being dragged.

My flash file contains a large amount of buttons and click listeners, I would like to solve this problem with as little code as possible. What is the simplest solution to this problem?

View 2 Replies

AS3 ::: Flash - Video MouseEvent Click Not Working?

Oct 10, 2011

I created a simple video and I tried attaching a mouse click event to it but the event doesnt fire. Here is my code:

var connection:NetConnection;
var stream:NetStream;
var video:Video;

[code]....

why wont the mouse event work?

View 1 Replies

ActionScript 3.0 :: RemoveListener(MouseEvent.CLICK) From One Scene To Another

Aug 26, 2010

Is there a way I can remove the MouseEvent.CLICK when I go to another scence? I tried removeEventListener but no luck.

ActionScript Code:
// on the first frame of scene 1
import flash.events.MouseEvent;
my_btn.addEventListener(MouseEvent.CLICK, playmov);

[Code].....

View 2 Replies

ActionScript 3.0 :: MouseEvent CLICK And DOUBLE_CLICK On Same Object

Jan 8, 2008

how to listen on a SINGLE CLICK as well as DOUBLE CLICK for an object?

Meaning, one behaviour if the object is single clicked and another behaviour if it is double clicked.

Simply adding two event listeners (CLICK and DOUBLE_CLICK) leads to CLICK handler getting called always.

I understand one could start a timer upon the CLICK and if another CLICK doesn't arrive within 'x' milliseconds generate a SINGLE_CLICK event, else generate a DOUBLE_CLICK event. It seems like a hack and dependant on CPU load.

View 14 Replies

ActionScript 3.0 :: MouseEvent - Click And Drag Objects

Feb 17, 2009

I have unit A: on a mouseEvent: MouseUp and MouseDown event. I'm going click and dragging objects.
Unit A when I pick it up says I have picked up Unit A. I drop it in a location and it stays. GOOD
I pick up Unit B and it says I picked up Unit B. I drop it on top of Unit A and it says I have dropped Unit A. NOT GOOD.

I only want to drop unit B, not A. So I looked at the events:
Target: The InteractiveObject instance under the pointing device. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event.

So I use currentTarget instead:
currentTarget: The object that is actively processing the Event object with an event listener. Except they both return the same. Both will register Unit A, even though I am holding Unit A.

View 1 Replies

ActionScript 3.0 :: MouseEvent.CLICK - Function Not Working?

Aug 11, 2009

After parsing some XML to create a vertical project list I'd like to be able to click on the image/icon representing each project and be taken to the URL that's been parsed in as well. Here's the error I get when clicking the dynamically generated Movieclips:TypeError: Error #1009: Cannot access a property or method of a null object reference.at NMD_work_fla::MainTimeline/itemClick()Below is the extracted code pieces related to the onClick function:

//Sample XML:
HTML Code:
<Projects>

[code]......

View 2 Replies

ActionScript 3.0 :: Disable MouseEvent.CLICK Events On A MovieClip

May 12, 2009

Suppose, I created a MovieClip(with instance-name= "myClip") on the stage. If I need to process MouseEvent.CLICK event on this movieclip(myClip), then we use addEventListener(bla.... bla...); method.
 
Now, my requirement is, in certain case, I do not want to occur any MouseEvent.CLICK events on this same movieClip(i.e., myClip).Then, How to do this? (or) What is the method/class used in this context?
 
Atlast, My requirement is: How to remove/disable Mouse_CLICK events when occur on a MovieCLip.

View 1 Replies

Professional :: Stopping Embedded Video With MouseEvent Click?

Aug 25, 2011

I have a website in Flash CS4. When testing the movie, my swf file plays. When I access another menu button, the movie still plays and you still hear the sound. I have the skin where the user can stop the movie before going to other pages in the site but my Question is: How can I get the movie to stop playing if another menu button is clicked? I ask because when I go to another page and come back, the video is not showing but I still hear the audio.

View 7 Replies







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