Hi i have a swf file called preloader.swf witch loads roomenglish.swf
how do i pass the flashvars from preloader.swf to roomenglish.swf
hope someone can help me been on this for ages.
here is my html code
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="101%" height="100%" id="preloader" align="middle">
<param name="movie" value="preloader.swf" />
<param name="quality" value="high" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="FlashVars" value="starttime=<?=$server_secs?>" id="flash" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="preloader.swf" width="101%" height="100%">
<param name="movie" value="preloader.swf" />
<param name="quality" value="high" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="FlashVars" value="starttime=<?=$server_secs?>" id="flash" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /> </a>
<!--[if !IE]>-->
</object>
and here is my as3 code
var int_secs;
var int_milli;
var paramSecs = 0;
function GetFlashVars()
{
var paramObj:Object = this.root.loaderInfo.parameters;
var valueStr:String;
for (var keyStr in paramObj)
{
switch (keyStr)
{
case "starttime":
valueStr = String(paramObj[keyStr]);
paramSecs = parseInt(valueStr);
break;
}
}
}
function recieveTextFromHtml(secs) {
int_milli = secs * 1000;
//Create a date object for Christmas Morning
var christmas:Date = new Date(2060, 11, 25, 0, 0, 0, 0);
//Current date object
var now:Date = new Date();
now.setTime(int_milli);
function incrementDate():void {
now = new Date();
now.setTime(int_milli);
// Conditional to snap to frame 3 if it is xmas or past xmas
if (now >= christmas) {
gotoAndStop(3);
}
// Set the difference between the two date and times in milliseconds
var timeDiff:Number = christmas.getTime() - now.getTime();
//Convert the timeDiff(which is in milliseconds) into regular seconds-minutes-hours-days
//The Math.floor is the closest rounded integer that is less than or equal to the decimal number
var seconds:Number = Math.floor(timeDiff / 1000);
var minutes:Number = Math.floor(seconds / 60);
// Set the remainder of the division vars above
minutes %= 5;
seconds %= 60;
// String all vars together for display
var timeRemaining:String = minutes + " : " + seconds;
// Display everything in their dynamic text fileds
timeString.text = timeRemaining;
now_txt.text = String(now);
xmas_txt.text = String(christmas);
int_milli = int_milli + 1000;
if (minutes==0 && seconds==10){
var startthegame = new startsoon();
startthegame.play();
}
}
setInterval(incrementDate,1000);
}
GetFlashVars();
if (paramSecs != 0)
recieveTextFromHtml(paramSecs);