A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Clip _xscale relative to _xmouse

  1. #1
    I have about 10 images...and I want the viewer to be able to see them all in the same box. So I have them all laid out...and I want each one's _xscale to get bigger the closer the _xmouse gets to it and smaller the further the _xmouse gets away from it.
    Theoretically, when the users mouse is to the far right...the image to the far right will be at regular size and the image to the furthest left will be the skinniest. And vice versa when the users mouse is to the far left.

    I've been trying everything...

    onClipEvent (enterFrame) {
    _xscale = ((xmouse-300) * /-+stuff?? )
    }

    any thoughts??

    thanks,
    morgan

  2. #2
    deva_station
    Guest
    lets say you wantto scale up/down an mc when the mouse is moved:
    Code:
    onClipEvent(enterframe{
    dx=_root._xmouse-this._x;
    if(dx<100){
    this._xscale=dx;
    }if(dx<0&&dx>-100){
    this._xscale=200-dx;
    }
    }
    not too sure about the code, may have bugs in it. but this is the sort of angle i'd look at it from to sort this problem.

  3. #3

    works except close to x=0 edge

    that code works great...except the when the mouse is over to the far right...they all stay the same size...and when the mouse is to the far left...all images get huge.
    I'm trying to showcase one image at a time...so when one is big I want the others to be smaller relative to where the mouse is. Any thoughts?

    thanks,
    morgan

  4. #4
    deva_station
    Guest
    Code:
    onClipEvent(enterframe{
    dx=_root._xmouse-this._x;
    if(dx<100){
    this._xscale=dx;
    }if(dx<0&&dx>-100){
    this._xscale=0-dx;
    }
    }
    how about that?

  5. #5

    almost

    so i guess if you just created a movie clip out of a rectangle or something and threw that code on there...you could see it doesn't work...I think this is a bit trickier that imagined. That code shrinks the MC when the mouse is directly over it...keeps it normal size at large x's and scales it huge on small x's.

    I keep playing with different formulas...nothing is working!

    any more thoughts???
    morgan

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