Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

karmuser

macrumors newbie
Original poster
Apr 20, 2011
2
0
Hi,

I am working for a non profit organisation www.karmacurrency.com.au which raises funds and awareness for 100's of charities but I've got a problem. I need help with the fundraising thermometer where the "total raised" image should scale upwards along with the mercury and the percentage should also update, as I attached the images you can have a look at it. The mercury is increasing but the image is not moving along with the mercury. How I can do that with action script. And if you have any ideas on improving the functionality or design, that would also help.

Thanks in advance.
 

Attachments

  • therm1.png
    therm1.png
    54.6 KB · Views: 207
  • therm2.png
    therm2.png
    50.5 KB · Views: 182
It's hard to give specific advice without code to look at but...

Put the thing you want to move up in it's own movie clip. Put an instance of the clip on top of the background and mercury. Give the instance a name so you can refer to it in action script. They are different ways you could layer stuff, but start simple and only get more complicated if you have to.

I assume you have some actionscript already that is correctly scaling the mercury, right? That's where you want to put the script to move the banner. Assign a value to the .y property to move it up and down. E.g. if your instance is called "banner" then banner.y = 100 will move it to position 100.
Figure out which y position corresponds to 0% and which to 100%. Let's call those two values yfor0 and yfor100. Yuo can then calulate the current .y position for the banner like this:
banner.y = yfor0 + (yfor100 - yfor0) * percentToTarget;

Once you've got that working, add a dynamic text field to the banner movie clip. Give it a name, e.g. percentDisplay. Then you can access it in script. E.g.,

banner.percentDisplay.text = String(percentToTarget * 100) + " %";

(you probably want to play with rounding to whole number for display)

Likewise you probably want to create another text field for displaying the $ amount raised.
 
Fundraising Thermometer

Hi,

Thanks for your reply.
I attached the project and please look into it.
The images I posted in the thread are just sample one's. Our requirement is "the user creates his own fundraising page with a target say $120, initially the thermometer level is 0% value:0 and when people donates money the thermometer mercury level should increase and values are stored in the database and retrieved when the page loads. So that the thermometer mercury level should increase according to that. Finally, when reached the target it should show the "total raised" target $120 and 100% in the image.

Thanks in advance,
Karma User
 

Attachments

  • thermo (1).zip
    152.5 KB · Views: 139
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.