A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: have a moving ball on screen... want coordinates in text boxes

  1. #1

    have a moving ball on screen... want coordinates in text boxes

    first off i am using flash mx 2004

    i am trying to get a ball to move around on the screen cooresponding to pressing the appropriate arrow keys... i got that to work

    i also want the x/y coordinates of the circle to always be displayed in text boxes... i keep getting an "undefined" in the text box instead of the coordinate...

    i created the circle... converted it to a movie clicp called "circle"

    i then clicked on the circle and put the code to move it if arrow keys are pressed
    PHP Code:
    onClipEvent(enterFrame){ blah blah blah (it works just find) } 
    then i created a new layer called actions... i threw 4 text boxes on the screen... 2 of them are just regular static fields that say Xcoord: and Ycoord: .... the other two are dynamic text boxes with varx and vary

    i went to the actions for that layer and typed
    PHP Code:
    varx=_root.circle._x;  vary=_root.circle._y
    i thought that would work but as i said it just displays "undefined" in the boxes

    it must be a simple problem... and i hope i am posting correctly... thanks!
    I use flash mx 2004 pro

  2. #2
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001

    inside the onClipEvent(enterFrame) attached to the movie clip you could add the following,


    _parent.varx = this._x;
    _parent.vary = this._y;

  3. #3
    thanks works great
    I use flash mx 2004 pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center