_x and _y coordinate question

FLASH

    Next

  • 1. video encoding
    I recently started posting some videos to the web, and I am going from an NTSC DV AVI capture straight to an FLV. I notice that my final FLV is a little stretched/squished and think it's probably because of the changeover from non-square pixels in the DV format to square pixels in the FLV. How do I correct for this?
  • 2. Works off the Internet but not on it
    :confused; I wrote a flash file that is basically a menu, requiring minimal variable passing between swf files. On my development computer (not connected to the Internet) it works great. However, when I load the same files to my website, when I use the menu file it hangs up on the first frame in the sequence, rather than going to the frame that the variables say it should go to. It doesn't do this when not loaded onto the website. Any thoughts as to why? Thanks
  • 3. IE7, Vista & Flash Player 9
    :smile;Hello, I am new. I have been trying to install the Flash Player but I get an error msg that reads, "Network Error." I have Internet Explorer 7 and Windows Vista Home Premium. Does anyone know where I can download it properly? I also downloaded and ActiveX file for FP9 and a plug-in. Neither work. Can anyone help?
  • 4. Extracting Textfield Text from Display List
    I am attempting to extract the text in a textfield that is displayed with the container (see below) display list. The code snippet I am using is listed below. for (i = 0; i < container.numChildren; i++) { var temp:TextField = new TextField(); // temp = container.getChildAt(i); trace(container.getChildAt(i)); trace(temp.text); } When I execute this, the trace(container.getChildAt(i)) line displays <object TextField>. But, when I activate the comment line temp = container.getChildAt(i); I get an error about coerceing a static variable. Can anyone give me a clue how I can trace the text in the textfield container.getChildAt(i)?
  • 5. Loader Problem
    I am having a problem with the loader component in Flash MX. When I create an instance in my flash file, everything works as long as I view it in the preview mode of MX. But when I put it in a browser to view, the image is distorted, and none of the actions associated with the loader component work. What is the deal, does anyone know?

_x and _y coordinate question

Postby giyggugpupg » Mon, 06 Jun 2005 00:55:01 GMT

Hello:

 I have a movieclip that is navigated by buttons to various _x and _y 
coordinates. When the user clicks on "button 1" is takes them to a specified 
area, then when the user clicks "button2" is takes them to another area. 
However, the pathway is a straight line between the two. 

 I would like the "path" to negotiate a determined route, (such as a curved or 
"S" shaped route). Is it possible to put a series of _x and _y coordinates into 
the onClipEvent then the final _x and _y coordinate for a final destination, 
(Similar to waypoints in a GPS).

 If so, is there a simple way that "people that know what they are doing" 
calculate  _x and _y coordinates within a movieclip?

 Regards,

 Stephen


Re: _x and _y coordinate question

Postby the fleece » Mon, 06 Jun 2005 04:47:14 GMT

mmm sounds to me like what you need is a bit of maths - maybe a sine equation 
to descibe the sort of path you want.

 actually, i'm making the assumption that you are doing this throu 
actionscript, when you are possibly doing it allong the timeline...

 if so, you could use a motion path.


Re: _x and _y coordinate question

Postby giyggugpupg » Mon, 06 Jun 2005 05:18:57 GMT

Hello:

 Well, I cannot disagree that I could always use a math lesson, but apart from 
that I was hoping of an easier method within flash to pull from the properties 
panel the various _x _y coordinates.

 I am using actionscript but not to navigate a timeline, but to access "pages" 
within a movieclip. I am using the following:

 onClipEvent (load) {
 _x = -149.0;
 _y = -94.0;
 spd = 8;
 }
 onClipEvent (enterFrame) {
 _x += (endX-_x)/spd;
 _y += (endY-_y)/spd;


 _root.page1.onRelease = function() {
 endX = -149.0;
 endY = -94.0;
 };
 _root.page2.onRelease = function() {
 endX = -449.0;
 endY = -94.0;
 };
 _root.page3.onRelease = function() {
 endX = +151.0;
 endY = -94.0;
 };
 _root.page4.onRelease = function() {
 endX = -149.0;
 endY = +94.0;
 };
 _root.page5.onRelease = function() {
 endX = -149.0;
 endY = -294.0;
 };
 }

 I was just hoping instead of a straight path to have a different route. No 
necessarily the direct route.

 Regards,

 Stephen


Re: _x and _y coordinate question

Postby the fleece » Mon, 06 Jun 2005 05:26:10 GMT

no, maths is the only way.

and my mine aint good enough either, however there's loads of tutorials on that sort of thing.  Not that I know of any - not very helpful, sorry

Re: _x and _y coordinate question

Postby Der Zlmeister » Mon, 06 Jun 2005 21:01:26 GMT

let's say you want to move from (x0, y0) to (x1, y1) in 9 steps.
the following piece of code will move the movie clip mcObject
from the source to the destination as jStep goes from 0 to 9.

    // at beginning of script
    nSteps = 9;

    // event handler or loop
    var t = jStep / nSteps;
    mcObject._x = (1 - t) * x0 + t * x1;
    mcObject._y = (1 - t) * y0 + t * y1;

-----
that's for two points.  now if you have a series of way-points,
then you'd probably store the coordinates in arrays e.g. xCoords,
yCoords (for consistency, the arrays should include the start and
the end point).  let's have an index jWayPoint that goes from 0
to jLastPoint (= the number of intermediate points + 1).

at first you have
    jWayPoint = 1;
    nSteps = 9;
    x1 = xCoords[0];   y1 = yCoords[0];
    x2 = xCoords[1];   y2 = yCoords[1];

your onClipEvent handler would look something like this:-

    onClipEvent = function() {

       var t = jStep / nSteps;
       mcObject._x = (1 - t) * x0 + t * x1;
       mcObject._y = (1 - t) * y0 + t * y1;

       jStep++;
       if (jStep > nSteps) {
          jWayPoint++;
          if (jWayPoint > jLastPoint) {
            // destination reached.  disable the handler
          } else {
            // set new line segment
            jStep = 0;
            x1 = x2;
            y1 = y2;
            x2 = xCoords[jWayPoint];
            y2 = yCoords[jWayPoint];
          }
       }
    }








Similar Threads:

1.Finding _x and _y coordinates of a word within a string

Is this possible? I have a dynamic text within a TextField. I want the
user to be able to select a word within the text they've inputted and
for me to place a gap (a TextInput component) where this word is. I've
messed around with getTextExtent but that only allows me to find the
hieght or width of the entire text and not a specific word.

2.AlertBox Component _x and _y coordinates

Hi,

      In using the Alert Box component how do you control where the AlertBox is displayed?

Thanks for any help!

3.absolute or relative _x/_y coordinates

Hello friends,

allrite here it goes. 

I have three clips.

Lets call'em: clip0,clip1 and clip2

clip1 is INSIDE clip0

clip2 and clip0 are on the same level. How do allign clip2 to clip1?

So what I do need to find out I guess, is how I do retrieve the _x and _y coordinates of clip1 relative to the _root stage?

did this make sense? I sure hope so

thanks a lot, any help or pointers are wastly appreciated

V



4.display _x and _y

i've created a movieclip (ball) that bounces and a dynamic text fields to 
display the _x and _y position of my ball as it bounces. the thing is the 
position remains static as the balls bounces, how can i make them change in 
relation to the position of the ball.

5._x and _y wrong

hi all

 i have this in a movieclip called map 
 on (release) {
 	_root.map._x = 138.1;
 	_root.map._y = 80.4;
 }
  but when i press it it goes to about          ._x = 75.8    ._y = 26.1
 how can i stop it

6. attachMovie and _x, _y position in Flash Player5

7. flash _X and _y properties

8. buttons/movieclip on a path - how to get _x and _y



Return to FLASH

 

Who is online

Users browsing this forum: No registered users and 53 guest