loading a movie from a php variable


i have web site has publicity on it.

what need in flash load php file send me link chosen randomly , in flash have loadmovie(the link php)

also @ end of each movie need reload php file , load publicity.

what have right in main flash fallowing

loadvars = new loadvars();
loadvars.load("pub.php");
loadvars.onload = function(success) {
if (success) {
pub.loadmovie(this.var2);
} else
{
pub.loadmovie("pub1.swf");
}
};
break;


and @ end of each pub have :

loadvars = new loadvars();
loadvars.load("pub.php");
loadvars.onload = function(success) {
if (success) {
_root.pub.loadmovie(this.var2);
} else
{
_root.pub.loadmovie("pub1.swf");
}
};
break;

right first movie load when first pub end loop @ beginning , never load else
the time work when hard coded link using

this.loadmovie(my path here);
break;

try placing stop(), command on last frame of loaded movies, avoid replay while loading. also, trace loaded variable see if changes:
--
stop();
loadvars = new loadvars();
loadvars.load("pub.php");
loadvars.onload = function(success) {
if (success) {
trace(this.var2);
_root.pub.loadmovie(this.var2);
} else
{
_root.pub.loadmovie("pub1.swf");
}
};
--
if var2 same, flash uses cached php. force reload instead of using cached version, add timestamp load command:
loadvars.load("pub.php?foo="+gettimer());
this way it's new url, , flash load again server.

the 'break' statements useless here, in switch, while or statements.

oh, , make sure use correct case:
loadvars = new loadvars();
in newer flash versions, strictly case sensitive, , class called loadvars.

hth,
blemmo


More discussions in ActionScript 1 and 2


adobe

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

Rasperry Wifi LAN Controller - Raspberry Pi Forums

Unlock car with bluetooth and car key