Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Moving An Object To Another Objects Location



hi, i am creating a vertical shooter adaptation.

i am trying to create the enemy units to fire in a direction at the main unit.

The problem is that the bullet follows the main unit instead of moving in a straight direction where the unit used to stand.

I am using timers for creating the animation and i have tried changing the rotation of the bullets. I have got it to rotate in the direction i want it to but it doesnt move there.

i am also trying out this temp object thing where an object is left at the main units last location and the bullet travels to that location. its not working yet but i am going to give it another try.



KirupaForum > Flash > ActionScript 3.0
Posted on: 03-16-2008, 06:11 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Moving Different Objects To One Location
Howdy, i have the following problem

First Object: x100 y100
Second Object: x400 y400
Thrid Object: x200 y200

when a counter reaches a certain number they all have to move to
x300 y300

how can i do this via AS??

any help

thanx in advance

How To Move An Object Slowly And Smoothly From Location 1 To Location 2?
Hi,

I am new to ActionScript. I wish to use ActionScript to move an object slowly and smoothly from location 1 to location 2.

I learned that I can use the following to move an object to location 2 (x2, y2):

mThisObject.x = x2;
mThisObject.y = y2;

However the object just "swift" from location 1 to location 2, not moving slowly and smoothly from location 1 to location 2.

Could some experts here provide a guideline for me?

Thanks and best regards

Alex

How Do I Specify A Location For Objects?
I am trying to create a flash with a header text with an effect. Then after the effect is ran, I want the text to remain while a second line of text runs its effect. Then I want the first two pieces of text to remain while a third piece of text runs its effect, and so on.

I did this by putting the first text with effect in key frame 1. Then in key frame two, I put the same text without an effect PLUS the second piece of text with an effect, and so on. The problem is I can not quite get the text to line up exactly with the text in the previous key frame so it is a little choppy. I can see what appears to be the location of the text on the bottom tool bar, but I can not find out how to change it.

BOTTOM LINE - Is there a way to specify a piece of text, object, or whatever else to be a set number of pixels from the edge and top?

Moving A MC To A Random Location
two questions actually....

1st...On a mouse over...I want a movie clip to move to a random location on the stage.

2nd...somewhat related...I want to be able to click...anywhere on the stage...and the movie clip goes there.
I know how to do this with "easing"....but I want the movie clip to follow a path...not a straight line.

In other words...if I had a maze....and I clicked somewhere in the maze....the movie clip would follow the maze to the location.

Too much to ask?

Any help would be appreaciated!

Thanks!

Moving A MC To A Random Location
I want to move a Movie clip....to a random location on the stage...based on when a user does a mouse over on the Movie clip.

In other words.....if I had a little box...in a movie clip...sitting on the main stage...and you mouse over it...I want it to "slide" to another location...but I want it to be totally random...

What type of code do I use?

Any suggestions would be appreaciated.


Thanks,

Mark

Moving A MC To A Random Location
I want to move a Movie clip....to a random location on the stage...based on when a user does a mouse over on the Movie clip.

In other words.....if I had a little box...in a movie clip...sitting on the main stage...and you mouse over it...I want it to "slide" to another location...but I want it to be totally random...

What type of code do I use?

Any suggestions would be appreaciated.


Thanks,

Mark

Moving Flash From One Location To Another
A customer of ours has asked us to copy their existing site as they are unable to get hold of the developer who originally built it and they need to update the site.

We used Httrack and this has copied everything exactly and when I run the site on my machine it runs fine, however when I put the site on our server on a sub domain it doesn't load the flash movie even though it is pointing to the right place



Code:
<object
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/s...s/flash/swflas
h.cab#version=6,0,29,0" width="518" height="104">
value="swf/swf.swf">
<param name="quality" value="high">
<embed src="swf/swf.swf" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="518"
height="104"></embed></object>

Moving Site To New Location But Always Looks At Old Links
I have made a site in dreamweaver with a flash navigation bar.
Clicking on a button in the flash nav bar loads a new html page below it.
However, when I transfered the whole thing from my drive to the internet the buttons were still looking on my hard drive for the pages.
(macintoshHD/users/jennie/sites/olympus/home.html).

