[fmx] issues with defining and using variables

Hi,

I posted a problem recently and I think I was asking too much too soon, I apoligise for that one. I want to try again with my problem. Basically I am making an interactive circuit builder in flash mx for 8-10 year olds (does anyone remember crocodile clips?).

The file I am referring to is located at :

http://www.learningcircuits.co.uk/project/circuit.fla

it is 400k in size, which was too big for on here.

I am having major problems with my code and I want to try to tackle each problem at a time.

The problem is that I have a set of four components; a motor, bulb, buzzer and switch. When a component is dragged off the list and into the circuit it need to check for power and then function accordingly, i.e. on or off. I have achieved this however i need it so when the component is removed from the circuit it then goes off again.

I do not think I have gone the best way to go about this but if you could be kind enough to see the attachment for what I have done it would really be appreciated.

For reference draggable components are called DragBulb, DragMotor, DragBuzzer and DragSwitch

All batteries add the same amount of power regardless of their size.

The code which (should) turn the component on and off is within the movie clip instance…i.e. the DragBulb MC on the stage has two frames and on each frame is code. The first frame is a graphic of the bulb off and the second frame is a MC of the bulb on, same goes for all the components…I did it this way so I can state the variable 'Component’Power (i.e. BulbPower, MotorPower etc…) to go to different frames depending on the amount of current in the circuit from the varibing amount of batteries…if anyone with more actionscript knowledge (all of you probably) thinks there would be a better way to do this?

Many thanks for your time and help, I appreciate it very much!

Matt.