PDA

Volledige versie bekijken : AS korter


peres
%Europe/Berlin %689 %2005, 17:33
Hey flashers,

Ik heb in een flash-movie een rollover/rollout effect gebruikt. Alleen ik heb het voor best wel veel MC's. Dit is mijn AS:

MC1.onRollOver = function() {
MC1.gotoAndPlay(2);
MC1.swapDepths(_root.project.page2.getNextHighestD epth());
}
MC1.onRollOut = function() {
MC1.gotoAndPlay(13);
}
MC2.onRollOver = function() {
MC2.gotoAndPlay(2);
MC2.swapDepths(_root.project.page2.getNextHighestD epth());
}
MC2.onRollOut = function() {
MC2.gotoAndPlay(13);
}
MC3.onRollOver = function() {
MC3.gotoAndPlay(2);
MC3.swapDepths(_root.project.page2.getNextHighestD epth());
}
MC3.onRollOut = function() {
MC3.gotoAndPlay(13);
}
MC4.onRollOver = function() {
MC4.gotoAndPlay(2);
MC4.swapDepths(_root.project.page2.getNextHighestD epth());
}
MC4.onRollOut = function() {
MC4.gotoAndPlay(13);
}

en mijn vraag nou was; is het mogelijk om dit korter te schrijven? Want ik ben nog van plan nog veel meer MC's te plaatsen.

greetz,

Dauntless
%Europe/Berlin %693 %2005, 17:37
for(var i = 0; i<10; i++){
this["MC"+i].onRollOver = function() {
this.gotoAndPlay(2);
this.swapDepths(_root.project.page2.getNextHighest Depth());
}
this["MC"+i].onRollOut = function() {
this.gotoAndPlay(13);
}
}
Ik denk zo... Maar dit is rechtstreeks naar het forum dus er kunnen fouten in zitten :D

peres
%Europe/Berlin %702 %2005, 17:51
ah perfect :D bedankt man!