I had to go back into Flash and re-do all the links to correspond to the web site address: (www.olympus-automation.co.uk/home.html)

This was fine, but now the client wants to put the site on all his salesman's PDA's but of course the PDA is now looking for the files on the Internet even though they're all stored in it's memory.

Is there any way of making the files work in the same way that Dreamweaver does? Dreamweaver is intelligent enough to figure out that when you move a site to a new location, all the relevant files have moved with it....

Any help would be appreciated as I'm in the brown sticky stuff - big time!

Jennie Flowers
Alive Studios
admin@alivestudios.co.uk

Moving (teleporting) A Movieclip To A New Location.
Hmmm, it is late and I am pretty tired out right now. Do you guys know of a way to make it so when a movieclip (The moveable "character" in my side scroller) hittests another movieclip the character is moved (teleported) to a new location? Thanks guys, I really appreciate it.

Duplicating Mcs And Moving To A Specific Location
hi in this fla i have a square duplicating it self going to the right when it reaaches a certain value it goes down one "line" the problem is when it goes down it won't duplicate and move the _x value.. or something like that ...check the fla

any help really really appriciated!!
thanks ahead, z00m

Location Of Shared Objects With Associated .exe File
Currently I have a .swf file located on my desktop and the location is:

c:Documents and Settings imDesktopjournaljournal.exe

the location of its associated shared object is:

c:Documents and Settings imApplication DataMacromediaFlash PlayerLocalhostDocuments and Settings imDesktopjournaljournal.sol



2 QUESTIONS:

1) Is it possible to have the shared object travel with (Attached to) the executable so that information stays with the .exe no matter where it sits?

2) Is it possible to have the shared object in the same folder as the .exe file so the the path to the .sol file looks the same.

Shared Object:
c:Documents and Settings imDesktopjournaljournal.sol

Executable:
c:Documents and Settings imDesktopjournaljournal.exe


Thanks for your help!

Shared Objects File Location
just a quickie, ive been using shared objects which are working fine but im curious as to where the SO files (*.sol) are stored. i read they are by default kept in the same dir as the flash player but i cant see them.

in fact ive done a search for all *.sol files on my pc, nothing. they should be somewhere though, doing their job in flash fine.

any ideas?

How To Make Objects 'snap' To A Location
I was wondering how to make an object snap to a specific location when dragged to an approximate area. For example, when dragging a solid circle to an outline of itself, the circle would snap perfectly in place when user releases the button. Is there a built-in mechanism that allows for this. I already know how to drag and drop. Any help is appeciated.

Moving Clips To Specific (x,y) From An Unknown Location
Okay Flash Gods... I have a clip that is floating about the stage... now when I release a button I want the clip to travel to a specific point on the stage... by travel I mean I want to see the clip move to the point.. not immediately appear to it.

I'm using Flash MX (not 2004)

-Pez

Shared Objects Location On A Hard Drive
I am developing an interesting site and would like to store user information for repeat customers. I stumbled across shared objects and understand the concept quite well with the exception of where the files will be stored on a users hard drive. If I create a shared object does the clients computer automatically store it in some default directory?

I read somewhere that it is WindowsApplication DataMacromediaFlash Player

But when I searched my computer there was no such folder to be found. It must have been for earlier versions of Windows. Could someone elaborate on where a shared object will be stored, and if the clients computer just knows where to store the object when it is playing a flash movie? Or do I have to manually specify the directory on the clients machine?

Thanks,
Sam

Moving Objects: Moving Keyframes?
Can I move multiple layers on a timeline, so that they will all move. Basically I just want to move the location of the multiple layers.

Whenever I do this, it seems to move only some of them and thus the whole animation is messed, different starting points and ending points...a big mess.. It makes me want to cry.



Seems like there is an easy answer or I might just be the biggest chump on the planet.

Case

Moving Objects: Moving Keyframes?
Can I move multiple layers on a timeline, so that they will all move. Basically I just want to move the location of the multiple layers.

Whenever I do this, it seems to move only some of them and thus the whole animation is messed, different starting points and ending points...a big mess.. It makes me want to cry.



Seems like there is an easy answer or I might just be the biggest chump on the planet.

Case

Determining When Object Gets To New Location?
Hi!

I'm trying to figure out how to tell when an object gets to it's target location? I have a title area that I am moving using.

_level0.title.ypos = 360;
there is some other script on the title but that works fine so I don't think it is necessary to post.

The next part is I have the new section loading along with the button which makes the title area move. The images on the new section interfere with the title area moving and I know that depending on loading time, cpu power etc. it won't take the same amount of time to move on everyone's machine so I was wondering how I would find out when the title area gets to it's final location (i.e. y 360)

I've tried variations of this on the section that is being loaded placing the content on frame 3

if (_root.title._y = 360) {
gotoAndPlay(3);
} else {
gotoAndPlay(1);
}


Any help would be greatly appreciated

Set Shared Object Location?
Is it possible to make flash create shared objects in the local directory where the swf/exe resides?

Tea

Shared Object Location
Hello all, Does anyone know of a way to save a Shared Object to a specific folder? Or even if this is possible?... Just trying to find an alternative to writing to .txt files, because I've learned that you can't with strictly flash...

Thanks in advance for anyones help!

Peace,
~Bill

Set Location Of A Draggable Object?
Hi all,
Is it possible to set the starting location of a draggable moviclip (or make a draggable mc go to a specific location in any way)??

Whenever I create one, it seems to go to the absolute left side of the draggable area (unless of course the user drags it somewhere else).

I don't know if it matters, but for my specific project, I'll need it to go to the center of it's draggable area.

Any help would be appreciated - Thanks!

- Kent

[F8] Shared Object Location
can anybody tell me if you can save a shared object to USB memory key or an external hardrive, and then read it from that location. i no you can set the local path but it wont work, it will only let me save it in the flash player folder.

Location Of An Object Over A Movie
Hi all

I am producing a festive game, based on the sport of curling. I want to detect where an object ends in a movie.

The object will slide into position over a target. Each area of the taget will have differing values (points).

I need to work out where the object is and therefore how many points the player has won.

I hope this makes sense, as always, any help would great

thanks

Making An Object Dissapear Once A Moving Object Makes Contact With It
Hello there,

Im in need of some help. Basically I need a code which will make an object disappear once another moving object hits it (MovieClips controlled by AS)

For example, a bullet comes out of the gun and hits a can which makes the can disappear as soon as the bullet hits it.

Is it something to do with the "intersects" function? I've been trying to solve it all day and cant do it

Please help.

Whats It Called When You Drag An Object And Want The Object To Continue Moving
i am trying to work out how to make a draggable movie clip/button continue to move in the same direction as the drag guides it...hmmmm does this make sense???? what is this function / behaviour called.... i have looked at many many drag tutorials but at present have only managed to find drag and drop type onces with target positions.... also does any one know if it is possible assign multiple drag points.

regards....

Local Shared Object Location?
in flash mx, why doesn't this work?

myLocalSO = sharedobject.getLocal("flashcookie","//NetworkPC/shared/test" );

in other words, how can i get the shared object to be saved in the "test" folder on my network drive. the .swf that's saving the shared object is also in the "test" folder.

thanks!

Bringing An Object To The Stage At A Set Location?
Hey;

I need for flash to put an object from the library at a set location when another object (which is falling) hits the ground. Basically I need to know if there is a way to bring an object in, at a certain place from a command line placed in another object in actionscript.???

Making An Object Move To A Specified Location.
Hi. How do i make Obj1 move to Obj2 without easing?
I want it to move Obj1 to Obj2 "walking" not "directly" by setting its _x and _y values.

Example for code with easing:

onClipEvent (load) {
_x = 0;
_y = 0;
speed = 5;
}
onClipEvent (enterFrame) {
endX = _root._xmouse;
endY = _root._ymouse;
_x += (endX-_x)/speed;
_y += (endY-_y)/speed;
}

Different Shared Object Question, Can You Change Their Location?
Can the location of shared objects be changed (say to My documents?)

I need it for a network, I would like every machine to access the sol file , as my user may pic any machine in the room (when they log on).

At the moment my app is working fin, and reading the sol, providing they use that specific machine. Every machine has its own sol file, where I would like1 file that covers the entire network (such as my documents)


I have the shared object working fine, and have used the tutorials and search facility (so i dont need help with that side of things)

Please help

[F8] Shared Object Location And Write File
Hello,
I'm developing applications with Flash 8 and ActionScript 2 and I would like to know if it is possible:
1 - to change a shared object file(.sol) path to the swfs path for example?

I want to do this because when I use the swf in an other computer I want to have the .sol together. I've investigated and it looks like it isn't possible but maybe someone has a solution

2 - But if this doesn't work does someone know any alternative?

Because, I have 2 swfs, 1 "activates" the other. So I want the swf that activates only to work once. But in my actual solution it works only once if on the same computer if I change computer it works again.

3 - Writing to files is only possible with third-party solutions isn't it?

Thanks in advance,
M.Anturio

Snapping To Location And Object Duplicating / Deleting
Hi... As you can tell, I'm new here, and I wanted to know if someone could provide me with some assistance. What I am trying to do is create a SWF file to make Pokemon cards. (Don't laugh, please...)

First, I want to set up is a grid of lockable locations and Energy symbols...

http://pokemonpalace.net/tcg/images/...-col-basic.jpg

Now, the idea is to have invisible movies over each of the transparent gray circles on the left side. The movie clip to be 10 frames, 1 blank at the beginning, and the other 9 being the Energy symbols. Then, from an area of symbols (nine different Energy symbols of equal size), the user would drag a copy of the movie clip (or button) containing the Energy symbol to the transparent gray circle. When the cursor is released, and the Energy collides with the movie, the symbol being dragged would disappear, and the movie clip would advance to that frame. (On a layer above it is a button to return it to the first blank frame, in case the symbol is misplaced and needs to be deleted.)

This is the first step in my project. Any assistance would be very much appreciated.

