A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Giving Values to Movieclips and adding together!

  1. #1
    Junior Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    24

    Giving Values to Movieclips and adding together!

    Hello to all - hopefully someone can help!

    What I want to do is have a profile of a skyscraper showing a cross section of all the levels. I want people to be able to click on multiple levels of the illustration and as they do this a field on the screen displays a figure which represents (and adds together) the floor space of each level.

    eg. If you click on level 21 (200 metres squared) then the field shows 200.
    Then if you click level 30 that is (185 metres squared) then the field would show 385. This needs to be able to add multiple levels (probably up to 10)

    Would this be possible?!!! If it doesn't make sense drop me a line!!

    Cheers!

  2. #2
    Bacon-wrapped closures Nialsh's Avatar
    Join Date
    Dec 2003
    Location
    Houston!
    Posts
    338
    Sure, it's very doable. There are lots of ways to do it but I'll outline the one I think is most straightforward.

    1) Have a separate movie clip for each level. These will be the things you click on to select or deselect a level.

    2) Create a "running total" variable and initialize it to 0

    3) Add a onRelease function to each of the level movie clips. This will be used to toggle the levels as selected or unselected. You probably want this event to change the appearance of the level so the user can tell whether it's been selected.

    4) Have the onRelease add or subtract its level's area from the running total, depending on if it's being selected or deselected. Also update the indicator that shows how much area is selected (use trace() to start with).


    It's tough to tell from your post how experienced you are. Let me know what makes sense (if anything) and what doesn't make sense. I'll try to clear it up for you. And good luck!

  3. #3
    Junior Member
    Join Date
    Dec 2004
    Location
    London
    Posts
    24
    Hi Nialsh,

    Just as a note - I forgot to say thanks for replying to this post!!! I still haven't done it yet - (too many other things got in the way) but I appreciate your help tremendously!

    Arrann

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