I have a flash piece that replaces the mouse with a knife/sword graphic. When the user clicks (anywhere) the knife animates, 'slashing' the background. The click does something like..knife.gotoAndPlay(2);The animation is about 10 frames long... The problem is sometimes the click does nothing, as if it takes a single click just to focus the mouse. Rapid-clicking seems to have the desired effect if it wasn't for the aforementioned bug. I've tried a mouse listener as well as the standard on... methods and I'm still having the issue.Also, unfortunately due to client restrictions I'm having to code this flash piece in AS2 as opposed to AS3.
I have a class listening for key presses attached to the stage, works fine until...a menu item that when clicked removes the menu from the display list. This seems to cause the stage to lose focus & I need to click the mouse on the SWF to get the keys to register again.
I have a map application that when I use the mouse wheel the map will scale up or scale down. The next thing I want to do is to focus on the mouse pointer while zooming on the part of the map.
I have this code...
function focusMousePosition(){ onMouseMove = function (){ Stage.width = _root._xmouse; Stage.height = _root._ymouse; updateAfterEvent(); }} var mouseWheelListener = new Object();var wheelNum:Number; mouseWheelListener.onMouseWheel = function(wheelNum){ focusMousePosition(); if (wheelNum > 0){ map._xscale *= 0.9; map._yscale *= 0.9; }else{ map._xscale *= 1.1; map._yscale *= 1.1; }}Mouse.addListener(mouseWheelListener);
I'm trying to use the following code to add a listener to a text field which clears the field, but I'm getting the error: "Parameter Listener Must be Non-Null" This is the code I'm using:
[Code]...
I should add that this text fields starts out on stage as a dynamic text field. In the code above I am changing its type to input, so that might affect things. I am trying to set up the field so that when a user clicks in the text field, a cursor movie clip appears, and the text that was in the field is erased, and that when they leave the text field and click elsewhere, the text is accepted, the textfield converts back to a dynamic field, essentially "locking" the entered text into the field.
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.
I have a map of items and I need to know when a mouse moves over the item. Should I add a event listener for mouse over and mouse out to each item (there may be a lot) or I should add mouse over and mouse out listeners to whole container and do some checking to detect whether the target has item on it or not? In the second way it would mean that the event would occur on entering each map tile in the container i would be listening. This seems a bit pointless, but I heard somewhere that I should add as little as possible.. So what should I do?
But for some reason I couldn't see the new Powerup object (the values doesn't reach 0, so it's not the problem), so I kept testing, and found out that if I change it to this:
How would i make hitTest work better with a rotating object(AS2). Becase i have a circle and it if gets near the rotating object (actually pretty far away) it starts the script,(new x and y)
I think thats the rotation script, becuase i took a break for like 4 days becuase it was irritating.
I've created something that works like a ToolTip in my Flex application. When I roll over a certain item renderer, I pop up a new control, position it, and remove it on roll out. The order of operations is like this:
Roll over event handler triggered. Add the tooltip to this.systemManager.topLevelSystemManager.toolTipChildren. On creation complete of my tooltip, set x, set y coordinates of the tooltip (on creation complete so the width and height are calculated since they are dynamic). Roll out event handler triggered. Remove tooltip.
This worked fine when I set the x and y coordinates to be x+10, y+10 from the current mouse position. I wanted to add something that re-positioned the tool-tip if it was going to be drawn partially off screen. I added a step that would calculate if it would be drawn off screen, and re-position the tooltip if it was going to be cut off.
The problem with my solution seems to be that it now runs in an infinite loop of redraws, since adding the tool-tip to the screen underneath the mouse triggers the "rollOut" on the item renderer. This triggers the removal of the tooltip, and starts the process over again from 1.
is there any way to ignore tooltip so it doesn't take the mouse focus away from the item renderer that is now under it?
Just wanted to ask is it possible for a flash app to capture mouse and keyboard events when it loses focus. I've tried putting it in a div container through SWFObject library and than used jquery forward mouse events plugin, but without success. My idea was to capture mouse events (click event) on the body and then transfer it to the flash app
Looking for code to enable zooming in/out on a graphic or movie clip using mouse scrollwheel with origin of scale change being at the mouse cursor position. I have one where it is at top left. I also require it to stay proportional, when applied to a rectangular graphic my code makes it go letterbox on zoom out!
I want my flash movie to go to a specific frame when the user moves the cursor away from the actual swf file (rollout) in the html page. I tried different things, for instance having a big transparent movieclip in the background and use hitTest:
//this code is in the root level this.createEmptyMovieClip('penCheck', 100000); this.penCheck.ref = this; this.penCheck.onEnterFrame = function() {
[code].....
This doesn't work until the user clicks outside the flash (flash loses focus).
So your playing a flash game that's fast paced and mouse-based (hey that rhymes somewhat)... And then you accidentally move your mouse outside of the area of the swf... And then it pauses automatically with a "Continue" button, instead of you just dying or whatever. I've thought you could have a huge button the size of the stage and make it do something when the frame isn't 'mouseover' or whatever, but there's gotta be a better way. Also setting limits on the _xmouse and _ymouse wouldn't work cos sometimes the mouse moves too fast for them to accurately get the last mouseposition...
I was wondering if there is such a thing as a mouse over listener.So that it would execute code when the mouse rolls over(and maybe also execute code when the mouse moves away again)
What object do I add my Mouse event listener to in order to capture clicks on a video? I've tried the netsream object and the video player object, but I don't get anything with either. Is this even possible?
Im tring to remake most of my projects that i've created so far in class's and packages but it seems to be a mission.
I have the gameMain_Controls class which is the linkaged to the actually fla. then i have a custom cursor class and a char class the gameMain_Controls pulls objects into the stage as children of the background fron the char class.
now my problem is to get the cursor to hittest of mouse over and at least do a trace out put:
code im trying at the moment which is also in a different class ...called the rollOver_Controls:
if (flap_Control.flap.hitTestObject(Dino_Control.layla)) { trace("lal hit"); }
[Code]....
but the hittest jsut never occurs im guessing the problem is which the location of the object, the container i mean ...but when i try to link it that way i get even more problems
I have a button and I'd like to have the user right click on the button and then display the menu that will allow them to copy the highlighted text, but I'm getting the infamous 1119: Access of possibly undefined property RIGHT_CLICK through a reference with static type class. What am I doing wrong?
How can I block a mouse listener object when I roll over a button?There's got to be a way to do this w/out removing the listener on roll over, then adding it back on roll out.
I have the following code which causes a movieclip to scroll horizontally either left or right based on where the mouse location is, and stops it at the extents of the movie clip:
I'm getting an unusual behavior that I can't seem to get to the bottom of. When I run this, if I move in the swf area it traces normally on mouse move. To be expected.
But it's tracing for the move event when I click anywhere on screen. If I click and drag, it traces as if I were moving in the swf area of the browser.
Here's the code. I've simplified to it's barebones. Just put this in in an empty AS3 project in Flex called "Engine" - sans quotes obviously.
As a workaround I've add the MOUSE_MOVE one MOUSE_OVER and remove it on MOUSE_OUT. But the behavior still seems quite unusual and I'd be interest in understanding why it's happening.how I can keep the events constrained to the actual stage of the application?
I finished creating a vertical scrolling news ticker for a client, but I've run into a problem. I use .html to create functional anchor tags within flash. I need to create a capture event when the mouse changes from the pointer to a hand on the anchor links. I'd spent the morning googling for help, and reading all of my resource books, and I still don't know how to create a capture event for mouse hand cursors. I'm attaching the code in question. It works as intended.
i am trying to create a listener that will detect if the mouse is outside an area (an imaginary box if you will) and when it goes outside that box I want to put in a gotoAndPlay action, I know i have seen it done, but can't find anywhere it has now and i don't even know how to begin to make a listner, could anybody help with maybe some sample code i could borrow? I am sure this will have to deal with if _x.mouse is less than so and so or greater than so and so and _y.mouse is less than so and so or greater than so and so, then gotoAndPlay,
when i have this line active(the red one) it gives me automatic focus, so no clicking to be able to detect key input so i got that going for me which is nice BUT when i have it active(not commented out) i get this big yellow line which goes away when i click it(seeBelow)
I have to develop an application in flex. In that application an user can draw line while dragging the mouse. Then if he clicks on that line it should be selected. How to add mouse click event listener to a line object?