ActionScript 3.0 :: Events Handling - Overriding Default MouseX?
Dec 4, 2009
I need to do something and I don't know if it's possible... in a proper way.
1 - I have an FULLSCREEN application that extends to two monitors in a Windows system.
2 - The graphic card is extending the single desktop to the two monitors, so the fullscreen fits everything correctly.
3 - Only one monitor is interactivity-enabled, with an interactive touch-sensitive foil on it, which works great.
4 - The second monitor is interactivity-disabled, it just displays stuff depending on what happens on the first monitor.
The Problem: The interactive foil on the interactivity-enabled monitor responds as if it is the *whole monitor*. But it only covers one monitor!! The *whole monitor*, are the two screens put together. I obviously can't cut the interactive foil in 2, and then stretch the two parts to fill a monitor each... So if one touches beyond 50% of the foil's width, the touch event will actually occur in the second monitor!
A fact for the solution is - if all Mouse Events occur with mouseX divided by 2, everything will work fine! How to make all Mouse Events's mouseX be divided by 2? Is there a way to do that in the core of the actionscript MouseEvents handling?
View 4 Replies
Similar Posts:
Apr 23, 2007
I'm looking to speed up my game, and I know that people keep saying the default prototypes are slow, and so I'm wanting to swap them out with better ones, like I found one that makes split() 10x faster than default...
View 4 Replies
Aug 5, 2011
I'm trying to override the default handling of the 'up' and 'down' keys for an editable list, such that when they are pressed a list entry that is being edited behaves as if the escape key has been pressed, but the 'selected item bar' moves up or down.
Here is my (simplified) component:
<?xml version="1.0" encoding="utf-8"?>
<mx:List xmlns:mx="[URL]"
enabled="true" width="100%" height="100%"
creationComplete="initialise()"
editable="true"
[Code] .....
For some reason this doesn't work: if a row is being edited, the first 'up' (or down) keypress ends the edit and moves the bar. Further up or down keypresses have no effect, but if you click somewhere near the list it does start working. This makes me think it is a focus issue. Weirdly, if you hit escape the edit finishes and you can move up and down correctly. If the 'callLater' line is uncommented to try and make the list retain focus, the bar initially moves in the direction of the keypress but then moves back again and re-edits the original line!
View 2 Replies
Oct 1, 2009
Can I write more than one command in a script? I am having trouble making an if-code in Flash CS4.This code is working as I want:
stop();
instans1.onMouseDown = function (){
play();
[code].....
View 5 Replies
Nov 18, 2009
I'm trying to handle movement of my Hero Class by adding event listeners in my constructor. I'm trying to move my Hero object.Inside my hero constructor, I have:
Code:
//Adding Event listeners
this.addEventListener(KeyboardEvent.KEY_UP, reportKeyUp);
this.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
this.addEventListener(Event.ENTER_FRAME, EnterFrame);
And then I have functions for each of the events above. For some reason,the event listeners for key up and key down are never being triggered.
View 1 Replies
Jul 28, 2010
In flex, I am handling event like this,
myImage.addEventListener(MouseEvent.CLICK, redoOperation);
Now, I want to pass some value to redoOperation. (function redoOperation myId:String)) How can I pass String to it?
View 1 Replies
Aug 18, 2011
I want to have a single event listener for multiple events and depending on the type of event i want to handle them separately.Something similar to Swiz framework see: 'Handling Multiple Events from a Single Method'.i have a piece of code like
var toolOptions:UIComponent=ToolOptions.createToolOptions(type);
if (options != null)
{[code]....
In above toolOptions is a mxml component which get dynamically created based on 'type'.Also which type of event should be dispatch the event from the component? eg: Event.SELECT. To be more precise the above is basically required for a toolbar.When user selects a tool,he is shown options for a tool and when he selects options,tool should apply them to object on the view.
View 2 Replies
Feb 20, 2012
take a look at the following code
var a = new View();
a = null;
....
class View {
[Code]...
will a be in memory after a = null? Does addEventListener adds a strong refernce?
View 3 Replies
Jul 4, 2010
I have to create a custom header for the AdvancedDataGrid component. The custom header must have two buttons in it. The custom renderer must be applied to more than one column.
How I can fire, dispatch and handle events from the custom headers?
View 1 Replies
Aug 19, 2010
Is there any cross-platform-safe method for dealing with keyboard shortcuts in Flash? For example, on my Mac, pressing ctrl+f results in a KeyboardEvent where the keyCode is 6, but on Windows, the keyCode is 70.
View 1 Replies
Oct 11, 2010
i've created a socket extension class. the pseudo code below tries to make a socket connection using the passed parameters. if there is an security error, such as the port number not being an acceptable port number, i want to handle the security error.
however, i can't catch the security error. a popup window appears with a description of the error and my errorHandler function is never called.
[Code]...
View 1 Replies
Apr 24, 2007
I have just established a menu based-image in flash in the main html page. Also I do have a second page has details on each option of the menu of the main page. I am trying to whenever I click on any option of the menu in the main page; this should take me to the specific section in the second page describing this option.
View 3 Replies
Dec 16, 2010
I have this code that's repeating for 40 different instance names that play 40 different movieclip names.Is it possible not to repeat all this code for every instance name?For example creating a function that catch the instance name that is pressed and plays the correct moviclip name?
Code:
pressed=false;
clic=null;
[code].....
View 3 Replies
Jan 19, 2009
PHP Code:[code].....
What I want to achieve is that the btn can stop the default drive by starting the function anhalten and then it should be able to restart with the function anfahren...I think this should go with if/else and bool-vars, but I could not make it work.
View 1 Replies
Jan 27, 2010
I have narrowed this error down to the following code, but i cant see the problem...
Code:
ReferenceError: Error #1069: Property ENTER_FRAME not found on flash.events.Event and there is no default value.
at sample_fla::MainTimeline/frameEventHandler()
ActionScript Code:
addEventListener(Event.ENTER_FRAME,frameEventHandler)
function frameEventHandler(Event){
var collisions:Array = collisionList.checkCollisions();
[code].....
View 9 Replies
May 13, 2011
I have this mc that responds to mouseX , only the mc is very short in frames, it's only 25 frames long. This way the mouseX is only the first 25 pixels of my stage, so it only responds to that. Is there any way I can multiply this value to, let's say, 20 times?
View 1 Replies
Feb 1, 2012
Here is my code:
public function update()
{
//making the character follow the mouse
[Code].....
mouseX isn't being changed by me (and can't be since it's read-only), there isn't any other code in this object since I've only just started with this project.
View 1 Replies
Sep 20, 2011
Is it possible to find all touch points that are pressed down, and its x/y properties, like we can with mouseX and mouseY?
View 0 Replies
Sep 10, 2009
[Code]...
if I want to use mouseX and mouseY in my class whats the most effective way to do this?
I know if I extend a class to Sprite for example I get this feature but could I get it with less... I know I could say this also and then I wouldnt need to extend Sprite but I dont know if this is a good idea....
[Code]...
View 3 Replies
Mar 3, 2010
I am making a map of the united states where I would like the map to pan to that state and then zoom into that state when that state is clicked. I have looked over a lot of tutorials, but they all seem to do a little more then I need. I would have thought it was a simple math equation using the mouseX and mouseY with the stage.stageWidth and stage.stageHeight, but I have no been able to figure out the math.
View 3 Replies
Jan 12, 2010
I am trying to get a MC to stay within certain boundaries of the stage. I want it to appear as if it was in a rectangle. It moves along the x axis. Think of a paddle in a basic pong game.What this code does is moves the paddleMC to the left coordinate when the mouse is moved, then gets stuck there.Is there any way to set the boundaries for mc on the x axis when controlled by the mouse?here is my code.mcPaddle is the movieclip I'm trying to set the boundaries for.
ActionScript Code:
stage.addEventListener(MouseEvent.MOUSE_MOVE, movePaddle);
function movePaddle(event:MouseEvent):void
[code].....
View 4 Replies
May 27, 2011
I'm a non-3D guy with a 3D problem to solve. I have a character moving around in 3D space (his Z value is fixed, like a 2D side-scroller with 3D graphics). He's supposed to follow the mouse. But because the mouse's Z is not the same as the character's, I obviously can't just set his Z to that of the mouse. I'm pretty sure I need to use the distance between the character and the camera when calculating the character's new X position. But I'm not the mathiest person around, and the wiki article on 3D projection ([URL]) made me a little dizzy. All I know is I need to do the inverse of what that article describes.
I'm not using any 3D engines. I've found posts about certain versions of PaperVision that actually have a method built into the Camera class to do exactly this (Camera.unproject()). I'm going to attempt to dig into that to see if I can pull out the formula that I need. But in the meantime I thought I would pick the brains of you brilliant Kirupians.
View 1 Replies
Jul 12, 2010
What I am trying to do here is control a movie clip with the mouse by setting the coordinates of one equal to those of the other. This is the code I have for that movie clip:
Code:
package {
import flash.display.*;
import flash.display.MovieClip;
[Code].....
I get no errors whatsoever from this, but when I test it, I see the movie clip that I'm trying to control move with the general direction of my mouse movements, but completely offset from the mouse. Additionally, the movie clip flashes between four different positions constantly, and the output window traces the following four sets of coordinates even when I keep the mouse in one place:
Mouse Coordinates: 160,-110
Mouse Coordinates: 229,112
Mouse Coordinates: 237,368
Mouse Coordinates: 168,146
I'd like to know why there would be several sets of coordinates even when the mouse is stationary, and what I can do to fix this issue..
View 3 Replies
Jan 21, 2009
DisplayObject's have MouseX and MouseY getters. This is very helpful sometimes.Is there a way to easily query input state variables such as MouseDown or KeyDown?If not, I suppose I need to add listeners for these events, which is fine.
I am just wondering:why MouseX and MouseY get special treatment without a listener; if there are other getters for input data without listeners that I don't know about in other parts of as3.
View 4 Replies
Aug 1, 2009
I have a rectangle on stage with the registration point in the top left and a custom rotation applied.Would it be possible when I click on it that it changes its rotation to 0 but with a rotation center point around mouseX and mouseY ?
View 4 Replies
Feb 4, 2011
I have an object that I want to go to the mouse's pointer location when it clicks on a button, but instead of it being instant I want it to have some sort of a delay, like a walking motion. I've got pretty far but I can't get the logic out of it.
ActionScript Code:
game_area.addEventListener(MouseEvent.CLICK, moveCharacter);
// moves the character to the specified click point in a delay
[code]....
View 9 Replies
Aug 1, 2011
Not sure if I'm missing sth or is it just a bug. I have a movieclip on stage, it's a simple rectangle drawn with a rect tool (no stroke) I add an event listener to trace out the mouseX, works OK so far. When I increase its width the mouseX traces wrong values. Here's a sample code:
[Code]...
View 3 Replies
Oct 24, 2011
Anybody got a method of drawing a line from the mouse down point to the mouses current position.
But taking into account the direction the mouse is moving in to make the curve look more natural and directional.
This is what i have currently which is basic and rubbish:
catapultLine.graphics.moveTo(startX, startY);
catapultLine.graphics.curveTo(Main.gameStage.mouse X/3, Main.gameStage.mouseY/3,Main.gameStage.mouseX, Main.gameStage.mouseY);
View 14 Replies
May 25, 2011
I've got a grid of images which are added to a imagecontainer(Sprite) in a class. When I click a button, the imagecontainer gets tweened(scaled) to 0.2 Now I would like to start dragging around the images. on mouse-down I add an enterFrame Event:
[Code]...
Unfortunately the image is never on the mouseposition but has a increasing/decreasing offset to the mouse pointer.The alternative, startDrag/stopDrag works perfectly, but I stll need the mouseX/mouseY for placing the image on a grid.I tried also parent.mouseX, no luck with that.Why is this happening? I thought mouseX/mouseY is always depending on the stage-dimension.
View 2 Replies
Mar 9, 2012
This might be irritating simple. I am trying to convert some code from actionscript to cocos2d. I am quite new to actionscript and would like to know if there is a cocos2d function for mouseX/mouseY. If not, what would be the equivalent.
View 1 Replies