_x and _y coordinate question

FLASH

    Next

  • 1. .fla ?
    hi, i am new to flash and i can't get my head around this. i have a simple snake game my friend made, he sent it to me in a .zip, but the actual game its self was saved as a .fla , and on MX 2004 whatever i try it wont let me open it! am i using the wrong version of flash or something? please reply or add me to messenger. [ XXXX@XXXXX.COM ] thanks.
  • 2. look now
    ok...i wasn't using the java code at all for a few days now....i left it in there just in case i had to go back but i wasn't calling any java functions. try a look now and VIEW SOURCE. you will see that i am only trying to pass the session variable and that i am doing so by using the OBJECT tag approach... <PARAM NAME=movie VALUE="card_editor_MASTER.swf?strSessionID=0234sessionidblablah"> the HTML code is now very very simple. it works on windows machines, it works on safari, it does NOT work on mac/ie. so very strange. as for the oscommerce contribution, i hadn't seen that! i have already gone through the trouble of modifying my oscommerce install to allow one to customize a product....it's a lot like the approach used by product attributes (they use attributes to let one specify a USB mouse or PS2 mouse....same product, different varieties). this also works on PC/ie and MAC/safari but not on MAC/IE (which just so happens to be my clients OS/browser choice). i will try a test.fla...there is a chance my flash project could be the problem, but i really think the session variable isn't getting in.
  • 3. Swirly graphic while function runs
    I'd like to make that neat little swirly image that comes up on the Exchange site appear next to my progress bar. How would I code such a thing in Actionscript? Is that swirly circle an image that comes with MX 2004? Basically, in my function I want to be able to make it appear and then disappear as it does. Thanks!
  • 4. looking for a good resource
    Can anyone lead me to a good resource on designing flash files with the components. I want to know what commands and such are available for actionscriptin? Thanks

_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 47 guest