A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Drag and Drop

  1. #1
    Junior Member
    Join Date
    Jan 2001
    Posts
    19
    I am working on a drag and drop that deals with balance. I have a scale with a bag full of objects in it. This bag is on the left side of the scale and weighs it down. As you drag items from the bag, I want to have the angle of the scale change. I am lost on this on. Can someone help?

  2. #2
    Junior Member
    Join Date
    Oct 2001
    Posts
    13
    Some hints for you...

    Give each item in the bag a variable.
    Numbers would be good.
    E.g. item1=2
    Set a variable when all the items are in the bag.
    Eg. totalweight=100
    Set a variable for the angle - angle = (startvalue)
    Then:
    If (totalweight==100)all items in the bag
    angle = 100
    now when you remove an item you must affect the totalweight
    variable by subtracting the value of the item variable from the totalweight variable.
    Then have the new totalweight again effect the angle variable:
    If (totalweight==newvalue)
    angle=(newvalue)
    You could make your scale graphic a circle with a line through the centre being the only visible feature and set uo a relationship like
    onenterFrame
    _rotation = totalweight/180

    Hope this gets yer mind going.

  3. #3
    Junior Member
    Join Date
    Jan 2001
    Posts
    19
    Thank a lot! I will try this out and may have some more questions if you have the time. Your assistance is greatly appreciated!

    Daye Collier

  4. #4
    Junior Member
    Join Date
    Jan 2001
    Posts
    19
    I have one more question if you have the time. When I am giving a value to each item, if there are 10 items, and the total weight is 100, would each have a value of 10? How would I set this up. Would it be item1=10?

  5. #5
    Junior Member
    Join Date
    Oct 2001
    Posts
    13
    Give each item any value you want as long as the whole load adds up to 100 or whatever you wish the totalweight to be.

    So yes, the items could all have the same value, but that would'nt be so realistic would it? Use whole numeric values though, it will make life easier.

    Make an Mc give it a variable of say weight=20.
    Make another Mc, a circle, with a line through it so you can observe any change in rotation.
    Put both of them on the timeline and give them instance names.
    In the circle put code along these lines:
    On enterframe
    _rotation = _root.(otherMc).weight

    Test it and I think you'll get the idea.
    Got to go home now.
    Talk again later.
    [Edited by ricktor on 03-06-2002 at 05:41 AM]

  6. #6
    Junior Member
    Join Date
    Jan 2001
    Posts
    19
    If I send you the .fla for the scale I was workin on, do you think you could tell me where I am goin wrong? I'm lost!!!!!!

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