A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: _x center and _y

  1. #1
    Senior Member interesting's Avatar
    Join Date
    Nov 2002
    Location
    Sometimes in Estonia, sometimes in Sweden
    Posts
    196

    _x center and _y

    How can I make a movie clip center into the middle of my movie?
    Instead of the cordinates being in 0 and !=0 at the top left?
    I would like this (script) to aplly, when my move center is 0, in the middle of the screen.
    And does this calculate the things I wish as right asd I planned=? The Sin O and hyp-lenght?

    onClipEvent(enterFrame) {
    opps=(_root._xmouse * _root._xmouse);
    sins=(_root._ymouse * _root._ymouse);
    Uhyp=opps+sins;
    Chyp=Math.sqrt(Uhyp);
    _root.output=Chyp;
    sinO=opps / Chyp;
    _root.outputSin=sinO;
    }
    The situation is different now!

  2. #2
    pablo cruisin' hanratty21's Avatar
    Join Date
    Mar 2002
    Location
    on the lam
    Posts
    2,275
    Ummmm...not sure why you need these trig functions in here. The MC should have width and height values in some sort of rectangle format, even if it is a pic of an ellipse.

    code:

    onClipEvent (enterFrame) {
    totalwidth = 550;
    totalheight = 400;
    this._x = (totalwidth - this._width)/2;
    this._y = (totalheight - this._height)/2;
    }



    totalwidth and totalheight would be the dimensions of the stage.

    See attached.

    RH
    Attached Files Attached Files
    "Why does it hurt when I pee?" -- F. Zappa |

  3. #3
    Senior Member interesting's Avatar
    Join Date
    Nov 2002
    Location
    Sometimes in Estonia, sometimes in Sweden
    Posts
    196
    The trig is for fun and primary, the centering weas actualyl my secondary attention : ) But great thanks anyways!
    The situation is different now!

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