A Flash Developer Resource Site

Results 1 to 19 of 19

Thread: [Problem] Please Help

  1. #1
    Junior Member
    Join Date
    Jul 2006
    Posts
    25

    [Problem] Please Help

    I heard of an action that controls the movements of a movie clip.
    Can any body tell me the actionscript? I don't really rememder what it is.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Larger headlines will not solve your problems

    You mean onEnterFrame?
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Jul 2006
    Posts
    25
    I'm not quiet sure? actually, I dont know hehe. its alternatively if your tired to animate a movie clip to move from wherever to wherever using tween, we can use actionscript, instead.

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    You can:
    mc.onEnterFrame = function(){
    this._x +=5;
    }
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Junior Member
    Join Date
    Jul 2006
    Posts
    25
    Quote Originally Posted by cancerinform
    You can:
    mc.onEnterFrame = function(){
    this._x +=5;
    }
    yay! this is just what the doctor ordered! But.. The speed is constant, and doesn't stop!
    How can I make the movie clip stop in a specific time, and how can I make it slow down before it stops? is there an actionscript for this?

  6. #6
    Island Boy
    Join Date
    Apr 2006
    Posts
    655
    if you want it to stop at 200 you can use. Relplace 200 with whatever value you need to use.

    Code:
    mc.onEnterFrame = function(){
       this._x +=5;
    
       if (this._x >= 200){
          this._x=200;
       }
    }
    as for slowing it down that will be a little more complicated. but there are a couple of ways of doing it. One would be the use of the tween class and the other would be a few nested if statements.

  7. #7
    Junior Member
    Join Date
    Jul 2006
    Posts
    25
    Quote Originally Posted by VI Knight
    if you want it to stop at 200 you can use. Relplace 200 with whatever value you need to use.

    Code:
    mc.onEnterFrame = function(){
       this._x +=5;
    
       if (this._x >= 200){
          this._x=200;
       }
    }
    as for slowing it down that will be a little more complicated. but there are a couple of ways of doing it. One would be the use of the tween class and the other would be a few nested if statements.
    well as you said complicated... how complicated did you say it was again?
    I know there is a tutorial for this in www.actionscript.org , but I can't seem to find it?

  8. #8
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Here is something you may want to look at

    http://www.flashscript.biz/actionscr..._scroller.html
    - The right of the People to create Flash movies shall not be infringed. -

  9. #9
    Junior Member
    Join Date
    Jul 2006
    Posts
    25
    Quote Originally Posted by cancerinform
    Here is something you may want to look at

    http://www.flashscript.biz/actionscr..._scroller.html
    Thanks for the link, but this is just not what I wanted. I didnt actually say I wanted it to be slow, I wanted it to slow down before it stops.

  10. #10
    Island Boy
    Join Date
    Apr 2006
    Posts
    655
    he wants an easing on the motion

  11. #11
    Junior Member
    Join Date
    Jul 2006
    Posts
    25
    8-( ?

  12. #12
    Junior Member
    Join Date
    Jul 2006
    Posts
    25
    Does anybody visit www.actionscript.org Cuz I'm sure there is a tutorial for what I want. but that was a long time ago I saw it, so now I'm not sure where it is now?

  13. #13
    Smile
    Join Date
    May 2006
    Location
    Sydney, Australia
    Posts
    91
    Wouldent easing just be something like:

    x_move = 5;
    x_pos = 300;
    x_ease = 10;
    mc.onEnterFrame = function() {
    xm = x_pos-_x;
    _x += xm/x_ease;
    };


    EDIT: Just tested it and it worked for me (with a few tweaks ;p).

  14. #14
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Yeah, that is one simple way of doing it. Somebody was mentioning about easing:

    http://www.adobe.com/devnet/flash/ar...om_easing.html
    - The right of the People to create Flash movies shall not be infringed. -

  15. #15
    FK'n Elitist Super Mod EVPohovich's Avatar
    Join Date
    Dec 2000
    Location
    About to BAN you!
    Posts
    3,023
    Thread Title Edited.

    Please do not do that in the future.

    Croat that footer is WAAAY to large. Please knock it down to within Flask Kit Regulations.

    Thanks,

    EVP

  16. #16
    Junior Member
    Join Date
    Jan 2003
    Location
    new york city
    Posts
    10
    hey cancerinform, isn't there something on the FK regs, about being an elitist or snob or something along those lines....: )
    kenishii

  17. #17
    Junior Member
    Join Date
    Jul 2006
    Posts
    25
    Quote Originally Posted by Croat
    Wouldent easing just be something like:

    x_move = 5;
    x_pos = 300;
    x_ease = 10;
    mc.onEnterFrame = function() {
    xm = x_pos-_x;
    _x += xm/x_ease;
    };


    EDIT: Just tested it and it worked for me (with a few tweaks ;p).
    YAY, this is exactly what I wanted, thanks croat! thanks for everybody who tried to help me! you guys are helpful

  18. #18
    Smile
    Join Date
    May 2006
    Location
    Sydney, Australia
    Posts
    91
    Quote Originally Posted by EVPohovich
    Thread Title Edited.

    Please do not do that in the future.

    Croat that footer is WAAAY to large. Please knock it down to within Flask Kit Regulations.

    Thanks,

    EVP

    No worries, never read the Regulations (im such a bad man!). Sorry.

  19. #19
    Senior Member
    Join Date
    Jul 2006
    Location
    Australia
    Posts
    167

    Tween Class

    Hey, the Tween class is what your looking for, it does motions tweens, but via actionscript.

    Code:
    import mx.transitions.Tween
    import mx.transitions.easing.*
    
    btn_btn.onRelease = function(){
       new Tween(target,property,start value, end value, time, frames?)
    }
    the Tween class uses these parameters:

    target - this is the target of your tween

    property - this is the property of your target that you want to change (in your case, _x for horizontal position, and _y for vertical position) the property parameter must be enclosed in quotation marks (e.g. "_x")

    start value - this is the value that the tween will start on, if you want to use the current value of your target, type target.property (e.g. your mc has an instance name of box_mc, and you want to tween it horizontally, you would type box_mc._x)

    end value - this is the value that the tween will finish on

    time - this is the amount of time that you want the tween to take

    seconds? - this is a boolean value (true or false) if true, time will be measured in frames, if false, time will be measure in frames

    Any questions, email me or ask via msn @ [email protected]

    Cheers
    Ben a.k.a. Flash Geek
    Need Help? Get It Within 24 hours. If you don't have one of these messenger clients, just email me at my msn address below:
    Msn: ben" at "benmartinstudios" dot "com"

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