dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Question about elastic/easing movements

  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    4

    Question about elastic/easing movements

    Hi,

    I was hoping someone could help me with an explanation and a possible point to a resource to hopefully resolve this.

    I have a horizontal line that i want to sweep the screen vertically. It will make technically 2 sweeps, one sweep down to 50 px, then next to 215 px. The line originates at -10 px and is triggered in at a specific time.

    The problem i have is on the second sweep, the position of the line reverts quickly back to -10 px and then starts to 215px, instead of starting at 50px.

    Even with setProperty(....) the line still goes to -10px before heading down on the second sweep.

    I'm thinking that my use of
    Code:
    Movieclip.prototype.sweep = function(...) {
    	this._y ......
    };
    and calling it from the lines m
    Code:
    onClipEvent (enterFrame) {
    	sweep......
    }
    is the problem.

    I have tried putting the easing code in a mc (the old way of doing this) and loop it. and use setProperty(...) to change the _y. With that version of the code it works fine.

    But that version is not as simple and easy to access and modify or attach multiple mcs to it.


    If someone can shine alittle light on this little problem, i would be greatful.

    Thank you,
    Alex

  2. #2
    Junior Member
    Join Date
    Oct 2003
    Posts
    4

    I apologize... i'm a dummy

    I'm sorry, about this...

    There was another mc that was conflicting with the line... not sure why it is, but i took that mc out and it works perfectly now.

    Sorry about this, and thank you for thinking about my problem.

    =)

    alex

  3. #3
    onClipEvent(enterFrame){
    if(this._x<50){
    this._x += (50-this._x)/4;
    }if (this._x>49 && this._x<215){
    this._x +=(215-this._x)/4;
    }
    }
    you would just attach this code onto the horizontal line MC
    it would be a glide and stop to x=50 and then an instaneous glide and stop to x=215
    hopefully that helps?
    //Chris

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