ActionScript 3.0 :: Mouse Updating Dependent On Position?
Aug 26, 2009
I'm making a simple puzzle-building game. It's working, but I have just spotted an odd in-game behaviour...When I pick up a piece of the puzzle and move to the left side of the swf, the game runs at a playable frame rate. The farther I move the mouse to the right, the frame rate (or at least update rate) seems to drop.The only code it's running at that point is a method that checks which piece is carried and moves that piece's x and y coords to match the mouse.I've already tried using 'updateAfterEvent' with no change.
View 5 Replies
Similar Posts:
Oct 5, 2007
I have some Headline MovieClips that are been attached on the stage on runtime based on an xml file.
Each Headline is placed one after the other vertically on the stage, and each one of them, when clicked, expands showing the description of the headline, pushing the other headline MovieClips down, according to how much _y is the description occupying.
I did a smilar example with some boxes attached on the stage with a loop, one after the other. Each Box, on RollOver, increases by _yscale to 130% for example and pushes the other Boxes down as:
i
Code:
mport caurina.transitions.Tweener; //using Tweener to tween the _yscale property
num =4;
var boxes:Array = new Array();
[Code]...
View 4 Replies
Sep 4, 2010
I did this to dynamcy create a instance of a MovieClip whenever my downKey boolean variable was true
PHP Code:
[code]...
works fine, but now I would like to update the position of the MovieClips every frame, I understand that it should be in my enter frame function but I dont understand how to access the MovieClips.
View 3 Replies
Feb 9, 2012
I would like to know if there is a way to update the position of the thumb on the Slider component when a movie clip plays. Currently I have a movie clip symbol on my stage with the instance name ShapeMC. It has about 10 frames or animation and two actions. the first frame has a stop action as does the last frame. The actions are on their own layer, separate from the actual animation. I also have the slider component in my library, but it is only there so I can reference it through AS3. My AS3 instantiates a variable of type Slider. I then define the properties, like the width, hieght, thumb size, minimum, maximum, as well as enabling livedragging. I did this so the user can drag the slider and move through the Movie Clip symbol. I added a button that allows the user to click it and autoplay the Movie Clip symbol (ShapeMC). All that works. What I would like to do is when I hit the play button, I would like to see the thumb on the slider move along the slider as the Movie Clip symbol (ShapeMC) plays. So if the Movie Clip symbol reaches frame 5, the slider thumb show be seen as being half way through the tread. I tried putting the currentFrame into the .value property of the slider, but that didn't do anything. No errors, but it didn't move the thumb at all.
View 3 Replies
Feb 1, 2006
Basically the x position of the mouse should control the play position of a movie. Do I need something like an event handler (I'm not sure exactly what these do, but I've seen similar scripts that seem to use them).
View 2 Replies
Nov 12, 2009
I have an Input Text area that users can edit and then submit. I need to be able to show, on screen, the cursor's current position as they type. I don't need to know where the mouse is but all work-arounds I've found so far can only tell me the mouse position. The font for the text is 'courier' or 'courier new' and the Input Text area is scrollable.
View 8 Replies
Mar 28, 2010
tween from one position to mouse position
View 1 Replies
Aug 31, 2011
I'm figuring out a way to update my mouse x and y inside a loop. In this small test block, I'm tracing the mouseX and mouseY twice. The first one is outside a loop. The second one is inside a loop.
When I test the SWF, you can see that the first trace changes constantly and seamlessly. But when you hold your mouse down, the code starts tracing the 2nd trace. Even though the mouse is down and moving, the mouseX and mouseY traced is not changing.
Actionscript Code:
import flash.events.MouseEvent;import flash.events.Event;var mouseIsUp:Boolean = true;stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);stage.addEventListener(MouseEvent.MOUSE_UP,
[Code]....
Closely related to the main question, when you click the stage, you would get 100 lines of the 2nd trace. Is there a way to break the loop as soon as the mouse is up?
View 4 Replies
Mar 15, 2011
PHP Code:
private function thumb_dragStart(e:TouchEvent):void {
StartstageX = mouseX;
prevX = mouseX;
addEventListener(Event.ENTER_FRAME,checkMouseDir);
addEventListener(TouchEvent.MOUSE_UP, dragStop);
function checkMouseDir(e:Event):void {
I am trying to use the ENTER_FRAME to update the coordinate of my mouse when the mouse click is down but when I extend to touch, the enter frame doesn't seems to work, because my mouse is no more on that stage, the enter frame cannot locate the movement of my mouse on the SimTouch neither on CCV. What other method I should use so that I can check the coordinate of my mouse or finger movement on the flash platform?
View 1 Replies
May 8, 2009
I have a flash clip that moves a movieclip when the mouse is clicked on the movieclip. Something very basic. I'm not using drag (since the MC doesn't move with the mouse all the time), but rather using onMouseMove to update the MC location according to _xmouse, _ymouse and some other calculations. The problem was that under internet explorer the movement became very slow and if I kept moving the mouse slowly, it wouldn't update until I stopped. I checked the traces and the event was triggered properly. I tried using updateAfterEvent(); This didn't happen in firefox. (After a long, frustrating debugging I eventually found out what caused this. Since I've looked for the answer online and didn't find one, I've decided to add it here for others.)
View 1 Replies
Oct 29, 2009
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);
View 3 Replies
Mar 9, 2010
Code:
addEventListener(MouseEvent.MOUSE_WHEEL,mouseWheel);
function mouseWheel(event:MouseEvent) {
Map.scaleX = Map.scaleX + event.delta*.01;
Map.scaleY = Map.scaleX;
}
The problem with this code is that it scales from the registration point (0,0). Due to the other transformations I'm doing to this image at various times, it isn't possible to move the registration point. The image is larger than the stage and the user is able to drag it around. I want the mouse wheel to zoom in on the place the mouse is hovering over (or at a minimum...the center of the "view" they have...aka the stage)I tried doing this:
Code:
internalPoint = new Point(Map.mouseX, Map.mouseY);
externalPoint = new Point(stage.mouseX, stage.mouseY);
var matrix:Matrix = Map.transform.matrix;
[code]....
Which, incidentally, I'm using that whole portion of code to zoom into the state they will be in when they use the mouse wheel.
View 1 Replies
Apr 21, 2010
I have MC masked with TEXT,when the user moves his mouse down more text appears from the bottom and when he moves it goes bakc to the original position...I do not want the mouse wheel .. I woudl like to do it by mouse hovering...
View 5 Replies
Oct 6, 2007
I've got a Flash site that uses a loadvars object to load a csv file that I then parse into arrays. The swf works great locally and on two hosts I have tested it on. However, I can't get it to work on the host server I own (er..rent). The HTML file, swf and csv are all stored on the same level and I've even included a policy file just in case. Additionally, I have changed the path to the csv in the Flash file several times to see if that was the issue. I created a trace that indicates my data is loading, but the functionality isn't working, leading me to believe the parsing is at issue. Any ideas why this file would work fine on two other servers but bomb on a third?? I'm completely stumped.
View 1 Replies
Jan 1, 2010
I am trying to get the mouse's position even when it is outside of the flash window. How can I do this?stage.mouseX/Y only returns the mouse position on the stage, not when the mouse is outside. Is there another way?
View 5 Replies
Sep 14, 2009
Hopefully this is a straight forward question but as far as resources when compiling a flash project is flash more cpu dependent or gpu dependent? Trying to spec out a machine and need to determine what flash is going to use more.
View 1 Replies
May 18, 2010
I want my site to load different content depending on the time of the day, day of the year, holidays, etc.
Does anyone know how to do that in AS3?
I use CS5 Master Collection. Work mostly in Fl.
View 1 Replies
Jan 19, 2011
I'm building a Flex/AIR application that connects to a remote server, the URL of which changes depending on the environment (development/production, and possibly others). For now, this URL parameter is hardcoded in my root application MXML file but it means I have to change it everytime I build my app for a different environment.Is there a way to externalize such a parameter so that when Flash Builder automatically builds my app (in development mode), it uses the development URL
View 1 Replies
Oct 5, 2011
I'm working on a flash project and wanted to rename an .as file. When I changed the name, the .swf breaks. Is there anyway I can remap the .as file to the .fla from CS5.5?
just wanted to know where is it preferred to keep your .as files? I've seen examples where people store them in a separate folder (ex. Actionscript/MainTimeline.as) but I've also seen examples where people just keep all the .as in their .fla file.
View 2 Replies
Apr 18, 2011
I have a function which makes the line size change dependent of the speed of the cursor. Faster movements = thicker line. It works as it should, but im trying to call it thru external Interface an a .Js. The line size changes but not when drawing, it looks like it bases the line size on the speed the cursor had before the mouseDown is fired. So it changes speed but not while drawing.
ActionScript Code:
var prevPt:Point=new Point(mouseX,mouseY);
ActionScript Code:
var THICKNESS:Number = 1;
function mouseDown(_x:Number, _y:Number):void {
[Code].....
View 1 Replies
Jul 21, 2011
how i can develop my AS3 code from a previous project, here is the code: -
ActionScript Code:
stop();
import flash.events.MouseEvent;
import flash.filters.GlowFilter;
[Code].....
What i would like to do is load a file depending on the locale, for example if the locale is 'en' load ENGdoc1.exe or if it is 'fr' load FRAdoc1.exe.
View 0 Replies
Mar 4, 2007
I seen alot in many sites. Full screen flash site with objects in the site centering or their predestined position as browser scales.
View 3 Replies
Apr 11, 2010
The closest I have come to is the basic mouse hide and then mouse show, however this only gives the illusion of the cursor not being there, however you can still use it. I would like the cursor to be 'disabled' within the flash movie for a limited time. Either by it disapearing and then reappearing, or by it being frozen in place
View 2 Replies
Jan 12, 2009
How can i use mouse position in as3?
View 1 Replies
Jan 27, 2009
I have a panning background with buttons in it. It would be nice if when the button is pressed i could move the position of the mouse so that the movie pans and catches up with the new position. Is this possible?
View 4 Replies
Jan 6, 2010
We have a flash vector type map with pan and zoom ability and need to have layer1 which features a simple flash vector map visible from the initial overview until when the user has zoomed in to a certain amount when a more detailed layer2 flash vector map then appears and layer1 disappears. I would imagine a code turning off or on visibility of a layer dependent upon the zoom is what we need.
View 1 Replies
Nov 20, 2010
I'm trying to make an online advent calendar, and I want to know whether it is possible to add an actionscript code to a button in flash, so that it wont be visible or active until a certain date?
View 17 Replies
Nov 20, 2009
I want to do something which is probably pretty simple but I've got absolutely no idea how to do it!What I want is for the Alpha value of an object (movie clip) to change depending on the x position of the mouse. So when the mouse is at 0 the alpha of the object will be 0%, and when it's at 100 the alpha will be 100%
View 4 Replies
Jul 20, 2011
So I'm working on my portfolio and I got this problem. The code posted scrolls the sprite "cellContainer" based on the position of stage.mouseY. Perfect.Problem is that I want stage.mouseY to equal the entire cellContainer height. Kind of like how a small tablet equals a huge monitor. So when stage.mouseY = 0,cellContainer.y = 0 and when stage.mouseY = stage.stageHeight, cellContainer.y = stage.stageHeight - cellContainer.height. Right now, it scrolls, but it takes a while to scroll throught the entire height of cellContainer. I want it to be proportional to stage.mouseY.
Actionscript Code:
private function scrollStart(e:Event)[code]....
View 4 Replies
Jul 28, 2009
I have 16 MC on stage when they are clicked they can be draged but how do i make the one being clicked above all the others?
View 8 Replies