A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: dynamic _x/_y + _xscale/_yscale movement

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    133

    dynamic _x/_y + _xscale/_yscale movement

    hi

    i want to control an mc using the cursor _x/_y pos so that:

    • the mc scrolls left/right and up/down
    • the mc also increases or decreases in size via _xscale/_yscale

    i have a script that does the first one but am unable to successfully get the second part working. as it is a downloaded script that i only understand partially it may make sense for me to start from scratch..

    any ideas how i should best proceed would be much appreciated, thanks.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    post the working code you already have.

    gparis

  3. #3
    Senior Member
    Join Date
    Sep 2000
    Posts
    133
    hi

    here is the slightly adapted code i'm working with. basically the mc currently scrolls seamlessly horizontally and moves vertically up + down only a small amount (deliberately). i'd like to add x+y scale to this but when i tried there was a clash with the way the mc is currently set up to repeat scroll.

    the code:

    onClipEvent (load) {

    nScreenWidth = 700;
    nMaxRate = 10;

    function moveLeft(nPixels) {
    this._x -= nPixels;
    if (this._x<-1400 ){
    this._x = 0;


    }
    }

    function moveRight(nPixels) {
    this._x += nPixels;
    if (this._x>0) {
    this._x = -1400;
    }
    }

    nScreenHeight = 500;

    function moveDown(nPixels) {
    this._y -= nPixels;
    if (this._y<-160) {
    this._y = -160;
    }
    }
    function moveUp(nPixels) {
    this._y += nPixels;
    if (this._y>=40) {
    this._y = 40;
    }
    }
    }

    onClipEvent (enterFrame) {
    if (_root._ymouse>=500 || _root._ymouse<=0) {
    nMaxRate == 0;
    } else {

    if (_root._xmouse<nScreenWidth/2 && _root._xmouse>0) {
    moveRight(nMaxRate-_root._xmouse*nMaxRate/(nScreenWidth/2));
    } else {
    if (_root._xmouse>nScreenWidth/2 && _root._xmouse<nScreenWidth) {
    moveLeft(_root._xmouse*nMaxRate/(nScreenWidth/2)-nMaxRate);

    }
    }
    }
    }
    onClipEvent (enterFrame) {
    if (_root._ymouse<nScreenHeight/2 && _root._ymouse>0) {
    moveUp(nMaxRate-_root._ymouse*nMaxRate/(nScreenHeight/2));
    } else {
    if (_root._ymouse>nScreenHeight/2 && _root._ymouse<nScreenHeight) {
    moveDown(_root._ymouse*nMaxRate/(nScreenHeight/2)-nMaxRate);
    updateAfterEvent();
    }
    }

    }

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