A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Drag effect

  1. #1
    Member
    Join Date
    May 2000
    Posts
    42
    Hi there,

    There's an effect on a great site called http://www.kinetic.com.sg
    in the 'Lounge' section (click on the 'bar man - fill up the glass - then move it - watch the liquid in the glass wobble).

    I'm trying to figure this out using actionscripting but need a little help.

    Basically can anyone suggest how they get the liquid to wobble - I thinks it is done when you move to a new x and y position.

    Any help would be greatfully received.

    Thanks in advance.

    Mouse

  2. #2
    Senior Moderator
    Join Date
    Apr 2000
    Location
    Sheffield, UK
    Posts
    3,881
    You will notice that however far you move the mouse the liquid inside the glass always wobbles the same amount.

    So all this does is detects a mouse movement and then tells a movielcip to play. the movielcip is embedded inside the movieclip of the glass(which is locked to the mouse center)

    So firstly create a new movieclip and give it an instance name of "glass" then inside this movieclip on the first frame put:

    Set Variable: "tempx" = _x
    Set Variable: "tempy" = _y

    Then on the second frame put:

    Set Variable: "newx" = _x
    Set Variable: "newy" = _y
    If (newx ne tempx or newy ne tempy)
    Begin tell target("liquid")
    Go To And Play("wobble")
    End tell targetEnd If
    end if

    Now inside the movieclip with the instance name "glass" create a new movieclip and give it an instance name "liquid"

    Create a new layer inside the movieclip "glass" and place the movieclip "liquid" on this layer.



    Next foe the movieclip liquid:

    Edit the movieclip and on the first frame put a still graphic for the liquid along with a stop action.

    Next label the second frame "wobble" and start the animation of the liquid wobble here.

    On the last frame of the animation of the liquid wobble put the following action:

    Go To And Stop(1)


    Now all you have to do is put the movieclip "glass" on the frist frame of the main timeline with the following action:

    Start Drag ("/glass", lockcenter)

    Now it should all work!!!
    Hope that helps!!
    Regards Flahsguru

  3. #3
    I can't seem to get it to work. Are you sure this method works guru?

    Here is my .fla. Take a look at it and tell me what i did wrong if anything. I have been trying to learn actionscripting lately and have had problems trouble shooting my scripts when i don't have a clue on where to start.

    Thanks for any help.


    [Edited by Marc_01 on 08-12-2000 at 06:37 PM]

  4. #4
    Member
    Join Date
    May 2000
    Posts
    42

    Smile drag effect

    Hi flash Guru,

    Thanks for the suggestion it worked great!

    Much appreciated

    Mouse

  5. #5
    Member
    Join Date
    May 2000
    Posts
    42

    drag effect

    Hi Marc_01,

    I took a look at your .fla and have figured out why it wouldn't work - managed to make the liquid wobble now.

    Leave me your email and I'll attached the fla for you.

    Regards

    Mouse

  6. #6
    Cool Thanks!

    Im really want to learn actionscript badly so any help on why the scripts wouldn't work is greatly appreciated.

    email: [email protected]

    Thanks again mouse and guru

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