Zurück   Flashforum > Flash > Flash Fortgeschritten > Flash 8

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 04-09-2009, 13:04   #1 (permalink)
Neuer User
 
Registriert seit: Sep 2009
Beiträge: 2
Countdown - Date aus PHP ???

Hallo,

habe da ein kleines Problem. Ich habe einen Countdown erstellt, der auch prima funktioniert. Nun möchte ich, dass das Enddatum über PHP eingestellt werden kann.

Ich habe versucht das Enddatum über
- loadVariables ("auktion_date.php");
- this.loadVariables("auktion_date.php");
- loadVariablesNum("auktion_date.php?cache="+cache,0 ,"GET");

einzubinden. Hat nicht funktioniert. Der Countdown , der in der webseite eingebaut ist, läuft einfach nicht los!

Ich poste nun einfach mal, den AS-Code. Vielleicht kann mir von Euch jmd helfen. Das googeln bringt mich leider nicht weiter.

Der AS-Code:
stop();

currentDate = new Date();
thisYear = currentDate.getFullYear();

LoadVars.load("auktion_date.php");

eventDate = new Date(auktionsyear, auktionsmonth, 9, 14, 00);
eventMillisecs = eventDate.getTime();

counter.onEnterFrame = function(){

currentDate = new Date();
currentMillisecs = currentDate.getTime();
this.msecs = eventMillisecs - currentMillisecs;

if (this.msecs <= 0){
play();
return;
}


this.secs = Math.floor(this.msecs/1000);
this.mins = Math.floor(this.secs/60);
this.hours = Math.floor(this.mins/60);
this.days = Math.floor(this.hours/24);


this.msecs = string(this.msecs % 1000);
this.secs = string(this.secs % 60);
this.mins = string(this.mins % 60);
this.hours = string(this.hours % 24);
this.days = string(this.days);

while (this.msecs.length < 3) this.msecs = "0" + this.msecs;
if (this.secs.length < 2) this.secs = "0" + this.secs;
if (this.mins.length < 2) this.mins = "0" + this.mins;
if (this.hours.length < 2) this.hours = "0" + this.hours;
while (this.days.length < 3) this.days = "0" + this.days;


for(movie in this){
if (this[movie]._parent == this) this[movie].evaluateFrameFrom(this);
}
};


MovieClip.prototype.evaluateFrameFrom = function(variableClip){
var nameArray = this._name.split("_");
var numberSet = variableClip[nameArray[0]];
var character = number(nameArray[1]);
var frame = 1 + number(numberSet.charAt(character));
if (this._currentframe != frame) this.gotoAndStop(frame);
};



Der PHP-Code sieht folgendermaßen aus:
<?php
require("inc/db_connect.php");
$query = "(select * from auktion where id = 1)";
$result = mysql_query($query);
$row=mysql_fetch_array($result);
list($year, $month, $day) = explode('-', $row['date']);
$month = $month -1;
list($hour, $minutes) = explode(':', $row['time']);
$echoString = "&auktionsyear=";
//$echoString .= $year.", ".$month.", ".$day.", ".$hour.", ".$minutes;
$echoString .= $year;
$echoString .= "&auktionsmonth=";
$echoString .= $month;
$echoString .= "&";
echo $echoString;
?>

Vielen Dank schonma im vorraus!

Liebe Grüße aus dem Norden,

Blue_Sky
Blue_Sky ist offline   Mit Zitat antworten
Alt 04-09-2009, 13:13   #2 (permalink)
................
 
Benutzerbild von Der Frager
 
Registriert seit: Jun 2004
Beiträge: 15.890
LoadVars kannst du so ja auch überhapt nicht benutzen. Guck mal, ob's so geht:
PHP-Code:
stop();

currentDate = new Date();
thisYear currentDate.getFullYear();

var 
lv = new LoadVars()
lv.onLoad los
lv
.load("auktion_date.php");

function 
los(){
eventDate = new Date(lv.auktionsyearlv.auktionsmonth91400);
eventMillisecs eventDate.getTime();

counter.onEnterFrame = function(){

currentDate = new Date();
currentMillisecs currentDate.getTime();
this.msecs eventMillisecs currentMillisecs;

if (
this.msecs <= 0){
play();
return;
}


this.secs Math.floor(this.msecs/1000);
this.mins Math.floor(this.secs/60);
this.hours Math.floor(this.mins/60);
this.days Math.floor(this.hours/24);


this.msecs string(this.msecs 1000);
this.secs string(this.secs 60);
this.mins string(this.mins 60);
this.hours string(this.hours 24);
this.days string(this.days);

while (
this.msecs.length 3this.msecs "0" this.msecs;
if (
this.secs.length 2this.secs "0" this.secs;
if (
this.mins.length 2this.mins "0" this.mins;
if (
this.hours.length 2this.hours "0" this.hours;
while (
this.days.length 3this.days "0" this.days;


for(
movie in this){
if (
this[movie]._parent == thisthis[movie].evaluateFrameFrom(this);
}
};
}

MovieClip.prototype.evaluateFrameFrom = function(variableClip){
var 
nameArray this._name.split("_");
var 
numberSet variableClip[nameArray[0]];
var 
character number(nameArray[1]);
var 
frame number(numberSet.charAt(character));
if (
this._currentframe != framethis.gotoAndStop(frame);
}; 
Kann's gerade nicht vernünftig formatieren weil der Schei.ß AS-Editor mal wieder rumspinnt...
__________________

ternärer Konditionaloperator

+++ Bitte keine Privat-Nachrichten bezüglich Flashfragen! +++
Der Frager ist offline   Mit Zitat antworten
Alt 04-09-2009, 13:26   #3 (permalink)
Neuer User
 
Registriert seit: Sep 2009
Beiträge: 2
Vielen Daaaaank...Frager =)

Es funzt, es funzt ...es funzt... =)

Du hast mir meinen Tag gerettet und na klar den Counter!

Das Problem lag also bei der variablendeklaration und der Funktion, die die Variablen gar nicht wirklich verwendet hat, oder?

Nur so für den Hintergrund...

Liebe Grüße, Blue_Sky
Blue_Sky ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Stichworte
countdown, counter, flash, php, variable

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 20:32 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele