ActionScript 2.0 :: One Object Following The Mouse AND A Path
Jul 5, 2005
I'm trying to design my very first flash website, to date I've been using a photoshop/imageready and HTML combo and I need something new. So, I bought Flash MX 2004, and thus my question regards AS 2.
My problem is, I want an object to follow a path (like a motion guide) but I want its X position to be determined by the mouses X position. This is to be this way so that no matter where your cursor is (it will be hidden) the object following the path and your mouses X position will be the same. I tried to just make a motion guide and then use the following AS but it did not work.
onClipEvent (enterFrame) {
myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
_root.yChange = Math.round(_root._ymouse-this._y);
[Code].....
That is just modified AS from a tutorial I read. It makes the object follow my mouses X position and rotate according to specific degrees (makes it more interesting). The problem is that I need the objects Y value to be a set value along a curved line. And I have no idea how to do this. I was reading something about the path follower class but thats way above my head.
View 9 Replies
Similar Posts:
Nov 11, 2010
I'm drawing an arrow as a <s:Path> and I need to get notified when the mouse is over it. How can I do that?
The arrow is an element of a Group container.
I tried registering for MOUSE_OVER events for both the container and the arrow and none seem to fire...
View 3 Replies
Jul 18, 2010
So I've created a script where a mc is clicked on and the player can draw a path using the mouse. I'm trying to figure out how I can get the mc to follow the path drawn out by the player's mouse and when the player clicks again, it erases all of the path.my code is below
Code:
import flash.display.Sprite;
import flash.events.MouseEvent;[code].....
View 14 Replies
Feb 15, 2010
I was wondering if it possible to write up some AS that will take line paths that you have drawn and convert them into a Path object? For example say you drew a jagged line from left to write, would there be a way to have AS convert that into a Path object.
View 11 Replies
Apr 15, 2011
I am currently trying to create an app using flash AIR.I would like to find some more information on how to make an object snap to another ojbect then follow its path, eg. a person object is already on the stage, then drag an arrow to the object which snaps to it, then on play button it follows the arrow path. all in pure actionscript, no guide layers.
View 1 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
Feb 1, 2011
Wondering if any of you have any experience with the title. I just want a dot or an object to follow the path drawn by my mouse at a predetermined length.
View 0 Replies
Jun 20, 2011
I have a file that has a thumbnail scroller(which is run with a xml file) and a slideshow that when loads has a bunch of images on the scroller and when clicked, opens bigger in the slide show.
what I want to be able to do, is when other buttons outside the scroller are clicked, it loads a new xml file, but I am not sure how to go about doing that.
I have attached my fla file and .as file so you can see what I am working with.
View 0 Replies
Jun 26, 2005
How do you record mouse path and speed like [URL]
View 7 Replies
Nov 10, 2007
im using MX 2004 although i do have Flash 9 atm if anyone has an example in that
Anyway, im trying to slow down and speed up an orbit of an mc relative to where the mouse position is. So basically i need some sort of radial "field" where when the mouse gets close to the outside of the orbit the movie clip stops and when it is farther away the movie clip speeds up.
[Code]...
View 1 Replies
May 30, 2010
found nice dynamic mouse traile which i'd like to use on my flash banner. I can get rid of mouse actions but how do make random sparkles move from left side of banner to the right side? Here is mouse trailer code:
//import bitmap class
import flash.display.BitmapData;
//Settings
[Code].....
View 4 Replies
Jun 27, 2006
how to do an object move towards the mouse when i move the mouse the towards the object and backwards when i move the move away, something liike the menu on [URL]
View 2 Replies
Oct 16, 2009
I want to drag an object on this path or random path .If you are not getting my point Please look on the attached image.or look to this link.
View 5 Replies
Jun 30, 2010
I'm trying to write a plug-in for Flash CS5 that will display the "instances path" for a selected object. I'm trying to work with JSFL.I manged to get all selected objects using fl.getDocumentDOM().selection. I iterate over the array I get and look at the objects. I am able to get each of the objects' name. What I need to do is construct the "path" to that object (e.g., scene.scene.instance4.myText). Can anyone think of a way to do that? Is there a way to get the object that contains a certain object?
View 5 Replies
Jan 27, 2011
I have a straight line that converges to a point which makes the line curve. I want an arrow to follow the converging line. Motion guides seem to only work with a defined non moving path. How can I get my arrow to follow the moving curving path?
View 2 Replies
Jan 14, 2007
I'd like to have some graphic object which is possible to drag along the VA path. I've tried something to do but no success. The path is a random up-down hills. Exactly like the Motion guide does it.
Maybe some solution: put some object on the motion guide, create some possition sniffer, apply position to the drag-object.... but there's the problem how to obtain the direction of the drag... even when I use Beziere curve, the right direction still persists...
View 3 Replies
Jul 6, 2009
I want to drag an object on this path or random path. If you are not getting my point Please look on the attached image. or look to this link. [URl]
View 1 Replies
Feb 20, 2010
I need to get the full path of an object, and I don't know how to do that at all... I tried searching forums and google, but all found was something about nativePath, and all I get from this is "undefined". To sum the whole thing up, I need to pick up an object from the main stage on MouseEvent, and put it elsewhere. Then, by another click on the object (in the new location), I want it to go back to where it was in the first place. I cannot take the absolute path of the object, as I will have several objects and need to put this in a function..
Here is my function, for the moment :
Code:
function inventaire(evt:MouseEvent){
var chemin=evt.currentTarget.nativePath;
trace(chemin);
[Code]....
The targeted object is inside a movieclip, which is inside another movie clip...
The aim is to remove the object from the "popup" and have it return in it's place.
View 11 Replies
Mar 22, 2011
Is it possible to draw motion guide/path for a mouse position based movement?
For example if I have path the is like letter H. I would need to write many clauses/conditions for the borders of the movement. It would be a LOT easier if there would be some solution that makes the object always to stay on the defined path when moving..
View 2 Replies
Dec 4, 2007
Is there any way to get the file path of an object that is selected through the browse() method in the FileReference class. I don't think it can be done with a FileReference object, but is there another class that allows this, or any possible way to do this using XML?
View 4 Replies
Mar 16, 2009
How to drag an object along a straight path using AS 3?
View 2 Replies
Dec 28, 2010
i want to drag and drop movieclip, but its restricted path should be circular instead of rectangle.
View 3 Replies
Sep 16, 2010
I need to drag a component along a programmatically drawn path composed by different kinds of graphic, like lines, curves, etc.
View 3 Replies
Sep 29, 2010
I have a movieclip moving on a path by means of a tween. At the starting point a (virtual) line on the movieclip is tangent to the path. Is there an easy way to automagically rotate the movieclip such that this line remains tangent to the path throughout the tween?
View 1 Replies
Jan 12, 2011
How to find out targetpath of a movieclip or a textfield.? i need to get full path of a movieclip like Object(root).moviclip1.movieclip2.textfield
View 4 Replies
Jan 13, 2011
get the target path of an object.So that i can give properties/methods to that object.Actually i need the target path when an event occurs.like on click/keyup/enterframe..and so on.
var curinstance:Object = ev.target.valueOf();
In the above code i get the instance name of the particular object i cant give properties and methods to it.
View 1 Replies
May 10, 2011
I have a Flash.exe projector that stores data in a Shared Object. Anything works fine if I launch it from my desktop. The Flash.exe will be recorded and used from a CD-rom. Will the path of the Shared Object change? Say, will it try to record itself on the cd?!
View 1 Replies
Sep 21, 2005
Is it possible to have a object path changed due to the value of a variable?
eg.?
Code:
ClipNumber = 10
_root.ClipMC.[ClipNumber].Stuff = "This is stuff"
What Im asking is, can a value in a path be equal to that of a variable?
View 4 Replies
Mar 11, 2008
lets say I have a variable like this:
Code:
var pathName = "section2";
Then I have an object called "book". "book" is the parent of other objects named:
section1, section2, section3 and section4.
I want to apply a gotoAndStop() to section2 inside the book object. But instead of typing it the normal way:
[Code].....
View 1 Replies
Jul 6, 2009
I want to drag an object on this path or random path .If you are not getting my point look on the attached image.
or look to this link. [URL]
View 5 Replies