A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Dragging a movieclip with an independent time line

  1. #1
    Member
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    44

    Dragging a movieclip with an independent time line

    I am currently trying to make a VOLUME SLIDER that is a 101 frame animation. The animation represents a slide button in perspective view while it is moved from one end of the slide to the other side of the slide.

    How can I script the animation to drag and show the next frame or previous frame in the animation and control the sound simultaneously?

  2. #2
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    hmm sorry but wouldn't this be easier..

    http://www.flashkit.com/tutorials/Au...-721/index.php
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  3. #3
    Member
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    44

    Thank you, but I really need to know how?

    Thank you Gobbles, but I would really like to know if this can be done, I already know how to control the sound without this effect, I would like to produce this if I can the way I have described above.

  4. #4
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Ok I can of course be done...

    your slider animation must have a Startdrag function on it, then you get the coordinate of the starting point, now when you move it back and forth you get the value(x,y) of the mouse and tell the animation to "my_mc.nextFrame" if draged so that x get's bigger and "my_mc.previousFrame" if x get's smaller..

    let's say your slider animation is 101 frames long and starts on x=0

    then if draged to x=50 the frame in the animation shold be 50

    up_vol=_xmouse

    if (up_vol>=0){
    my_mc.gotoAndPlay(up_vol)
    }

    does it make sense.. it's an idea never the less..
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  5. #5
    Member
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    44
    I thank you for your help. I have been experimenting with using a dragging invisible button on top of the animation with good results. I will try your script, and post both for you to look at maybe tomorrow. Thanks again for the input. much appreciated.

  6. #6
    Member
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    44

    Volume slider almost done? Mouse too sticky! Help.

    Hi Gobbles

    I have some what completed the scripting on this animation. I can't seem to get the mouse to let go of the object when released from dragging. It still seems to not give any attention to the line of script that tells it to stop dragging on release. Do you have any ideas? I have attached the fla. to this email. I thank you for any help you can give me — jas_G.

  7. #7
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    sorry I cant open you're fla..probably some version mix up, Im one 2004 MX.

    do you drag you MC like this

    my_mc.startDrag(true)

    when things stick it's sometime that the mouse is no longer over the MC and then you cant activate the on release function.. this has to do with the fix point of the drag, true means the center of the MC and false is where ever you click...
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  8. #8
    Member
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    44
    Hi Gobbles
    I know its late were you are, I very much appreciate your responce. I have changed the option to true, but this seems to not make a difference. I am using Flash MX not MX 2004. I will repost the link maybe it got currupt, I will compress it as an (sit) double click on it . I am also on a mac, if that helps, most times not. Just in case I will past the script here for you to see if you still can't open my file.

    Script on movie clip:

    on (press) {
    startDrag("_root.myVolumeControl", true, left, top, right, bottom);
    this.nextFrame();
    }
    on (press) {
    startDrag("_root.myVolumeControl", true, left, top, right, bottom);
    this.prevFrame();
    }
    on (release, rollOut) {
    stopDrag();
    }



    Script on Movie clip instance on scene 1:

    onClipEvent (load) {
    top = _y;
    bottom = _y;
    left = _x;
    right = _x-375;
    }
    onClipEvent (enterFrame) {
    _root.myvolumeControl.gotoAndStop(_root.myVolumeCo ntrol._xmouse);
    }

  9. #9
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    Sorry Im on PC so that's why I can't read your fla..

    I was wondering why you have a "on rollOut" action on your MC..

    I can't see any errors in the code, but try getting rid of the rollOut action...
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  10. #10
    Member
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    44
    Tried that it didn't make a difference, it still wants to react when the mouse enters the scene. I don't know . Maybe my onclipevent enterframe won't allow the recognition of the other script?

  11. #11
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    ahh it could very well be the path of the top bottom... variables, try putting a _root. infront of them(When something fails I allways does this and in 80% of the cases it works)

    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  12. #12
    ReMember gobbles's Avatar
    Join Date
    Nov 2002
    Location
    Denmark
    Posts
    983
    and also a _root. infront of them in the drag action of course.....
    http://www.rickigregersen.com ...finally a blog!

    Your damned if you do...but your particually damned if you don´t

  13. #13
    Member
    Join Date
    Mar 2004
    Location
    Los Angeles
    Posts
    44
    I have added all the above and it does not work, sorry. I have found that this is something that is not easy to do . When the mouse courser does get close to the object I can click or press on it, but the object will jump to the top scene area. When the mouse enters the area I can drag across the area and get the effect I want but it is not reacting to the mouse over it, only in the scene area. You can see that I have tageted the frames to play when dragged are with the (xmouse) action, but everything else seems not to matter to the script. What to do?

    It is like I have programmed it to play keep away.

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