actionscript quickie
- Started
- Last post
- 10 Responses
- rizingdamp
hello, ive been away traveling for a while and my actionscripting has been pushed out of my head
how can i write these two things in fewer lines:
part 1 -
if (_root.player1at == 1) {
_root.outer1.gotoAndStop("lit");
}
if (_root.player1at == 2) {
_root.outer2.gotoAndStop("lit");
}
if (_root.player1at == 3) {
_root.outer3.gotoAndStop("lit");
}
if (_root.player1at == 4) {
_root.outer4.gotoAndStop("lit");
}
if (_root.player1at == 5) {
_root.outer5.gotoAndStop("lit");
}
if (_root.player1at == 6) {
_root.outer6.gotoAndStop("lit");
}
if (_root.player1at == 7) {
_root.outer7.gotoAndStop("lit");
}
if (_root.player1at == 8) {
_root.outer8.gotoAndStop("lit");
}
if (_root.player1at == 9) {
_root.outer9.gotoAndStop("lit");
}
if (_root.player1at == 10) {
_root.outer10.gotoAndStop("lit...
}
if (_root.player1at == 11) {
_root.outer11.gotoAndStop("lit...
}
if (_root.player1at == 12) {
_root.outer12.gotoAndStop("lit...
}
if (_root.player1at == 13) {
_root.outer13.gotoAndStop("lit...
}
if (_root.player1at == 14) {
_root.outer14.gotoAndStop("lit...
}and PART 2
_root.outer1.gotoAndStop("off");
_root.outer2.gotoAndStop("off");
_root.outer3.gotoAndStop("off");
_root.outer4.gotoAndStop("off");
_root.outer5.gotoAndStop("off");
_root.outer6.gotoAndStop("off");
_root.outer7.gotoAndStop("off");
_root.outer8.gotoAndStop("off");
_root.outer9.gotoAndStop("off");
_root.outer10.gotoAndStop("off...
_root.outer11.gotoAndStop("off...
_root.outer12.gotoAndStop("off...
_root.outer13.gotoAndStop("off...
_root.outer14.gotoAndStop("off...i know im being stupid but i can help it, please help its driving me crazy....
- unfittoprint0
if (_root.player1at >= 1 && _rootplayer1at
- tomkat0
_root["outer"+player1at._current...
that for the upper half of ur code
the rest could be in a for loop, for example
- Mick0
var NoItems = 14;
for(var 1:Number=0; i
- rizingdamp0
thanks a lot guys : )
- unfittoprint0
//1 part of code use tomkat's.
- Mick0
Wish there was a way to post code on NT
[code]please[/code]
- tomkat0
errr.. leave the currentframe thingy out in my example
i got that wrong :}
- D_Dot0
Use "elseIf" that way the player doesn't have to check to see if all the statements are true, just the one that is true is executed. and it doesn't slow down the movie to check the others.
- unfittoprint0
now it's ok
http://pastebin.coconut.se/?id=3…