The Little Guy Posted May 1, 2010 Share Posted May 1, 2010 I am trying to do a ratio, but can figure this out.. I am using flash to make a graph using data from a xml file. val = the value from the xml file 20 = the amount of space that should be below the bottom var ratio = 100 / stage.stageHeight; var yp = (stage.stageHeight - (ratio * val)) - 20; Quote Link to comment https://forums.phpfreaks.com/topic/200408-ratio/ Share on other sites More sharing options...
andrewgauger Posted May 2, 2010 Share Posted May 2, 2010 var ratio = stage.stageHeight/100; var yp = (stage.stageHeight - (ratio * val)) - 20; Or I'm nuts. Quote Link to comment https://forums.phpfreaks.com/topic/200408-ratio/#findComment-1051740 Share on other sites More sharing options...
The Little Guy Posted May 2, 2010 Author Share Posted May 2, 2010 This is exactly what I want: var yp = -((val/max) * (stage.stageHeight - 30)) + stage.stageHeight - 20; Quote Link to comment https://forums.phpfreaks.com/topic/200408-ratio/#findComment-1051771 Share on other sites More sharing options...
andrewgauger Posted May 2, 2010 Share Posted May 2, 2010 Isn't it amazing how much you actually use high school algebra when programming? Quote Link to comment https://forums.phpfreaks.com/topic/200408-ratio/#findComment-1051773 Share on other sites More sharing options...
The Little Guy Posted May 2, 2010 Author Share Posted May 2, 2010 True dat dawg Quote Link to comment https://forums.phpfreaks.com/topic/200408-ratio/#findComment-1052049 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.