PDA

Volledige versie bekijken : AS2 naar AS1


Alex1980
%Europe/Berlin %971 %2009, 00:19
Hoi,

Ik ben momenteel bezig een php ming app te maken. nou kan ik hier AS in gebruiken maar alleen AS1. nu is mijn vraag... Hoe krijg ik dit stukje code van AS2 naar AS1?!

var cw = ColorAmount("0x"+pv.toString(16));

if(cw >= 0 && cw <= 20) {
ps.pos = 6;
ps.cover = 60;
} else if(cw > 20 && cw <= 35) {
ps.pos = 5;
ps.cover = 50;
} else if(cw > 35 && cw <= 50) {
ps.pos = 4;
ps.cover = 50;
} else if(cw > 50 && cw <= 65) {
ps.pos = 3;
ps.cover = 50;
} else if(cw > 65 && cw <= 80) {
ps.pos = 2;
ps.cover = 30;
} else {
ps.pos = 1;
ps.cover = 10;
}
ps.symbolss.gotoAndPlay(Math.round(Math.random() * 5 + 1));
ps._alpha = Math.round(Math.random() * 100); // ps.cover;
//delay = Math.round(Math.random() * 2000 + 2000)
var delay = Math.random() * 2000 + 2000;
setTimeout(ShowTile, delay, index, delay);

function ColorAmount(color:String) {
return Math.round(color / 0xffffff * 100); // 0-100
}

thanx!!!

Groetjes

Jan
%Europe/Berlin %989 %2009, 00:44
Ik zie zo dadelijk geen syntax die niet zou compilen in AS1.
Welke error krijg je?

Groeten,
Jan

Alex1980
%Europe/Berlin %016 %2009, 01:23
Ik zie zo dadelijk geen syntax die niet zou compilen in AS1.
Welke error krijg je?

Groeten,
Jan

ik krijg in php ming een syntax error. Maar als ik de onderste functie uitzet werkt ie wel maar doorloopt ie de if else niet.

in Flash werkt ie goed.

arnolduzzz
%Europe/Berlin %551 %2009, 14:14
zijn al die "else" wel nodig? :S

je kan ze inprincipe weg halen, misschien doorloop hij dan wel

of wil je hem echt zo laten?

Jan
%Europe/Berlin %554 %2009, 14:18
We misten de ShowTile functie (en vooral de datatype declaration daarin, die niet is toegestaan in AS1)
http://www.actionscript.org/forums/showthread.php3?p=866516#post866516
http://www.flashden.net/forums/thread/as2-to-as1/11427?page=1

Groeten,
Jan

Alex1980
%Europe/Berlin %571 %2009, 14:43
Thanx for all the help. i found the error. In the last function ColorAmount when i delete :String all seems to work fine :)

Cheers