Make Flash Object Move To Specified Location
I have a navigation setup in which I want a bar to follow the cursor when the cursor enters the navigation box area itself. (Basically it will follow up and down only. My question is when the cursor gets within the general vicinity of a menu item, I want the rolling bar to move to exactly over the menu item. So even if they don't have the cursor exactly over say, "Home", it would still move the bar exactly over it with the assumption that this is the menu choice they want. Hope this makes sense!

This is the code I have so far:

function moveMask () {
if(_root._xmouse >= 820 && _root._xmouse <= 1000 && _root._ymouse >= 80 && _root._ymouse <= 400) {
Bar._y -= (Bar._y-_ymouse)/5;
if ( Bar._y >=318){Bar._y=318;}
if ( Bar._y <= 110){Bar._y=110;}
if ( Bar._x >=1000){Bar._x=1000;}
if ( Bar._x <= 820){Bar._x=820;}
}
}

Navigation.setMask(Bar);

Thanks,
Dave

Send An Object To A Specific Location On Main Stage?
im still pretty new to the terminology for this program, so my attempts to search for this topic have been unsuccessful.

I have a movie clip within another movie clip and I want one of the objects in the embedded movie clip to end at a particular spot on the main stage. Is this possible?

thank you so much in advance.

Moving The Stage After Resizing - Or Moving All Objects On The Stage? Heeeelp
Hello! I'm in dire need of help!

I've been forced to resize the stage of my movie but as the stage is expanded to the right and down everything ends up in the wrong place. So I wonder:

Is there any way to move the stage rather than the contents thereon?

or

is there a way to move all the content on all layers and even all scenes simultaneously?

or

is there a way to expand the stage equeally on all sides rather than just right and down?

THANKS ALOT TO WHOEVER COULD HELP ME!


Freddy D, Stockholm, Sweden

Moving Objects
Hi, i'm making an anamtion that scrolls pictures by left and right when you put your mouse over the "<" and ">" buttons. I have that part working fine but my problem lies here... i have this code in a separate movie so that the movie will loop and run the code over and over again will the mouse is still over the button.

//this is for the left button and it moves the picture to
//the left 10 (there's also one for pic2-pic5. this code
//works fine

tellTarget ("/pic1") {
setProperty ("/pic1", _x, _x -= 10);
}

//if the picture got beyond a certain _x val i wanted to
//move it to the other side so i used this code.

if (pic1_x <= -1240) {
tellTarget ("/pic1") {
setProperty ("/pic1", _x, "1240");
}
}

now this code, well, kinda works. it sees that the picture is beyond -1240 and it moves it self to 1240. But for some reason it doesn't start moving to the left again. In fat i tried a += 50 where the "1240" is and it kept moving to the right 50 so it's running that if statement even though it's no longer <= -1240. is there something wrong with my if statement?

Moving Several Objects As One
I'm creating a list of items using the duplicateClip function.

Each item is placed clip._height below the previous one.

It just so happens that the list may be too long to fit on the screen, so I have to give the effect of moving the group.

Can I create this list of items as if they were one? Then, all I would have to do is move this one item.

Better yet, because I'm sure that this question or one like it has been asked several hundred times, what should I search for when looking for tutorials or previous posts on the subject? Does this concept have a name?

Thank you

Whe Are Objects Moving?
heeelp....my objects are moving
e.g. i want my objects to be on whole pixels, so x=15 and y=15 however as soon as i press enter it moves back to 15.3 and 15.7 or something like that. i unchecked 'snap to grid' 'snap to guide' however that doesnt seem to be the problem.

any ideas?

thx!

Moving Objects
I know this might be silly, but.. I cant quite figure out the way to make objects moveable on a flash screen. You know, the eggplant way?...

Moving Objects?
How do I get a object to move along the x axis when the user presses the left and right cursors.

And how do I stop the object from goin off of the side of the scene?

thanx alot

cya
Andrew

Containing Moving Objects
hey
i've got a bit of a problem i've created a function that tells eight objects to randomly choose between eight possible directions and move in that direction. this works perfectly. the problem is i want to contain this motion within a set square for example if it hits the border of the square diagonaly iwant it to bounce off in the opposite direction. does anyone know of any tutorials showing how i can create these parameters.

Moving Objects
Hi, I'm trying to make an animation in which a square (line, or any other shape) moves from one point to another (like moving from top to bottom). I was wondering if there's a way to do it different than making many frames and just change the possition of the object in each frame 'til it gets to the final possition. If there's an easier way to do it or if there's some sort of software that may help to do this, PLEEEEASE let me know.
Thanks a lot.
G.

Moving Objects....
Is it possible to move objects in micro movements? I know I can move objects in larger spaces holding shift down. But can I move in smaller increments by holding something else down..

Moving Objects
I created a map movie, and decided late in the game that I was going to load the map movie into my interface with a load movie function. Originally, the movie was created with the map in it.

Anyways, how can you move all of your animated parts, frames, ect. While keeping everthing intact. Basically I need to move all my files and resize my movie.

Is there an easy way to do this? Like a select everthing? I tried selecting all the layers but it always seems to miss some parts.

-eric

Moving Objects
Ultra newb question here, but how do you move an object around on a layer similar to the way you do with the move object tool in PS?

Moving Two Objects At Once
I have to images one of a sun and the other is a flower.I have it so that i can drag the sun from one spot to another but what im trying to do is have it so that the flower image will flip or move so that it is following the sun as it moves.
Any help would be great.Thanks.

Moving Objects?
I'm simulating a plane moving and when you hold down an arrow key it will move faster. I'm looking for a little better way to do it because it seems to get exponentially faster the way I'm doing it but I can't think of a better way of doing it.

Frame 1:

Code:
var speed = 1;
var count = 0;


Frame 2:

Code:
var myListener:Button = new Button();
var mySoundWave:MovieClip = new MovieClip();

if(plane._x>800)//Keep plane on screen
plane._x=0;
if(speed>40)
trace("SPEED OF SOUND");

plane._x+=speed;
plane._y+=plane._rotation/5;

count+=1;
if(count%4==0)//Don't display a soundwave everytime
{
showMovie("soundWave",plane._x,plane._y);
}

function showMovie(linkageId, xpos, ypos)
{
var linkageId :String;
var xpos:Number;
var ypos:Number;
mySoundWave = this.createEmptyMovieClip("mySoundWave", this.getNextHighestDepth());
mySoundWave._x = xpos;
mySoundWave._y = ypos;
mySoundWave.attachMovie(linkageId,e,this.getNextHighestDepth());
}

myListener.onKeyDown = function() //This is the relevant code for moving
{
if (Key.getCode() == Key.LEFT) {
speed -= .001;
} else if (Key.getCode() == Key.RIGHT) {
speed += .001;
} if (Key.getCode() == Key.UP) {
plane._rotation -= .001;
} else if (Key.getCode() == Key.DOWN) {
plane._rotation += .001;
}

};

Key.addListener(myListener);


Frame 3:

Code:
gotoAndPlay(2);


I made everything really small because I didn't want it to get out of control.

Moving Objects
Me & some friends are making a game. You are in a sliegh & have to dodge objects. But i can't make the objects move. This is the code i am using:


ActionScript Code:
// Random Tree Postion
var xpos = 0;
var numObjects = 15; // Edit to Change how many trees - number of snowballs
for (i=0; i<numObjects; i++) {
    var randomObject = attachMovie('tree', 'tree'+i, i);
    if (i<=numObjects) { // DEV: No Overlapping
        randomObject._x = xpos-240;
        xpos += 44;
    }
    randomObject._y = random(500);
}
// Random Snowball Postion
var numObjects1 = 6; // Edit for how many snowballs.
for (s=0; s<numObjects1; s++) {
    var randomObject = attachMovie('snowball', 'snowball'+s, s);
    if (s<=numObjects) { // No Overlapping
        randomObject._x = xpos-640;
        xpos += 66;
    }
    randomObject._y = random(500) + 700; // create snowball behind.
    // DEV: Move snowballs
    randomObject._y -= 3;
}

Moving Objects
Hello guys, my first post here

Here i am helping out a friend with a website. I'm Designing a website completely made of flash (customer request :/ ). There is a part at the bottom of the screen thats like a tab. I want to move the whole tab (and a wider box attached to it too) a little up everytime the mouse rolls over it.


Looking at various tutorials I've found one that seems to suit me. It basicly moves the movie clip (the whole thing at the bottom the tab + the bottom box is converted to a movie clip for this) in incriments. It needs a yTarget{instancedname} variable. For example if i give the movie clip an instance name of MC the variable would be yTargetMC and the number i associte it with is where the movie clip moves to.


So i can make a button that has :


on (rollOver) {
yTargetMC = 50;
}
on (rollOut) {
yTargetMC = 100;
}


It works as long as the movie clip and button are on the same "stage". I want the movie clip to move up on mouse over so i palce the button inside the movie clip but when i do this the yTargetMC is useless coz it wont change the variable in the main stage (i'm assuming this)thus wont work. Is there a way that i can make the button inside the movie clip assign the variable change to the main scene? Maybe a script code that makes the button work like it was NOT inside the movie?


I'm kinda lost here and i hope i managed to explain this properly. Any help would be welcome - i'm ok with rebuilding this too if there is a more easier and logical way too. As i said i'm learning and helping at the same time so hence i'm a newbie yet again


Thanks in advance,


Osman

Edit : here's the code for the movie itself (that is moved)

onClipEvent (enterFrame) {
yMC = getProperty(_root.MC, _y);
moveMC = _root.yTargetMC - yMC;
setProperty(_root.MC, _y, yMC + (moveMC/10));
}

Moving All Objects
This is a stupid question, I know but I neet help urgently. How can I move all elements in a time line? I have 50 key frames If I select all and move them with the mouse only the frame with the marker on it is moved.

What am I doing wrong

Tanks in advance

Copyright © 2005-08 www.BigResource.com, All rights reserved