Ich habe bei
www.actionscript.org ein schönes Transitionscript
gefunden, was ich für mich ein wenig umformen wollte
sprich in der ursprünglichen Version lief das ganze
unendlich einfach so. (siehe setInterval)
jetzt habe ich das ganze versucht so umzubauen, das man auf
"buttonclick" (siehe unten) einen definierten mc "attacht"
nur funzt das ganze nur beim erstenmal, evtl kann mir ja jemand helfen wo der fehler ist. Datei ist dabei:
ActionScript:
//Global vars
mWidth = 350;
//Create movie clip and mask
counter = -1;
createEmptyMovieClip('holder', 0);
//createMovieClip();
// animInt = setInterval(doAnim, 20);
function createMovieClip(num) {
counter++;
// statt 'pic' add num stand 'pic' add (counter%2) da da es nur zwei mcs zum switchen gab
holder.attachMovie('pic' add num, 'pic' add counter, counter);
holder.createEmptyMovieClip('mask' add counter, counter+10000);
holder['pic' add counter].setMask(holder['mask' add counter]);
trace(('pic' add (counter%2)));
}
function doAnim() {
var currMC = holder['mask' add counter];
if (animIndex<15) {
// Schritt 1
//trace("animIndex<15");
var time = animIndex/15;
var dist = 0.5*Math.sin(Math.Pi*(time-0.5))+0.5;
with (currMC) {
clear();
beginFill(0x000000);
lineTo(mWidth, 0);
lineTo(mWidth, dist*125);
curveTo(250, dist*40, 0, 10*dist);
endFill();
}
} else if (animIndex<35) {
// schritt2
//trace("animIndex<35");
var time = (animIndex-15)/20;
var dist = 0.5*Math.sin(Math.Pi*(time-0.5))+0.5;
with (currMC) {
clear();
beginFill(0x000000);
lineTo(mWidth, 0);
lineTo(mWidth, 125);
curveTo(250-100*dist, 40+150*dist, 0, 10+190*dist);
endFill();
}
} else if (animIndex<=50) {
// schritt 3
//trace("animIndex<=50");
var time = (animIndex-35)/15;
var dist = 0.5*Math.sin(Math.Pi*(time-0.5))+0.5;
with (currMC) {
clear();
beginFill(0x000000);
lineTo(mWidth, 0);
lineTo(mWidth, 125+75*dist);
curveTo(150, 190+10*dist, 0, 200);
endFill();
}
}
animIndex++;
if (animIndex>50) {
trace("animIndex: "+animIndex);
animIndex = 0;
holder['pic' add (counter-1)].removeMovieClip();
holder['mask' add (counter-1)].removeMovieClip();
//createMovieClip();
}
}
//stop();
//st.duplicateMovieClip('st0', 200000)
a.onRelease = function() {
_root.createMovieClip(0);
this.i = 0;
this.onEnterFrame = function() {
if (i<51) {
_root.doAnim();
i++;
}
};
};
b.onRelease = function() {
_root.createMovieClip(1);
this.i = 0;
this.onEnterFrame = function() {
if (i<51) {
_root.doAnim();
i++;
}
};
};
c.onRelease = function() {
_root.createMovieClip(2);
this.i = 0;
this.onEnterFrame = function() {
if (i<51) {
_root.doAnim();
i++;
}
};
};
übrigens kann man die Fkt irgendwie auslagern die bei onRelease aufgerufen wird?
saugen (als fla) kann man das ganze unter
http://www.tpz-online.de/my_swoosh1.rar