4 Replies Latest reply on Aug 22, 2006 7:09 PM by kglad

# simplify

here's a code I´m doing ... its working...
I wanna know if its possible to simplify this code. (if its ok, thanks for reading)
this is a math's problem...

on (release) {
if (a=="" & b=="" & c=="" & d=="" & e=="" & f=="" & g=="" & h=="") { _root.mostra.gotoAndStop("p0");}
else {
a1=a, b1=b, c1=c, d1=d, e1=e, f1=f, g1=g, h1=h

if (a=="") {a1="0"}
if (b=="") {b1="0"}
if (c=="") {c1="0"}
if (d=="") {d1="0"}
if (e=="") {e1="0"}
if (f=="") {f1="0"}
if (g=="") {g1="0"}
if (h=="") {h1="0"}

K= Number(a1)+Number(b1)+Number(c1)+Number(d1)+Number(e1)+Number(f1)+Number(g1)+Number(h1)

if (K <= 9, K >=0) { R=9-K }
if (K <= 18, K >=10) { R=18-K }
if (K <= 27, K >=19) { R=27-K }
if (K <= 36, K >=28) { R=36-K }
if (K <= 45, K >=37) { R=45-K }
if (K <= 54, K >=46) { R=54-K }
if (K <= 63, K >=55) { R=63-K }
if (K <= 72, K >=64) { R=72-K }
if (K <= 81, K >=73) { R=81-K }

if (R==1) { _root.mostra.gotoAndStop("p1");}
if (R==2) { _root.mostra.gotoAndStop("p2");}
if (R==3) { _root.mostra.gotoAndStop("p3");}
if (R==4) { _root.mostra.gotoAndStop("p4");}
if (R==5) { _root.mostra.gotoAndStop("p5");}
if (R==6) { _root.mostra.gotoAndStop("p6");}
if (R==7) { _root.mostra.gotoAndStop("p7");}
if (R==8) { _root.mostra.gotoAndStop("p8");}
if (R==9) { _root.mostra.gotoAndStop("p9");}
if (R==0) { _root.mostra.gotoAndStop("p9");}
}}
try:

or:

• ###### 3. Re: simplify
thanks kglad .. always learning
• ###### 4. Re: simplify
me too. and you're welcome.