# Maths Question

**URL:** <https://forum.kirupa.com/t/maths-question/168313>\
**Category:** flash\
**Created:** [November 6, 2005, 2:09am UTC](https://forum.kirupa.com/t/maths-question/168313 "2005-11-06T02:09:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![unclesond](https://avatars.discourse-cdn.com/v4/letter/u/df788c/32.png) [@unclesond](https://forum.kirupa.com/u/unclesond)\
**Post date:** [November 6, 2005, 2:09am UTC](https://forum.kirupa.com/t/maths-question/168313/1 "2005-11-06T02:09:28Z")

</div>

I’m currently using flash with a teleo board (hooks flash up to little electronic inputs) and im trying to use light dependant resistors to change the alpha of a mc.

The light dependant resistors give flash a reading between 0 and 32. 32 being bright light, 0 being complete darkness. Now I want to use those numbers to make an object 100% opaque in complete darkness (reading 0), and 0% in complete lightness (reading 32) then all percentages inbetween

My code so far

[AS]  
mc\_a0.onEnterFrame = function()  
{  
//ai0 is var setup for each LDR  
var v:Number = ai0.getValue();  
mc\_a0.\_alpha = ((v / 32) \* 100);  
}  
[/AS]

Now that code works. but it does it the wrong way round. everything is 100% on reading 32. and everything is 0% on 0. I need reading 32 to = 0% and reading 0 to = 100%…im tired and can’t see what to do to swap the figures around.

thanks in advance
