A Flash Developer Resource Site

Results 1 to 16 of 16

Thread: Easing problem!

  1. #1
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801

    Easing problem!

    Okay, I'm working on my portfolio. And I got this on the "profile" MC:
    code:
    onClipEvent (load) {
    targetx = 143;
    targety = 136;
    speed = 8;
    function pull(){
    _x += (targetx-_x)/speed;
    _y += (targety-_y)/speed;
    }
    function push(){
    _x -= (88+_x)/speed;
    _y -= (81+_y)/speed;
    }
    }




    Now that all works.


    I have the same code on "porfolio" MC. And taht all works.
    On a button I have this code
    code:
    on (release) {
    this.onEnterFrame = function(){
    profile.pull();
    }
    }



    and I have that on another button also.

    Okay, now here is my problem: When one button is clicked and the Mc starts to move to targetx, if you click another button it stop on MC and moves the other. I think it might have to do with" this.onEnterFrame = function(){"


    Make sense?

    Thanks to whoever helps!

  2. #2
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    *bumper upper*

  3. #3
    Do both buttons have the same code? they both do profile.pull()?

    I'll just mention this yet again, I'm very proud of the code
    http://www.flashkit.com/board/showth...hreadid=478030

    scroll down and check out tween or multitween

    can you post the fla?

  4. #4
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    No, one button has profile.pull(); and the other has portfolio.pull();


    I can't uplaod the fla. but I can give you a link: http://www.studentrock.com/users/Eva...igns/Index.htm
    Sorry for the load time. Haven't had a chance to optimize or anything.

    I'm really confused as to why its doing this.
    Last edited by I_am_TheFlasher; 11-06-2003 at 10:45 PM.

  5. #5
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    *bump*

    man I'm anoying...

  6. #6
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    Now are you guys really gonna make me post three times in a row?

    ...oh whoops, too late...

  7. #7
    Member
    Join Date
    Aug 2001
    Posts
    65
    erm, i thought that make sense?
    u r rewriting this.onEnterFrame function each time u click the button... so only either one of the pull() will be called?
    maybe..., i'm a noob...

  8. #8
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    Originally posted by isc00011
    u r rewriting this.onEnterFrame function each time u click the button... so only either one of the pull() will be called?
    Yeah, thats what's happening, but that's exactly not what I want to happen. I them both to come to there final targets at once, depending on when the buttons are clicked)

    i know there must be a way around this.

    Yasuno--Your script is just too long and complicated for my puny mind to comprehend.

  9. #9
    Member
    Join Date
    Aug 2001
    Posts
    65
    correct me if i'm wrong,

    u want both pull function to be called within the onEnterFrame function if both button if clicked?

  10. #10
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    Originally posted by isc00011
    correct me if i'm wrong,

    u want both pull function to be called within the onEnterFrame function if both button if clicked?
    If the "profile" button is clicked I want the "profile_mc" to pull();

    If "portfolio" is clicked I want the "portfolio_mc" to pul();

    but if the user hits one button then the next I still want them to do both.

    Make sense?

  11. #11
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    OH my gosh! I'm a moron. I don't know why I didn't see this.

    I just had to put on onEnter frame function inside the other functions.

    Works like a charm now, thanks anyways guys!

  12. #12
    Member
    Join Date
    Aug 2001
    Posts
    65
    got it...

    i'm sure there must be a better solution, i'm lazy to think, ha ha
    but this is the first thing that came up in my mind.
    use a variable as indicator, then u condition the button's on release function.

    make sense? khekheke..., sorrie, lame solution from me...

  13. #13
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    Originally posted by isc00011
    got it...

    i'm sure there must be a better solution, i'm lazy to think, ha ha
    but this is the first thing that came up in my mind.
    use a variable as indicator, then u condition the button's on release function.

    make sense? khekheke..., sorrie, lame solution from me...
    Thanks man, but I figrued it out. see^^

  14. #14
    Member
    Join Date
    Aug 2001
    Posts
    65
    so how do u solve it? *juz wondering...
    eh mind to see my other thread, i need a pointer or two there..
    thanx man!

  15. #15
    banned by dp. I_am_TheFlasher's Avatar
    Join Date
    May 2003
    Posts
    801
    Originally posted by isc00011
    so how do u solve it? *juz wondering...
    eh mind to see my other thread, i need a pointer or two there..
    thanx man!
    Instead of:
    code:
    onClipEvent (load) {
    targetx = 143;
    targety = 136;
    speed = 8;
    function pull(){
    _x += (targetx-_x)/speed;
    _y += (targety-_y)/speed;
    }
    function push(){
    _x -= (88+_x)/speed;
    _y -= (81+_y)/speed;
    }
    }

    I used this:
    code:

    onClipEvent (load) {
    targetx = 137;
    targety = 134;
    speed = 8;
    function pull(){
    this.onEnterFrame = function(){
    _x += (targetx-_x)/speed;
    _y += (targety-_y)/speed;
    }
    }
    function push(){
    this.onEnterFrame = function(){
    _x -= (95+_x)/speed;
    _y -= (81+_y)/speed;
    }
    }
    }




    And...sure I'll take a look at your other thread, see if I could lend a hand.

  16. #16
    Member
    Join Date
    Aug 2001
    Posts
    65
    neat, heh heh
    thanx!

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