Crypt36
%Europe/Berlin %316 %2009, 08:35
Ik heb een geprogrammeerde animatie die loopt over 18 frames met daarin 4 keyframes. Deze animatie bestaat uit 4 plaatjes die elk weer onderverdeeld zijn in 16 kleinere MC's. Mijn probleem is nu dat ik op elke keyframe van de hoofdanimatie mijn hele code weer moet herhalen om de boel te laten werken en ik zou liever alles gewoon op de eerste keyframe hebben?! Hier een voorbeeld hoe het werkt voor de 3 van de 16 kleinere MC's.
In de eerste keyframe:
xicehndr;
xiceoarmr;
xicechest;
onEnterFrame = function() {
if (xhandvisible == 1){
icehndr._visible=false;
icehndr2._visible=false;
icehndr3._visible=false;
icehndr4._visible=false;
}
icehndr.gotoAndStop(1);
icehndr2.gotoAndStop(1);
icehndr3.gotoAndStop(1);
icehndr4.gotoAndStop(1);
iceoarmr1.gotoAndStop(1);
iceoarmr2.gotoAndStop(1);
iceoarmr3.gotoAndStop(1);
iceoarmr4.gotoAndStop(1);
icechest1.gotoAndStop(1);
icechest2.gotoAndStop(1);
icechest3.gotoAndStop(1);
icechest4.gotoAndStop(1);
if (xicehndr == 1) {
icehndr.gotoAndStop(2);
icehndr2.gotoAndStop(2);
icehndr3.gotoAndStop(2);
icehndr4.gotoAndStop(2);
}
if (xiceoarmr == 1) {
iceoarmr1.gotoAndStop(2);
iceoarmr2.gotoAndStop(2);
iceoarmr3.gotoAndStop(2);
iceoarmr4.gotoAndStop(2);
}
if (xicechest == 1) {
icechest1.gotoAndStop(2);
icechest2.gotoAndStop(2);
icechest3.gotoAndStop(2);
icechest4.gotoAndStop(2);
}
}
icehndr.onPress = function(){
xicehndr = 1;
}
iceoarmr1.onPress = function(){
xiceoarmr = 1;
}
icechest1.onPress = function(){
xicechest = 1;
}
En op de tweede keyframe:
xicehndr;
xiceoarmr;
xicechest;
onEnterFrame = function() {
if (xhandvisible == 1){
icehndr._visible=false;
icehndr2._visible=false;
icehndr3._visible=false;
icehndr4._visible=false;
}
icehndr.gotoAndStop(1);
icehndr2.gotoAndStop(1);
icehndr3.gotoAndStop(1);
icehndr4.gotoAndStop(1);
iceoarmr1.gotoAndStop(1);
iceoarmr2.gotoAndStop(1);
iceoarmr3.gotoAndStop(1);
iceoarmr4.gotoAndStop(1);
icechest1.gotoAndStop(1);
icechest2.gotoAndStop(1);
icechest3.gotoAndStop(1);
icechest4.gotoAndStop(1);
if (xicehndr == 1) {
icehndr.gotoAndStop(2);
icehndr2.gotoAndStop(2);
icehndr3.gotoAndStop(2);
icehndr4.gotoAndStop(2);
}
if (xiceoarmr == 1) {
iceoarmr1.gotoAndStop(2);
iceoarmr2.gotoAndStop(2);
iceoarmr3.gotoAndStop(2);
iceoarmr4.gotoAndStop(2);
}
if (xicechest == 1) {
icechest1.gotoAndStop(2);
icechest2.gotoAndStop(2);
icechest3.gotoAndStop(2);
icechest4.gotoAndStop(2);
}
}
icehndr2.onPress = function(){
xicehndr = 1;
}
iceoarmr2.onPress = function(){
xiceoarmr = 1;
}
icechest2.onPress = function(){
xicechest = 1;
}
Is er een mogelijkheid dit aan te passen zodat het gewoon allemaal werkt vanuit de eerste keyframe? Als ik andere stukjes code wil toevoegen verder in de tijdslijn moet ik weer keyframes toevoegen en weer alles herhalen en dit wordt een zootje. Heb ik een keuze?
En dan de 2de vraag:
ik wil aan een MC een actie toevoegen vanuit mijn maintimeline dus zoiets als dit:
MC1.removeMovieClip(this._parent);
Alleen wil ik dat dit pas op keyframe met naam 3 gebeurd, hoe schrijf je dat?
In de eerste keyframe:
xicehndr;
xiceoarmr;
xicechest;
onEnterFrame = function() {
if (xhandvisible == 1){
icehndr._visible=false;
icehndr2._visible=false;
icehndr3._visible=false;
icehndr4._visible=false;
}
icehndr.gotoAndStop(1);
icehndr2.gotoAndStop(1);
icehndr3.gotoAndStop(1);
icehndr4.gotoAndStop(1);
iceoarmr1.gotoAndStop(1);
iceoarmr2.gotoAndStop(1);
iceoarmr3.gotoAndStop(1);
iceoarmr4.gotoAndStop(1);
icechest1.gotoAndStop(1);
icechest2.gotoAndStop(1);
icechest3.gotoAndStop(1);
icechest4.gotoAndStop(1);
if (xicehndr == 1) {
icehndr.gotoAndStop(2);
icehndr2.gotoAndStop(2);
icehndr3.gotoAndStop(2);
icehndr4.gotoAndStop(2);
}
if (xiceoarmr == 1) {
iceoarmr1.gotoAndStop(2);
iceoarmr2.gotoAndStop(2);
iceoarmr3.gotoAndStop(2);
iceoarmr4.gotoAndStop(2);
}
if (xicechest == 1) {
icechest1.gotoAndStop(2);
icechest2.gotoAndStop(2);
icechest3.gotoAndStop(2);
icechest4.gotoAndStop(2);
}
}
icehndr.onPress = function(){
xicehndr = 1;
}
iceoarmr1.onPress = function(){
xiceoarmr = 1;
}
icechest1.onPress = function(){
xicechest = 1;
}
En op de tweede keyframe:
xicehndr;
xiceoarmr;
xicechest;
onEnterFrame = function() {
if (xhandvisible == 1){
icehndr._visible=false;
icehndr2._visible=false;
icehndr3._visible=false;
icehndr4._visible=false;
}
icehndr.gotoAndStop(1);
icehndr2.gotoAndStop(1);
icehndr3.gotoAndStop(1);
icehndr4.gotoAndStop(1);
iceoarmr1.gotoAndStop(1);
iceoarmr2.gotoAndStop(1);
iceoarmr3.gotoAndStop(1);
iceoarmr4.gotoAndStop(1);
icechest1.gotoAndStop(1);
icechest2.gotoAndStop(1);
icechest3.gotoAndStop(1);
icechest4.gotoAndStop(1);
if (xicehndr == 1) {
icehndr.gotoAndStop(2);
icehndr2.gotoAndStop(2);
icehndr3.gotoAndStop(2);
icehndr4.gotoAndStop(2);
}
if (xiceoarmr == 1) {
iceoarmr1.gotoAndStop(2);
iceoarmr2.gotoAndStop(2);
iceoarmr3.gotoAndStop(2);
iceoarmr4.gotoAndStop(2);
}
if (xicechest == 1) {
icechest1.gotoAndStop(2);
icechest2.gotoAndStop(2);
icechest3.gotoAndStop(2);
icechest4.gotoAndStop(2);
}
}
icehndr2.onPress = function(){
xicehndr = 1;
}
iceoarmr2.onPress = function(){
xiceoarmr = 1;
}
icechest2.onPress = function(){
xicechest = 1;
}
Is er een mogelijkheid dit aan te passen zodat het gewoon allemaal werkt vanuit de eerste keyframe? Als ik andere stukjes code wil toevoegen verder in de tijdslijn moet ik weer keyframes toevoegen en weer alles herhalen en dit wordt een zootje. Heb ik een keuze?
En dan de 2de vraag:
ik wil aan een MC een actie toevoegen vanuit mijn maintimeline dus zoiets als dit:
MC1.removeMovieClip(this._parent);
Alleen wil ik dat dit pas op keyframe met naam 3 gebeurd, hoe schrijf je dat?