3D Co-ordinates Puzzle
HI Everyone back again... this seemed to be unanswered last week, so just in the hope of getting an answer this time ;o)
i have a 3d problem thats had me stumped for months and i really need to get this bit sorted out so any help would be really appreciated,,i have tried every tutorial i can find but none seem to be as straightforward as i need anyway
i have some points
camerapositionX camerapositionY camerapositionZ
and
camerafocusX camerafocusY camerafocusZ
(general x,y,z coordiantes to a normal flash movie, im trying to use the camera focus part as the perspective point so i can move it around
now i have a layer with x,y,z values eg:
clipX clipY clipZ
so in essence im looking for something to stick in a call or function type thing where the inputs would be
inputclipX inputclipY inputclipZ
and outputs would be outputX outputY
to then 'fake' the 3d coordinates relative to the camera coordinates.. i hope that makes sense ? many thanks again Shane
FlashKit > Flash Help > Flash ActionScript
Posted on: 07-15-2002, 06:52 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Co-ordinates
can someone please tell me why the co ordinates wont work? the replacement object just shows up in the top corner at (0,0) (i think) any ideas whats wrong?
on (press) {
startDrag ("");
}
on (release) {
stopDrag ();
_root.depthvar++
_root.attachMovie( "leafmoexp", "leafmoexp"+ _root.depthvar, _root.depthvar );
_root[["leafmoexp"+ _root.depthvar]._x ==35.9];
_root[["leafmoexp"+ _root.depthvar]._y ==94.6];
}
_x / _y Co-ordinates
Hi...
I'm using attachMovie method to place movies
on the stage. But because I can't see them until I
test my movie, I am placing a box where I want my
movie clip to appear, and taking the x/y co-ordinates
from the property inspector.
However, using these co-ords. in the attachMovie params.
_x and _y , They don't line up, and I have to poke and
hope until I get it right.
I have now found the co-ords for the movie I am working
on at this time. But even using these, sometimes a clip
appears on the stage very large and not starting at
those co-ords.
I'm making the clips by cutting and pasting frames
into a new movie symbol. but not sure at what stage I
should be sizing them. ?
Any comments/advice would be greatly appreaciated.
X,y Co-ordinates
My .swf loads no problem, but I need to place it at a specific location in the mc it loads into.
This is my current code, grateful for any x and y code tips:
on (release) {
loadMovie("video.swf", "_root.mainMovie.r&JVideo");
}
Xy Co-ordinates
Is there any logical way of finding the xy co-ordinates in Flash 5, besides guessing?
Thanks, Plog.
Co-ordinates
hi guys,
I was wondering if anyone knew what the maximum _x and _y co-ordinates are in flash.
eChimp!!
X And Y Co-ordinates
ok just experementing again i was wondering if i could get a dynamic txt box to show the x and y co-ordinates of where the mouse is at the time.
code:
_root.boo.text = _xmouse;
this works but it doesnt update so where ever the mouse is when the move first loads thats what number comes up, is there a way for it to keep changing?
Co-ordinates
hello,
I am trying to, when the user presses control to move this movie clip to a certain location.
I tried this code and I don't know why it isn't working.(this code is in the movie clip to be moved to a co-ordinate)
onClipEvent(load){
if (Key.isDown(17)){
_x = _root.player._x;
_y = _root.player._y;
}
}
Thankyou Very much to anybody who helps!
Set X & Y Co-Ordinates
Hi
I need to reset the positions of movieclips in each frame. It is a drag and drop game and after each stage I need to have the movieclips go back to their original places.
I have been unable to figure out or find how to set the x and y co-ordinates at the beginning of each frame.
Any help is much appreciated
David
LoadMovie To Co-ordinates
Anyone know if there is / or how to load a movie into a specific X and Y co-ordinate. I know how to use the loadMovie action but could do with being able to load into a particular place. Just wondered whether this could be done.
Thanx in advance
g2
Finding Co-ordinates
Hello all,
I'm trying to make a trail of smoke clouds clips come out the back of a rocketship clip that follows the mouse around (the rocket rotates to point towards the mouse cursor and it has inertia etc.).
When I duplicate a smoke clip I want to set its x & y property relative to the back of my rocket clip, whichever way its pointing or wherever it is on the screen.
I've tried creating a small clip inside my rocket clip, at the back, and referencing the _x and _y of this clip when setting the duplicated cloud clip's properties. But it doesn't work!
Does anyone know how I can find the absolute coordinates of this clip inside the rocket clip or is there a different way I should be doing this. Hope this all makes sense, I'm really stuck and would appreciate any suggestions.
dgates
Getting Line Co-ordinates
Hi all,
Lets say i have a simple line drawing on frame one, how do i get the line co-ordinates of this drawing.
I want to get this info so i can pass it as a variable to PHP and do some stuff with it, namely using ming and GD then saving it as jpeg.
I know how to do all that, just not sure how to get the line co-ords via actionscript.
Cheers,
Suzy
Stage Co-ordinates
Is there any way of changing the positioning to the stage X and Y co-ordinates using AS?
Getting Global Co-ordinates For MC
Hi,
I need help to get Global coordinates of a MC to align it.
Suppose I have this structure:
Main MC1//
MC 1
MC 2
Main MC2//
MC 1
MC 2
I have problem to align MC 1 in Main MC1 and Main MC2, .
Getting The Distance Between Two Co-ordinates
I have two co-ordinates right, an x and y position and then I have another one.
I'm drawing a line between the two and I want to know how long that line is,
I can get the angle between the two eg.
Code:
angle = Math.atan2(yPos2-yPos1,xPos2-xPos1)*180/Math.PI;
but how do I get the length between the two?
Can anyone help?
Hit Test By Co-ordinates?
Hi,
There is probably a very obvious answer to this that unfortunately escapes me at the moment.
I need to perform a hit test between a movie clip and an area of the stage. For reasons that don't really matter I can't use another movieclip. Is it possible to define a hit area by co-ordinates and width and height in actionscript?
Thanks.
Dictionary Of Co-ordinates? Or What?
I'm planning to implement a a tiling background of loaded bitmaps.
Because I can't hold the whole map in memory at once, I figure when a bitmap is off-screen, it should be available for garbage collection. But if it comes back on screen and hasn't been collected, I want to be able to put it back in the display list without needing to reload it.
But I'm new to AS3, and don't fully understand this weak reference thing. I'll want to be able to access the bitmaps according to an X and Y index, so I initially thought of using an array of arrays to store them. But arrays don't allow weak references.
I can use a dictionary with weak references, but in that case I don't see how I can reference an object based on its X and Y co-ordinates so I can see if it still exists.
A Button Using Co-ordinates?
Hi,
I'm stuck
Imagine a menu system where a button is draggable, as you drag it around it doesn't do anything until it it reaches a specific co-ordinate. Then when it crosses it, it loads an external movie.
O.k
There are rules though, the button needs to be able to have more than one set of co-ordinates, which are not single points but stretch across the movie (horizontal and vertical) , this is so it can load more than one external movie. Its basically a navigation.
here's a pic to help you to visualise : -
idea
Any ideas on how I can achieve this?
thanks pixelmisfit
Complex Co-ordinates
Hi there
I'm new to flash but have a complex problem to solve. Have been given the task in work to work out how to plot lines from a given set of data. Basically it would be a Cardiotocogram being played out on the flash document.
I know this can be done from what I have researched so far but how is a different matter!
Can anyone please help or direct me to some tutorial in complex APi Drawing etc
Thanks Steph
A Button Using Co-ordinates?
Hi,
I'm stuck
Imagine a menu system where a button is draggable, as you drag it around it doesn't do anything until it it reaches a specific co-ordinate. Then when it crosses it, it loads an external movie.
O.k
There are rules though, the button needs to be able to have more than one set of co-ordinates, which are not single points but stretch across the movie (horizontal and vertical) , this is so it can load more than one external movie. Its basically a navigation.
here's a pic to help you to visualise : -
idea
Any ideas on how I can achieve this?
thanks pixelmisfit
Drag Co-ordinates
Hi there
I've made a horizontally scrolling menu. When you click on the buttons, MCs load into an empty MC. There are other buttons inside those MC. I would like to define a mouse sensitive area for the menu, so that when you interact with the other MCs, the menu isn't rolling around up above: it's distracting. You can see what I mean here http://www.terravitae.com/flash/casestudy_main2.html Is there any way to deal with this besides separating it from the main body?
Thanks in advance for any suggestions.
ogm
Problem With Co-ordinates
Hi !,
This is a situation in my application.
There are two movie clips A and B and B has two movie clips inside C and D. B ismoving(not static). A is static. I have to drag A on to B (so that it exactly fits at the center of C) but how can I do it? how can I map the co-ordinates of C to that of A? (coz, I can't use the co-ordinates of C, they are different from A's co-ordinates).
Please help !!
thanks,
rap
LoadMovie _x _y Co-ordinates
Hi everyone,
I have an empty movieclip on stage - abs_loader_mc - and I want to load some jpegs dynamically into it.
I need to center it on the stage by inserting the code: Code:
Thumb1_mc.onRelease = function() {
abs_loader_mc.loadMovie("path");
abs_loader_mc._x = (Stage.width/2)-(abs_loader_mc._width/w); // this should find the _x center of the loaded jpg
}
The problem is that it's centering the small circle (empty movie clip) in the center and not the actual image. Shouldn't the _width be that of the image?
If I click once on the thumbnail the image loads where the empty_mc is on Stage (before centering) then if I click again it sort of "refreshes" and snap to center position where I want it.
I can do this with an onEnterFrame or setInterval but they are CPU intensive, right? Besides I can get to delete on EnterFrame or clearInterval properly - I'm not really sure where to put either statement so on tracing I know that either they delete before it executes or they don't delete at all.
Any help would be greatly appreciated!
Thanks!
Changing Starting Co-ordinates
I have downloaded an image scroller from the fla. section however the scripting is based on the starting co-ordinates been 0.0, 0.0. I want the starting co-ordinates to be 25.0, 25.0 the problem is I am not to sure where to make the amendments. Any help would be greatly received as it's driving me crazy.
// variable for the image instance path (symbol: reef_graphic, instance: img)
varimg = _root.img;
// variable for the background instance path (symbol: background, instance: bgd)
varbgd = _root.bgd;
// speed of the mouse scroll (between 0 and 1)
v = 0.1;
// mouse position
mousex = varbgd._xmouse;
mousey = varbgd._ymouse;
// image position
imgx = getProperty(varimg, _x);
imgy = getProperty(varimg, _y);
// distance fom the center to the left, right, top and bottom side
left = getProperty(varimg, _width)/2;
right = (getProperty(varimg, _width)/(-2))+(getProperty(varbgd, _width));
top = getProperty(varimg, _height)/2;
bottom = (getProperty(varimg, _height)/(-2))+(getProperty(varbgd, _height));
// scrolling of the image
setProperty (varimg, _x, (imgx+(mousex*v)));
setProperty (varimg, _y, (imgy+(mousey*v)));
// stop the image on the horizontal side
// left
if (getProperty(varimg, _x)>=left) {
if (mousex>0) {
mousex = 0;
setProperty (varimg, _x, left);
} else if (mousex<0) {
mousex = varbgd._xmouse;
setProperty (varimg, _x, (imgx+(mousex*v)));
}
}
// right
if (getProperty(varimg, _x)<=right) {
if (mousex<0) {
mousex = 0;
setProperty (varimg, _x, right);
} else if (mousex>0) {
mousex = varbgd._xmouse;
setProperty (varimg, _x, (imgx+(mousex*v)));
}
}
// stop the image on the vertical side
// top
if (getProperty(varimg, _y)>=top) {
if (mousey>0) {
mousey = 0;
setProperty (varimg, _y, top);
} else if (mousey<0) {
mousey = varbgd._ymouse;
setProperty (varimg, _y, (imgy+(mousey*v)));
}
}
// bottom
if (getProperty(varimg, _y)<=bottom) {
if (mousey<0) {
mousey = 0;
setProperty (varimg, _y, bottom);
} else if (mousey>0) {
mousey = varbgd._ymouse;
setProperty (varimg, _y, (imgy+(mousey*v)));
}
}
Drawing A Line From One X & Y Co-ordinates To Other X & Y ...
Hi
Here's my Question ..
Is it possible to draw a line from one x & y co-ordinates to an
another x & y In Flash 5 ..?
I need to do it for more than 3 to 10 points ( x and y's)
If yes how do I do it ? I need the code as my very poor at AS..
Can anybody help me .....
kEep It FlAsHiNg..
FlashPRASHI
Finding Co-ordinates Problem
Hello all,
I'm trying to make a trail of smoke clouds clips come out the back of a rocketship clip that follows the mouse around (the rocket rotates to point towards the mouse cursor and it has inertia etc.).
When I duplicate a smoke clip I want to set its x & y property relative to the back of my rocket clip, whichever way its pointing or wherever it is on the screen.
I've tried creating a small clip inside my rocket clip, at the back, and referencing the _x and _y of this clip when setting the duplicated cloud clip's properties. But it doesn't work!
Does anyone know how I can find the absolute coordinates of this clip inside the rocket clip or is there a different way I should be doing this. Hope this all makes sense, I'm really stuck and would appreciate any suggestions.
dgates
Navagation With A Zoom And X And Y Co Ordinates
Hi I'm wondering if anyone knows of a toutorial or example of how to use
a navagation like this one used on:
http://www.rasikarestaurant.com/
I love the zoom out and in when the page is reached....
Thanks very much, M
[F8] Stage Co-Ordinates On Import
I am trying to import an animated sequence of frames onto the stage of a flash project. However, when I import them, it places them in the center of the stage, and I want them to be at a specific location (X,Y). It is a hassle to go through and manually change the co-ordinates of each picture from the center to the new location. So, is there any way to set an import to stage co-ordinate of (X,Y)? Failing that, is there any other, faster, method of changing the co-ordinates of all of the pictures in the sequence?
Edit: Nevermind, found the answer in another post on the forum. Thanks!
b1177
[CS3] Stop Scrolling At Certain Mc Co-ordinates
Hi there,
I am using the script below to allow a map (map_mc) to scroll horizontally and vertically behind a mask layer when the user hovers with mouse in the left, right, top and bottom 100px sections of the revealed map area (ie mask area):
_root.onEnterFrame=function(){
if(_root._xmouse<=304 and _root._xmouse>=204){
map_mc._x+=3;
}else if(_root._xmouse<=920 and _root._xmouse>=820){
map_mc._x-=3;
}
if(_root._ymouse<=278 and _root._ymouse>=178){
map_mc._y+=3;
}else if(_root._ymouse<=610 and _root._ymouse>=510){
map_mc._y-=3;
}
}
This works well but I want the map to stop scrolling when the edges are reached. The co-ordinates of this limit are:
map_mc._x>=396
map_mc._x<=728
map_mc._y>=266
map_mc._y<=521
How do I declare this? I'm sure it's something obvious and simple, but I've tried several ways and am shooting in the dark - nothing works.
Please help!
Thanks
TextField Text Co-ordinates
Hi there,
Is is possible to return the x and y positions of a specific bit of text in a textfield?
Cheers
Niall
LocalToGlobal Doubles Co-ordinates
Hi there,
I've got a clip on the stage at (100, 100) and I execute the following code:
Code:
var pt1:Point = new Point(circle1.x, circle1.y);
trace(pt1);
pt1 = circle1.localToGlobal(pt1);
trace(pt1);
The output is...
(x=100, y=100)
(x=200, y=200)
Given that circle1 is on the stage, shouldn't localToGlobal leave the co-ordinates unchanged? I think the result of its call is wrong!
Cheers, CN.
Small Co-ordinates Question
hey there
ok here it is:
when i create a movieclip in design time & give it (4 example)
x = 20 & y = 30 then in runtime duplicate a movie & give it same
co-ordinates (x = 20 & y = 30) the 2 movieclips don't fit over each other but they R shifted a bit so i need 2 change my co-ordinates a bit (say mk it x = 20 + 5 & y = 30 + 10) to mk 'em overlap each other.
WHY ???????
thx
Can I Draw Lines Between 2 Co-ordinates?
Hi there im trying to create an interactive map that draws a line between different co-ordinates (that represent places of interest) and effectively creates a simple route between the destinations.
Does anyone have any clue how i could do this?
cheers
lee
Co-ordinates Of Movieclips On Main Timeline
I have two movie clips, one called 'panel', the other 'box'. Both have registration points set to top left 0,0. I put one instance of each on the main timeline, their registration points roughly on the same location, with 'box', which is smaller, on top of 'panel'. Since 'box' will be draggable, I wanted to find a way to check if 'box' is inside the boundary of 'panel'.
I used some text boxes on the main timeline to check their co-ordinates, and put in actions such as:
boxTY = _root.box.boxshell._y;
panelTY = _root.panel._y;
where boxTY and panelTY are text boxes designed to show the top y position of box and panel, and boxshell is the background in 'box'.
I thought their value would be similar since I put them on near the same location. But they differ by nearly 200. This seems so illogical, but there must be an explanation. Can anyone tell me how to get the comparable co-ordinates of the two movie clips on the main timeline, so that I can check their position relative to each other? is this possible?
Laser Beam To Mouse Co-ordinates
I have attempted to make a movieclip scale in the y axis using _yscale but I can't seem to make it scale to the exact mouse co-ordinates.
Its within a rotating movie clip (controlled by the position of the mouse) and that works fine.
Here's the code I'm using at the moment. I know the math is wrong, but I can't really figure out where:
Code:
onClipEvent(enterFrame){
var disty = this._y - this._ymouse
var dist = Math.sqrt(disty*disty)
this._xscale = 100 + dist;
}
Any ideas would be greatly appreciated.
Stage V Screen Dimensions (and Co-ordinates)
I am having a real headache trying to find information about stage v screen sizes. Creating .fla files, my default stage size is 55x400 pixels. This stage sits in the middle of my screen surrounded by workspace. Viewed as a .swf, the movie fills the screen. Moving objects will happily move around over the entire screen. Fixed objects are positioned within the 550x400 pixel limits.
I tried resizing the stage at 1100x800 pixels (four times the default?). The stage is larger, but I can't see what I'm doing!
Suggestions on how can I utilise the whole screen?
I would also like to be able to place objects using coordinates. Is there any way I can do this outside the default stage size?
I have searched through a number of manuals but have found no references to help with this. This may be because it's so fundamental that I'm supposed to know it - unfortunately, I don't!
Help gratefully received.
Moving Loaded MC (ie, JPEG) To New Co-ordinates
Hi All,
I have made a flash movie as seen at http://www.coffeemamma.com.au and would
like to change the following:
I'd like to generate three random numbers from 1 to 5 inclusive but I want
to ensure that each number is different - e.g. 2, 4, 1 (not 2, 4, 2). I know
how to generate ONE random number, but I'm stuck on comparing them to see
whether they are the same (and if they are, then generate new numbers until
they are unique).
With the three numbers I would like to load images based on those numbers -
e.g. '_image_2.jpg' then '_image_4.jpg' then '_image_1.jpg'. This part is
fine IF I can generate the numbers.
I'd also like to have the images come to the front when they are hovered
over with the mouse and then to go 'back' to their original position when
the mouse moves away. This I'm completely stuck on.
I'd also like to be able to put the newly loaded images into certain
positions (as per the example) rather than only loaded to (0,0) coordinates.
I also want to be able to have the images masked as they come in (as per the
example) in order to avoid white corners on the top images.
I also have a page as per http://www.wasabi.org.au/wodonga.shtml which has
some of the functions I want to use, but I can't seem to get some of the
functions working in my new movie...
Many thanks,
Bruce
Copying Location Co-ordinates Of One Instance To Another
Hi guys
Is it possible to copy the location co-ordinates of one instance on the stage and give those properties to another instance also on the same stage? - Without having to type in the co-ordinates?
I'm thinking of something like a copy and paste function nice and quick without having to find out the co-ordinates, write them down, click on the second instance and type them in by hand...
If anyone knows if such a thing is possible do let me know!
cheers
Positioning Objects Using Co-ordinates Or Alternative
Pls can anyone help me with this minor problem. I'm trying to place a movie clip in a fullscreen website i'v created such that the movie clip would always be at the top of the user's screen even when resized. It would always be at the extreme top no matter what. Help would be really appreciated. Thanks
Modifying Flv Framerate With Mouse Co-ordinates
Hi,
Picture this: A movieClip containing a looping (embedded) flv, the frame rate of which is effected by the mouse's Y co-ordinates. So the closer the mouse gets to the mc containing the flv, the faster it plays.
I've tried a few ideas and I can't get it to work. The closest I've got is setting an interval which fires a function with a gotoAndPlay(nextFrame) in it. I've then been clearing the interval onMouseMove and setting off a new interval with a different speed of repetition based on the new _ymouse. This works in a way, but the movie halts during mouse movement and only begins playing at a new speed when the mouse stops. I want the reaction to be constant, so the flv is never stopped.
Does anyone have any idea how I can do this?
Thanks
ActionScript Drawing - Lineto - Root Co-ordinates ?
Hi Guys
I'm drawing lines in actionscript within a movieclip.
How do i specify _root timeline co-ordinates instead of co-ordinates relative to the movieclip?
Ie, lineto( 0,0) currently is the centre point of my movieclip, and not 0,0 on the root timeline....
any suggestions?
Cheers
How To Get X And Y Co-ordinates After Scalling A Movie Clip+ Problem
Hello,
I am working on a flash game in which i want to focus the light on some objects. For that I increased the xscale and yscale of the rope. When i rotate the rope I want to increase the xscale and yscale up to the stage.(according to x position ). I tried graphics equation to get the x' and y' after scaling. But it gives wrong values for co-ordinates.
I used the following equations to find new positions of x and y (x' and y') after scaling.
x' = ( x * sx) + (xf *(1-sx));
y' = ( y * sy )+ (yf *(1-sy));
so if anybody have any idea about how to solve this problem then pls reply soon.
Thanks in Advance.
Position Elements With Stage Co-ordinates When Inside A MC
Hi... I am trying to dynamically set position on certain movie clips, which is normally fine.
However is it possible to set the position relative to the stage rather than the movie clip its in? So set the x + y co-ordinates relative to the stage?
Thanks for any help in advance.
Scott
[CS3] Scale A Beam To Mouse Co-ordinates/point?
I have attempted to make a movieclip scale in the y axis using _yscale but I can't seem to make it scale to the exact mouse co-ordinates.
Its within a rotating movie clip (controlled by the position of the mouse) and that works fine.
Here's the code I'm using at the moment. I know the math is wrong, but I can't really figure out where:
Code:
onClipEvent(enterFrame){
var disty = this._y - this._ymouse
var dist = Math.sqrt(disty*disty)
this._xscale = 100 + dist;
}
Any ideas would be greatly appreciated.
Maths: Find Co-ordinates Of 2 Oclock On A Circle.
Hi Guys,
I'm getting a headache trying to remember my high school geometry/trig to no avail, so thought id see if someone here can help
PROBLEM:
I need to be able to find the co-ordinates of a point on a circle's circumference, given the degree or angle.
For example, to find 2 oclock's co-ordinates i would use 60 degrees in a math function (along with the circles center co-ords and radius), to return the co-ordinates of 2 oclock.
Does anyone out there know the math to solve this?
Thanks a million in advance.
Lars
AS2 Scale A Beam To Mouse Co-ordinates/point?
I have attempted to make a movieclip scale in the y axis using _yscale but I can't seem to make it scale to the exact mouse co-ordinates.
Its within a rotating movie clip (controlled by the position of the mouse) and that works fine.
Here's the code I'm using at the moment. I know the math is wrong, but I can't really figure out where:
Code:
onClipEvent(enterFrame){
var disty = this._y - this._ymouse
var dist = Math.sqrt(disty*disty)
this._xscale = 100 + dist;
}
Any ideas would be greatly appreciated.
Maths: Find Co-ordinates Of 2 Oclock On A Circle.
Hi Guys,
I'm getting a headache trying to remember my high school geometry/trig to no avail, so thought id see if someone here can help
PROBLEM:
I need to be able to find the co-ordinates of a point on a circle's circumference, given the degree or angle.
For example, to find 2 oclock's co-ordinates i would use 60 degrees in a math function (along with the circles center co-ords and radius), to return the co-ordinates of 2 oclock.
Does anyone out there know the math to solve this?
Thanks a million in advance.
Lars
|