schwarzfahrer
Gesperrt
Hallo zusammen,
an die, die schonmal reingekuckt haben: Ja ich hab den Beitrag völlig überarbeitet
genau wie das .fla um das es geht.
Ich habe eine Stoppuhr die das Zählen anfängt wenn die Datei aufgerufen wird.
Es soll eine Art Fake-Uhr sein, deshalb startet sie auch um 13:12:00
Soweit so gut!
Ich möchte das zu einer bestimmten Uhrzeit ein anderer Frame geladen wird, bzw. in einem Movieclip ein anderer Frame geladen wird.
Der Aufruf sieht bei mir so aus:
if (atime[0]==14 && atime[2]==13 && atime[4] {
meinmovie.gotoAndStop(2)
meinmovie2.gotoAndPlay(2);
}
Er funktioniert nicht.
Vielleicht ist es das Beste wenn ich meinen ganzen Code dazuposte (überarbeitet und gekürzt, kommt aber von flashkit.com):
Danke, danke, danke schonmal an alle die sich die Mühe machen!
an die, die schonmal reingekuckt haben: Ja ich hab den Beitrag völlig überarbeitet

Ich habe eine Stoppuhr die das Zählen anfängt wenn die Datei aufgerufen wird.
Es soll eine Art Fake-Uhr sein, deshalb startet sie auch um 13:12:00
Soweit so gut!
Ich möchte das zu einer bestimmten Uhrzeit ein anderer Frame geladen wird, bzw. in einem Movieclip ein anderer Frame geladen wird.
Der Aufruf sieht bei mir so aus:
if (atime[0]==14 && atime[2]==13 && atime[4] {
meinmovie.gotoAndStop(2)
meinmovie2.gotoAndPlay(2);
}
Er funktioniert nicht.
Vielleicht ist es das Beste wenn ich meinen ganzen Code dazuposte (überarbeitet und gekürzt, kommt aber von flashkit.com):
Danke, danke, danke schonmal an alle die sich die Mühe machen!
Code:
// atime = [00, 11, 22, 33, 44, 55, 66}
// atime = [hh, XX, mm, XX, ss, XX, 00)
// initialize the array
atime = new Array();
atime[0] = "13";
atime[1] = ":";
atime[2] = "12";
atime[3] = ":";
atime[4] = "00";
function timerFunk () {
// used for the pause button... sets the freexe time to the current clock time
// pickup is set to 1 within the pause frame, once this "if" statment runs,
// the pause setting is turned off so that this "if" statement doesn't execute again
if (pickup) {
freeze = microtime;
pickUp = 0;
}
// this resets the clock back to "0" then disables this feature
// by setting "reset" to 0
if (reset) {
freeze = 0;
time = atime.join("");
reset = 0;
}
// this is the meat and potatoes... initilized at the root of the frame
if (timerOn) {
// "stamp" the current time, then disable this feature by setting
// "check" to "0"
if (check) {
timeBase = getTimer();
check = 0;
}
// timenow is constantly updated here
timeNow = getTimer();
// the difference between timeNow and timeBase is determined,
// plus we are throwing in the "freeze" variable for when
// the clock is in the "pause" mode... during normal operation,
// freeeze is set to "0" so it is a nice way to gain the pause function
// with just a little bit of code
microtime = (Number(timeNow)-Number(timeBase)+Number(freeze));
// "mts" stand for MicroTime seconds, since here we are mainly interested in
// deriving the seconds... We convert "mts" t a string so that we can "split"
// it on the "." (the "." appears because we have devided the milliseconds by 1000
//
// after this statement "mts" magically turns into an array (due to the "split"
// function. So later on you will see things like mts[0] and mts[1]... mts[0] is the junk
// on the left hand side of the "." and mts[1] is the junk from the right hand side of the "."
mts = (microtime/1000).toString().split(".");
// when mts gets to 60 we reset the clock simply by turning "check" "on"
// "check" get turned off after one iteration above
if (mts[0]>59) {
check = 1;
}
//
// here we are populating the sixth element of the array with the right hand
// side of the mts array ( aka: mts[1] ) then chopping off all but the first 3 characters
// via the substr() function
//
atime[4] = mts[1].substr(0, 1);
if (atime[4].toString().length<1) {
atime[4] = "0";
}
//
// here we are populating the 4th element of the atime array with the junk from the left hand side
// of the mts array
//
atime[4] = mts[0];
// here we ensure that the display always contains two characters
if (atime[4].toString().length<2) {
atime[4] = "0" add atime[4];
}
if (atime[4].toString().length<1) {
atime[4] = "00";
}
// since we've know that the left hand side of mts is "seconds" and that we have put
// mts[0} into the 4th element of the atime array - they are the same thing... so when our "seconds" get to
// 60 (since this will execute only when mts[0] gets to 60... we bump the minutes up by one increment
// then reset the display (atime[4]) to "00"
//
if (atime[4]>59) {
atime[2] = Number(atime[2])+Number(1);
atime[4] = "00";
}
// here we ensure that the display always contains two characters
if (atime[2].toString().length<2) {
atime[2] = "0" add atime[2].toString();
}
// bump the hours up when atime[2] (minutes) reaches 60
if (atime[2]>59) {
atime[0] = Number(atime[0])+Number(1);
atime[2] = "00";
}
// here we ensure that the display always contains two characters
if (atime[0].toString().length<2) {
atime[0] = "0" add atime[0];
}
if (atime[0].toString().length<1) {
atime[0] = "00";
}
// extract the data out of the atime array and smoosh it all together
// then display it in the text field on the stage
time = atime.join("");
}
}
Zuletzt bearbeitet: