IDE :: AutoMoveObject To (x,y) Coordinates Instead Of Randomly
May 29, 2009
I have this function that moves the cursor automatically to random points. I want to know how I can make them move to 4 specific points (x,y coordinates) instead.
I am assuming I need to create an array of the of some sort with the x,y points and tween them but have no idea how to go about this.
Code:
function autoMoveObject() {
if (!mouseControl) {
var moveObjectX:Tween = new Tween(cursor, "_x", Regular.easeOut, cursor._x,
[Code]....
View 1 Replies
Similar Posts:
Jul 31, 2004
problem with loading images randomly and putting them in the right _x and _y coordinates.I have a swf file with in the first frame a button with this code :
on (release) {
filename = ["image-01.jpg", "image-02.jpg", "image-03.jpg"];
path = "images/";
[code].....
View 1 Replies
Jul 31, 2004
I have a problem with loading images randomly and putting them in the right _x and _y coordinates. I have a swf file with in the first frame a button with this code :
on (release) {
filename = ["image-01.jpg", "image-02.jpg", "image-03.jpg"];
path = "images/";
i = filename.length;
[Code]....
the image gets loaded and placed correctly when played from the harddisk. the problem starts when i upload the swf to the internet, then the image won't be centered but the left upper point of the image is placed at x=640 and y=230
View 1 Replies
Nov 25, 2010
i can't seem to figure out this:
I have 3 coordinates on a stage.
Coordinate1 (x50;y50);
Coordinate2 (x150;y150);
Coordinate3 (x250;y250);
How to make a movieclip (or button) appear on one of theese coordinates randomly when loading flash?
Coordinates don't change but movieclip (or button) goes to one of theese positions upon flash movie starting.
View 6 Replies
Dec 19, 2011
I was trying to convert global coordinates to local coordinates of a UIComplenent in my flex project using below code using below code
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
uic is UIComponent in which I have subclass of Sprite for drawing something I have set the sprite's mouseEnabled and mouseChildren to false to not interrupt the mouse event. above code is within uic's mousemove event where I was tracing the gp and lp gp was giving correct value and suprisingly lp was giving negetive values. when I move the move to the top left corner of uic i expect lp to be 0,0 but it is giving the -width of of uic. I broke my head for hours and ended up finding an alternate by using offsets. Infact my original code was much simpler like this which was same issue
var lp:Point = new Point(e.localX,e.localY);
I am not sure what exactly is causing this problem. the workaround had lot of issues and it creating a mess in my rest of the algorithms.Just now I found even more interesting thing (which is actually weird). for some reason I went and create a new lp2
var lp2:Point = new Point(e.localX,e.localY);
now surprisingly it was giving correct values as expected and I went back and changed the code as
var gp:Point = new Point(e.stageX,e.stageY); //global point
var lp:Point = uic.globalToLocal(gp); //local point
var lp2:Point = new Point(e.localX,e.localY);
var lp2:Point = uic.globalToLocal(gp);
now it is expected to have all the lp, lp2 and lp3 variables to be same but weiredly lp two is giving wrong value and lp2 and lp3 were giving correct. I am suspecting using the variable lp has something to do. I am not sure about that but above proves it so right now I am using lp2.
View 1 Replies
May 21, 2007
I was reading the 'Isometric Transformations' tutorial by Danko Kozar and I have a few questions. I understand what all the code does, but not how it does it. First of all, how does the following code work:
transforms x,y,z coordinates into Flash x coordinate
xFla = function (x, y, z) {
// cartesian coordinates[code].....
I understand that it converts 3d coordinates to 2d coordinates, but I don't understand how. What numbers whould be punched into x, y, and z to acquire certain desired effects?Also, what's the difference between moveTo and lineTo:
red line
style(1, "0xFF0000", 100);
plot(0, 0, 0);
draw(200, 0, 0);
View 4 Replies
May 3, 2010
Im making a little app in flash using papervision I want to make a regular movieClip show up in the same place as a papervision object. The coordinates seem like perspective is affecting the number displayed.
View 2 Replies
Sep 24, 2007
Onmy stage I have a MC, and when I click it a random MC from the Library should appear and move around randomly.
I'm using this to make it move around randomly [URL]
how to make the random MCs appear from the library. And should I put the random moving script on each of my ten MC?
View 8 Replies
Jan 11, 2008
not sure if this is possible but i'd like to get the X,Y coordinates of a button I drag. here's my problem:
PHP Code:
public function backbuttonDown(e:MouseEvent)
{
[code].....
View 10 Replies
Jun 27, 2011
this is probably something thats solved verry easy, but I tried all kinds of google terms etc and I can't find a solution.On my stage, I have a symbol, in this symbol (button) the following code:
Code:
on(press)
{
[code].....
View 2 Replies
Feb 23, 2011
I have a movieclip inside another movieclip.[code]...
I can get mc_inside._x and mc_inside._y properties relative to the container movieclip, but how can I get the mc_inside._x and mc_inside._y relative to the _root (the stage)?
View 1 Replies
Nov 4, 2009
I am trying to change the cursor with coordinates.
I have attached the cursor to the mouse, which is a Red Circle
what I want to happen is when it gets beyond the half way point on the screen for it to turn blue.
I can do it as a rollover but I need to make it to it with if statements and coordinates.
Below is the code I have used to attache the cursor to the mouse
circle_mc.onEnterFrame = function(){
this._x = _xmouse;
this._y =_ymouse;
Mouse.hide();
};
View 6 Replies
Nov 24, 2009
I'm having a helluva time trying to figure out why I can't load a display list object, (multiple times) at different coordinates specified in my xml file.tremendous as I am not the most accomplished with AS3. Here's the code I'm working with...
for(var i:int = 0; i < xmlLen; i++){
addChild(myCapitol);
myCapitol.name = 'capitol'+ i;
[code]....
View 1 Replies
Dec 8, 2010
How can you get x and y coordinates of an instance? My instance is called "rock". This is what I have tried:
PHP Code:
onClipEvent(enterFrame){
trace(rock.x);
trace(rock.y);
}
but it does not work.Next, how can I make this instance go up by a certain angle?
View 3 Replies
Apr 18, 2011
I'd like to use the x and y mouse coordinates as variables in a program. I'm very new to Flash and ActionScript and I'm not even sure which classes I need to import or which listeners or handlers I need to use.
View 1 Replies
Oct 16, 2009
We have a client server architecture where a C++ server talks to Flash clients. I'm developing the server and would like to send through tcp an xy coord to simulate a button press where the receiving flash client would find the topmost visible object at that coord and send a mouse event to it such that we could simulate play without a human present. I'm told this is incredibly difficult, but it seems to me that there must be a way to do this. Am I off the mark? Or is there a mechanism in flash to iterate through all objects regardless of parent child relationships to find a visible button at an x, y coord and signal a press event?
View 2 Replies
Oct 25, 2009
I've been racking my brain for the last week, and Im trying to use a map to zoom into certain city locations on the map. I believe each city locatio needs to be its own mc on the map, but don't know if I need to zoom into the coordinates of that mc? Here's what I have so far which zooms in on the appropritea x/y coordinates. Does anyone have any advice as how to change this or some other way to zoom into certain locations on a a map?
[Code]....
View 1 Replies
May 5, 2011
This code below works, but I'd like to modify it so that if my dragged item passes over a region in the x coordinates. So if I pass the dragged item over the range of 600 - 700 then it would play the frame labelled "square", and when it passes out of that region, go back to play the frame labelled "circle". So realy I'm asking how can I modify the <=600 to instead 600 to 700, and else refer to circle.
if (me.x <=600){
me.gotoAndStop("Square")
} else if (me.x>= 700){
me.gotoAndStop("Circle")
}
View 5 Replies
Feb 4, 2012
How i can when someone click on button "Start position" to go on 0x 0y coordinates
View 8 Replies
Feb 24, 2010
I wanted to write a simple 3d image rotating around the y-axis as the Image carousel. I can place all the photo around the axis but I can't get the main image facing towards the screen. I mean the z-axis isn't pointing towards the screen. Instead, the z-axis is towards the top left corner. How do I make the z-axis pointing perpendicular to the screen?
View 1 Replies
Jul 21, 2010
I have a widget that looks like an equalizer, the scrubbing on the slider is working. When I relaunch the swf file everything resets.
What can I do to save the setting.
View 1 Replies
Jan 13, 2011
I'm trying to update a clients site and the original developer left almost no instructions.The code is all updated through XML.Here is a sample of the code
enter code here<FOLDER NAME="COMMERCIAL">
<GALLERY NAME="LOCANDA VERDE: New York">
<IMG HEIGHT="500" CAPTION="Some photo" WIDTH="393" SRC="locanda1.jpg" DX="60" DY="40"
[code].....
View 1 Replies
Jan 14, 2011
i build a contextmenu i want when user click any item then i get the x and y coordinate of the contextmenuitem............actully i want to dispaly a textbox infornt of contextmenuitem when user click on the item........ or any other solution that i will show inputtext control as submenuitem in contextmenuitem
View 2 Replies
Feb 2, 2011
I'm trying to move movieclip Ball along the borders of movieclip Ground. You would move the Ball with the arrow keys which would increase and decrease its x value, but the y value will always be equal to the top edge of the Ground movieclip.
To do this I need to find the y value of the points on the edges of movieclip Ground. How is this possible?This is what the Ground MovieClip would look like. It is an irregular shape. What I want is for any x point a y point at the top edge of this shape.
View 5 Replies
Sep 29, 2009
How to find uv coordinates while making custom primitive in papervision3D?
View 0 Replies
Jun 2, 2010
I have encountered really bad problem in one of our Flex projects. For some reason Flash can't get mouse coordinates properly. It returns something like (-107374182.4, -107374182.4) instead of good numbers. This happens when I'm using MOUSE_MOVE event in FF 3.6 on Mac OSX 10.6.3 with Flash Player 10. I have drag-n-drop in this projects, so with such ugly huge coords object goes far out of stage. Can't find solution in web, but there are some relative notes found...
For example, some info regarding 107374182.4 number can be found in internet.It seems 107374182.4 is something like NaN equivalent for some versions of Flash Player.Also I have found some notes regarding wrong mouse handling on Mac.The most interesting words there are: "on OSX it takes at least 1 frame to register the mouse's position". But it seems in my case it affects not only first frame after MOUSE_DOWN fired.Finally, there are movie on YouTube that demonstrates MOUSE_MOVE bug on FF/Mac.
I have tried:
- to get MouseEvent.stageX, MouseEvent.stageY (problem encountered);
- to get DisplayObject.root.mouseX, DisplayObject.root.mouseY (problem still appear, coordinates are bad);
- to use startDrag, stopDrag (it looks bugged too);
- to embed SWF into HTML with different wmode values.
View 0 Replies
Mar 28, 2011
if AS supports anything similar to hashes in perl (okay, it's been a long time since I've done any coding).If I want to get the x and y coordinates of an object I do it like this:
ActionScript Code:
thumbnails[0].getXY()[0]; // Get X
thumbnails[0].getXY()[1]; // Get Y
and I'd rather it look more like this:
ActionScript Code:
thumbnails[0].getXY(){"x"}; // Get X
thumbnails[0].getXY(){"y"}; // Get Y
View 3 Replies
Apr 16, 2011
I am using a hit test to allow a mc to only drop (on MOUSE_UP) in a specific area. I was wondering if there is a way to make it so that if you drop it in any area other than the one specified by the hit test, it returns back to its previous x and y coordinates? As of now I have it returning to a a specific x and y coordinate if it is not dropped on the hit test object but I want it to go back to the last spot it was at, not the same spot every time. I am assuming that you need to trace or capture the current or last x and y of the mc but I am not sure. This is the code that I am using right now for a reference...
Code:
if (magnetFour.hitTestObject(myWhite)) {
}
else {
[Code].....
As you can see in my code, this mc is returning to an x of 502 and a y of 428 if it does not hit the hit test object...I need it to not just go to the same x and y but go to the last x and y it was dropped at.
View 4 Replies
Oct 6, 2011
I have made a few posts now, and I'd like to especially Prid for not only answering them, but for giving me guidance on how to learn AS2. I am progressing very nicely, and have made a couple of simple games without any tutorials, but theres one thing I couldn't find. I have this character which can move, up and down, left and right. I also have an enemy trying to shoot at him. However, this enemy needs to know where the character is. I already have the shooting code (Prid), but it was for shooting in the direction of the mouse. What I need now is to replace the bit of code that finds the mouse coordinates with code that finds the coordinates of the player.
The shooting code is on the frame (doubt that is important to say, but still) and the instance AND name of the Character is, well, Character. So basically, I need a code to calculate coordinates of a movie clip that does not have a fixed position. Oh and one more thing, should I post simple stuff like this in the beginner section, because I've seen waaay more complicated stuff there than in the AS2 section.
View 9 Replies
Nov 25, 2003
I just have a problem when a point goes *behind* the camera: if point.z < 0. It's ok if there's an MC that just becomes invisible - but if I try to draw a line to this point with the drawingAPI, the point's screen x/y coordinates are weird. I can't figure out how to modify the scaleRatio to get correct values. Here's a code snippet:
var scaleRatio = focalLength/(focalLength + z);
screen_x = x * scaleRatio;
screen_y = y * scaleRatio;
View 2 Replies