ActionScript 3.0 :: Moving Object To A Certain Position?
Feb 3, 2009
The following code works fine when mouse is pressed at any position on the screen ,object moves that position...but what if I want the object move that position at a certain speed..say+10 using setInterval...I mean I want my object move slowly to any position I click on the screen..
PHP Code:
onClipEvent (mouseDown) {
this._x = _root._xmouse;
[code].....
View 5 Replies
Similar Posts:
Jun 3, 2010
I came across a problem where my flash timer keeps changing position as the browser window is resized or if the user scrolls down the page the timer will move with it?It also changes position on different monitor screens.Is there an easy way without too much code to position it at a certain position on my page :[URL]As you can see its too low and should be in line with 'Comming soon'Im also using Dreamweaver if that makes a difference.
View 2 Replies
Jun 19, 2005
I use the following function to move a mc to a certain y position. When that y position is reached the mc goes back to it's original position:
Code:
function moveInOut (clip, yPos, speed){
var yStart = clip._y ;
var yTarget = yPos;
clip.onEnterFrame = function (){
var dY= yTarget - this._y;
[Code] .....
But I don't want the mc going back to it's original position but to a completely different y position to create kind of a bounce effectHow to accomplish that?
View 14 Replies
Jan 26, 2006
I want to make a movie clip move left continuously and smoothly on rollover then on rollout i want it to be able to move it back to its original position with an ease. The problem is getting it to remember the position it finished in on rollover. How can i do it with actionscript?
I want to do it all with actionscript because I did it with frame labels and tweens first of all but its not smooth enough, it jumps in certain points because it cant remember how far left it moved on the rollover.
View 4 Replies
Dec 18, 2011
I can have the parent move the position of the child by adjusting its _x and/or _y. The child can move itself along the x axis by using _parent[childname]._x = but I can't get it to move along the y axis using _parent[childname]._y = , it just doesn't move.
View 13 Replies
Sep 29, 2010
I have a question about moving and animated player symbol to the mouse location on a MouseDown event. Right now I have it set up to do an easing so that I can control how fast the player moves to the location. Problem is that it is done with easing. I don' t like the easing because the velocity of starts really fast and then slows down before it reaches the mouseX and mouseY location. I would like just a plain ol' stroll from the player location to the mouse location on the MouseDown event. Here is my code:
[Code]....
View 8 Replies
Jan 6, 2010
I had coded a different file similar to this and had a movieclip move along the x axis relative to where the mouse position is.
The idea is the movie clip is a panoramic photograph (eg. 6000x900) and it would move dependant on where the mouse it. ie. if mouse is in the centre it will be stationary and when it moves left and right the image will move accordingly (faster when further away from the centre).
The code below works moving the movieclip's x position but when I try and do it with TweenLite (using the quotations for relative positioning) the movieclip snaps immediately to -107374182.4
ActionScript Code:
import com.greensock.easing.*
import com.greensock.*
[Code]....
There is obviously something fundamental I am missing but cant see it at the minute. I had this working previously but then tried to progress it and write my own class for the panning (that now turns out I do not have time for) but I saved over the code and cant not go back.
I have put together an example zip with a .fla and the greensock tweening platform.
View 2 Replies
Nov 28, 2005
I am working with a block of dynamic text that is being loaded from an external text file. Imagine it looks like this:
Image 1:
Some text here.
Image 2:
Some text here.
Image 3:
Some text here.
You get the idea. This text is in a scrolling text box. What I'd like to happen is when the function gotoImage2() is executed, the text scrolls the down to Image 2 so that it is at the top of the text box. Make sense? Seems like a variable needs to be embedded in the text file, but I have no idea how to do the rest. I also can't get any of my custom scollers to work. They all embed the text in a masked mc. Is this the only way to scroll dynamic text? Any good pointers to smooth text scroller tutorials I'm using Studio 8.
View 1 Replies
Dec 26, 2005
Is there any way in flash in which i can control the position of the mouse? i need to be able to reset the mouse to a predefined position, but when i do _xmouse=value nothing happens and if i am using mouse._hide and have a movieclip instead of the mouse and do mc._x=value the movie clip goes to my position but as soon as i move the mouse it goes back to the previous position... i need a way to control the ACTUAL "ms windows" position of the mouse ... maybe with Javascript?
View 10 Replies
Apr 8, 2006
I have a horizontal scrollbar. I want this scrollbar to move a movie clip left and right on the screen.I cannot figure out what I am doing. In one example I'm looking at, it has the script on the button of the slider:
onClipEvent(mouseMove){
_root.vPosition = _root.SliderMC.ButtonSliderMC._y * 5 / 6;
}
I can't figure out the math for my scrollbar. How do I find the fraction that is in this part of the script? The numbers are not matching up for me. I also can't get my slider to go left to right. It keeps going down. And my image that is suppose to be scrolling the with slider is not even moving.
View 3 Replies
Jun 9, 2006
I'm creating a strip of 6 characters horizontally - 3 will fit on the screen at any one time, with the option to flick the mose left or right to scroll and see the rest. I'm after a tute that covers moving the mouse left and right, and shifting a movie clip in the opposite direction (only along the x axis), with easing, and depending how far from the center of the screen the cursor is.
View 3 Replies
Oct 23, 2006
I want to be able to move the list names of the listbox up and down can this be done through actionscript.or is there any way to bring the selected item to the top
View 1 Replies
Sep 12, 2007
I have this script, that zooms and fades the movieclip but I also need to shift the position slightly from the start state to the end state. For example var startX = 60 var endX = 70 so when the zoom start it starts at x = 60 and slowly moves as it zooms out to x = 70.
View 1 Replies
Jun 23, 2009
I've got this: [URL]
and need to add a function which changes position of those three mc's(myMC, myKulicka,myStin) to the center whenever the MouseMove stops. Thx for any advice
Used AS:
_root.onEnterFrame=function(){
if (startMoving==true){
myMC._rotation=_xmouse;
[Code].....
View 1 Replies
Mar 21, 2004
The selector mark is suposed to "mark" the selection on the menu after a selection is pressed. But Im having problems with the X and y coordinates and scales of the MC and when I click on the option, the MC gets smaller and then bigger to the size I want. Its suposed change scale and position but its not working like it is suposed to work. Im not sure either if I�m setting the Mc on the initial x and y coordinates.
View 4 Replies
Sep 9, 2005
How can we simulate this effect? (Letters moving with mouse position?)
View 4 Replies
Dec 3, 2010
I'm totally new to ActionScript and don't really know what I'm doing yet! I have an assignment due Thursday and one of the things I'm currently stuck on is: I'm trying to get the water in a beach scene to gradually move down the screen until it fills the screen (and then the game will be over). At the moment I'm trying to do this using a timer event, is this right?
View 4 Replies
Feb 23, 2012
I am trying to do a apply a tween for the width property on a MovieClip Object but every time it changes the width and the position too, and I don't want that. I want to change the width going to one side without changing the x and y of the object.
I tried both of thes and they gave the same result.
var c:Tween = new Tween(left, "scaleX", Strong.easeOut, 1, 1.5,20,true);
var c:Tween = new Tween(left, "width", Strong.easeOut, 20, 200,20,true);
I think it is applying the transformation according to a center of the movie clip. but I don't know how it can be changed.
View 2 Replies
Apr 13, 2011
Im working on a small project and it involves a guy which you move with the arrow keys. The arrow keys add to his x, y velocities and his position is updated accordingly. How can i get this man to grab onto an object and spin around it (like when you grab pole and letting your momentum swing you around) . I can make him grab the object but I dont know how to modify his x,y speeds to simulate the arc.
View 4 Replies
Feb 25, 2010
I am developing a game like this. [URL]. I just start this game And stuck in a problem. Moving arrow of game according mouse moveing like Given URL just check out. I know it is just a mathematical calculation. I have done according X position of mouse moving. But confuse something With Y position also. So I am not getting proper solution of X & Y position Both Togather.
View 2 Replies
Apr 12, 2012
I seem to be having problems with rectangles moving from their assigned positions when all I want to do is decrease their width.A game I'm working on simulates an explosive with a fuse. The fuse decreases in size as a clock counts down to 0.I think the problem has to do with local coordinates vs. global coords, but I'm not sure how to rectify the problem. Here is some code:
//fuse
_fuse = new Sprite();
_fuse.graphics.beginFill(0x000000);[code]........
Nowhere in my code does the x position of the fuse change.Aside from this one issue, the rect functions exactly how I want it to.
View 1 Replies
Aug 11, 2009
I'm creating a slideshow gallery in flash and am basically there now except for one bit...
have a look here [URL]
The slider at the bottom for the thumbnails moves ok but I want it to stop at the last slide. I
I can manage to code it based on the mc's _x value
i.e if (mc._x < -200){ //do nothing }
but this creates a dead stop and I want a gently slow down like if you were to navigate from thumb 8 back to 1.
all of my coding at the moment uses the mc's x value in relation to the mouse's distance.
The code I have currently set on the slider is:
Code:
onClipEvent (enterFrame) {
if((_root.slidesQTY>6)&&(_root._ymouse>460)){
if(this._x<0){
[Code]....
how I could add another if statement that doesn't halt the animation as it hits the last slide but creates a smooth slow down?
View 0 Replies
Jul 15, 2004
I have a block that I'm trying to make move from right to left, and if the block gets to a certain point, it will move back to it's original position. So, I have this on my block (movieclip) right now.
Code:
onClipEvent(enterFrame) {
speed = 3
dist = 8.5
_x -= speed;
if (_x = dist) {
_x += 3
}}
But all this is doing is throwing the block at the 8.5 distance...
View 9 Replies
Feb 4, 2005
drag and drop, basically say I got A movieclip called 'clipdrag'. the current position of the movie clip is _x=65, _y=51.
and the clipdrag movieclip is droped at say _x=200, _y=300. Bascally what i need to know is how i got about bring the clip back to its orangial position, i want to use a timer so that the user can see the clip moving back slowly.
View 4 Replies
Jun 18, 2008
I have a circle and a square on the stage. When you click on the square the circle will go to "circle._x = 300" when the circle is at 300 I want to make it when you click on the square the circle will go "circle._x = 45"
Code:
moveCircle = function () {
circle._x = 300;
if (circle._x >= 300) {
circle._x = 45;
}} square.onRelease = function() {
moveCircle();
trace(circle._x + "is the position of the circle");
}
View 5 Replies
Feb 4, 2005
do a drag and drop, basically say I got A movieclip called 'clipdrag'. the current position of the movie clip is _x=65, _y=51.
and the clipdrag movieclip is droped at say _x=200, _y=300. Bascally what i need to know is how i got about bring the clip back to its orangial position, i want to use a timer so that the user can see the clip moving back slowly.
View 4 Replies
Oct 13, 2010
my title explains what im need but im using flash cs4 and heres what i have so far:
var centerX:Number;
var centerY:Number;
var centerZ:Number;
[Code].....
ok so RBall is my first moving object and my orbiting object will be called orbit
View 9 Replies
Dec 16, 2009
I am having difficulty with getting the playhead to move inside a movieclip based on the horizontal or vertical position of the mouse on the screen. I can get the horizontal motion to move the playhead, but I can't get the vertical movement to do the same. I have attached the document class .as file for it.
View 2 Replies
Feb 22, 2012
I have 2 container MovieClips (mc1, mc2), each of them has a separate x,y, rotation. I want to take a child from mc1 and addChild() it to mc2 while keeping the same x, y, and rotation on the screen so you see the added child mc as if it didnt change position or rotation, just moved to the other MC.
View 3 Replies
Feb 16, 2011
I'm trying to trace the path of an object by using setPixel on the object's position every frame in a BitmapData/Bitmap pairing. These pixels aren't showing up normally and I suspect I have a fundamental misunderstanding of the BitmapData class. Here's what I'm doing:
public var contrailBase:BitmapData;
public var contrail:Bitmap;
private var contrailColor:uint;[code].....
Using this code, the red pixels don't show up. If I initialize contrailBase to 0xFF000000 instead then I get a black screen on which the red pixels DO draw, but I need the bitmap to be transparent except for the contrail. What am I doing wrong?
View 2 Replies