ActionScript 3.0 :: Some MCs Not Detecting Mouse Events?

May 29, 2011

I've just hit a really strange bug with a program I'm creating. The program allows the user to add shapes (currently all squares: SmallThing, MediumThing and LargeThing) to an area of the screen, then drag them about by clicking and draging using the mouse. Pretty simple. Unfortunately, the code seems to be failing for the smaller shapes (they're not THAT small, currently the smallest shape is 32 x 32) which are not generating mouse events at all. I have used trace statements to verify this. I am having a few issues with the larger shapes ocassionally not registering mouse up events, but I can live with this - the main issue is with the small shapes not being moveable.

All the shapes are descended from the same super class, and have the same event listeners added to them when they are created.
 
Here are the relevant functions in my Screen class. It's all pretty basic code so I really can't see what the problem is.

[Code]....

View 12 Replies


Similar Posts:


Actionscript 3 :: Nested MovieClips Not Detecting Mouse Events

Mar 31, 2010

I have some nested movieClips. I've got an event listener on the parent listening for a mouse click. Problem is, the listener never picks up the click.[code]On movieClipStack, I can see that mouseEnabled = true. In addition, buttonMode = true works exactly like it's supposed to. But onStackClicked never happens - movieClipStack just isn't detecting any sort of mouse event.

View 2 Replies

ActionScript 3.0 :: Detecting Mouse Events On Classes With Different Content Inside

Sep 2, 2009

I have a Card class. From this class, I have three possible children: Photo, Video and Info. In my main class, I want to create a few instances of these different classes without knowing what kind it is. But, no matter that, I want them all to listen to the mouse, so I may have something like this:

ActionScript Code:
var item:Card = new Photo();
item.addEventListener(MouseEvent.CLICK, mouseHandler);

The thing is: the Card class is kinda like a canvas... it has certain properties common to every type of item, but there's a space where it leaves it as a canvas... a Photo instance will load a photo there, a Video instance will load a video and a Info instance will load text to a TextField. The problem is that the event listener doesn't work the way I want it to... on an Info instance, the target of the click is the TextField; on a Photo instance is the picture... I want them all to be the class itself... in other words, I want to be able to parse the target as a child of the Card class. My code for the mouseHandler method is

ActionScript Code:
private function mouseHandler(e:MouseEvent):void
{
if(e.target is Photo)

[Code].....

That's the main idea... to be able to know what kind of object I'm clicking and access its properties... but on an Info instance, e.target is of type TextField... to be able to access the Info object, I have to do e.target.parent, and that is NOT the idea.

View 1 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.0 :: Detecting If A Key Is Pressed Without Events?

Jan 8, 2009

In AS2 I did this:

ActionScript Code:
ContactVerDoor.onRelease = function() {
if (Key.isDown(Key.SPACE))  if (Key.isDown(Key.SHIFT)) {
//Do something
}
}

I now need to code it in AS3.Can I still check if a key is down without listening for the keypress events? I understand how to code the Mouseclick in AS3.

View 2 Replies

ActionScript 3.0 :: Detecting When Multiple Load Events Done?

Jan 23, 2010

I have an application that at runtime creates a class called map. The constructor for this loads a XML file that specifies a number of images to load and loads them as children. What I want to do is to somehow sense when all images specified in the XML file are loaded and dispatch an event.

What I do is to create a load event for each image to load, that places the image as a child in the map object. This map is then put as a child on the stage.

I need to add a event listener to map that listens when it is fully loaded and triggers a event.

map.addEventListener(...) gives me a compile error of course.

View 3 Replies

ActionScript 3.0 :: Detecting / Using Keyboard Events - GotoAndStop?

Apr 1, 2009

I'm confused about AS3's key handling. I just want a script that goes "If "R" is pressed, gotoAndStop(#). While in AS2 this was extremely easy, many examples I see now have variables in them. So all I know so far:
Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN/UP/Whatever I want, nameFunction)
function nameFunction (evt:KeyboardEvent):void {
}
I've seen people with code like if (evt == 82) or something like that, but it doesn't work. C

View 9 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 :: Events - Drag & Drop: Detecting When All Data Has Been Moved From Source To Destination

Oct 5, 2009

I have two mx:TileList controls that I'm using to allow editing of objects in batch. The first contains a collection of all available data, and the 2nd contains the current batch. Both are bound to ArrayCollections, and using the native drag-n-drop functionality of the TileList control the data is moved from one ArrayCollection to the other when an object is dragged between them.

I need to change the currentState to show & reset the batch manipulation controls when the batch count goes from 0 to n or n to 0 items. Based on the documentation, I would have thought that I should listen to the dragComplete event, but my testing shows that instead of firing after the data has been removed from the source ArrayCollection and added to the destination ArrayCollection, it fires (consistently) between these two actions.

[Code]...

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

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

ActionScript 2.0 :: Detecting Mouse Outside Of SWF?

Aug 17, 2005

Im having a problem with some rollover code im using for a movieClip, basically if the mouse runs over to fast the rollover animation is played but not the rollout as the mouse has left the SWF area. Is there anyway of telling where the mouse is on the screen so i can run a check to see if its in the swf or not and then run code accordingly.

View 2 Replies

ActionScript 2.0 :: Detecting If Mouse Is Over

Jan 27, 2006

Im creating a flash projector that opens some other projectors with the fscommand exec command. Is there a way of detecting when the mouse is over one or another to change some values of variables?

View 1 Replies

Flash8 :: Mouse Detecting The Correct MC?

Jul 12, 2009

I am tring to create a "find and destroy" game..I have 20 ball shaped movie clips..they move around randomly..I want to click(destroy) only the ones having certain names (enemy1,enemy2...enemy8)or having certain color....how can I write a function so that I can explode them clicking with my mouse .

onClipEvent(enterFrame)//on(Press)
{
if(this==enemy1)

[code]....

View 1 Replies

ActionScript 3.0 :: Detecting MOUSE_LEAVE When Mouse Down

Oct 10, 2010

I need to be able to detect a MOUSE_LEAVE on the instant the mouse leaves the stage no matter if the mouse is DOWN or UP. This seems to be impossible or a limitation in AS3. The MOUSE_LEAVE only gets dispatched if mouse is UP or after the mouse is released outside stage. Is there any API like isMouseOutsideStage instead of using listeners which i can use instead? stage.addEventListener(MouseEvent.MOUSE_OUT) is also not applicable because whenever my slide show changes images, MOUSE_OUT of stage gets dispatched which is undesirable.

The code below works perfectly where it detects a release or release outside if event.target is other than myButton. The weird thing or perhaps an undesirable behavior is that if i release outside stage, event.target equals myButton thus detecting a "release" instead of "release outside". I think that when we release outside stage, the want event.target to be null.

[Code]....

View 3 Replies

ActionScript 1/2 :: Detecting Mouse Direction?

Nov 30, 2010

I wanna detect the direction of mouse movement. If the mouse moves tpwards the left or right of its currrent position, i want to detect it. Is there anyway to identify such movement. Actually i am implementing a 360 degree rotation of  image. That means , if the mouse moves along the left side of its current position, then the image should move along its left side, otherwise it should move along the right side. For example, view this site:

View 4 Replies

Detecting Mouse Right Click In Flash

Apr 25, 2001

I'm making the simplest swf for a friend who has real problems remembering the actions of a Left and Right click with the mouse. So I would like to show text when "Right" click is detected and the same for a Left click. This at first seemed an easy project but the right mouse detection has got me baffled.

View 4 Replies

ActionScript 2.0 :: Detecting Mouse Direction?

Apr 14, 2006

I'm having a problem when detecting the direction of the mouse.I'm using the following script:

Code:
stop();
//

[code].......

View 5 Replies

ActionScript 2.0 :: Detecting Mouse Clicks?

Mar 27, 2007

i have some movie clips on the stage and the background of these movie clips are, of course, the stage. now, i need to detect a click on any area of the background(the stage) to do something to the movieclips above it.What I did is, I laid a movieclip which has the same size as the stage, above the Stage and below the other movieclips. I then set this movieclip to visible = false. Next, I thought I could use onMouseDown to get the clicks but unfortunately, it isn't working because onMouseDown detects the click on anywhere I click.I am not using onPress because I don't want to have the hand cursor appearing on the entire flash movie.

View 2 Replies

ActionScript 3.0 :: Detecting Mouse Outside Stage?

Jun 19, 2009

I have a swf that needs to change states based on whether or not the mouse is hovering over the swf or if it's outside.

I've tried doing things such as stage.addEventListener(MouseEvent.MOUSE_OUT, fnc) but it triggers whenever the mouse goes past different movieclips within the swf.

And since I have interactive elements, I can't just slap a movieclip over everything and add a listener to that.

View 2 Replies

ActionScript 2.0 :: Mouse Detecting The Correct MC?

Jul 12, 2009

I am tring to create a "find and destroy" game. I have 20 ball shaped movie clips..they move around randomly..I want to click(destroy) only the ones having certain names (enemy1,enemy2...enemy8)or having certain color. how can I write a function so that I can explode them clicking with my mouse .

[Code]...

View 1 Replies

ActionScript 2.0 :: Detecting Mouse Interaction On Stage?

Jul 19, 2007

i've been having difficulty detecting a click on the Stage.i'd like to create something similar to when the user clicks on anything that's not a movieclip it zooms out.

View 2 Replies

ActionScript 3.0 :: Detecting When The Mouse Leaves The Movie?

Feb 13, 2009

i tried this code

Code:
var cursor:Sprite = new Sprite();
function Test() {
cursor.graphics.beginFill(0xFF9900);

[Code]....

View 5 Replies

ActionScript 3.0 :: Detecting Extended Mouse Movement

Feb 24, 2009

Is there any way to get the mouse location (or at least an estimate), even when it moves outside of the stage area?The reason I need this is that I am trying to detect how fast and at what angle the cursor is moving, not necessarily the location of the mouse. It works fine until you move the mouse outside of the stage area, which happens a lot, and then just doesn't record the mouse location until you move the mouse back on to the stage. Impatience leads to confusion. Confusion leads to anger. Anger leads to the dark side.

View 4 Replies

ActionScript 3.0 :: Detecting Mouse To Stop Timer?

Nov 13, 2009

I want to detect if the cursor is over a movieclip to stop the timer that i have? What's the best way? MousEvent.ROLL_OVER will force me to use another function, leaving me with no access to do myTimer.stop();

View 5 Replies







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