Click to See Complete Forum and Search --> : Playing one Flash File Before The Other
gameringer.com
04-18-2009, 11:34 PM
Hello,
What I want to do is have a small 10 second website advertisment play before the game becomes active. Is their a way to have one flash file play and when it is finished it starts the other one?
infinityspiral
04-20-2009, 04:00 PM
The easiest way would be to tell the advertisers that they will have say 15 seconds of screen time. You could then create a loader to pull in their ad and trigger a timer so that after 15 seconds a skip ad or close button appears.
You could also just give them a snippet of code to drop in at the end of their movie to make it unload theirs, but this is more time-consuming to regulate.
gameringer.com
04-20-2009, 09:38 PM
That first idea sounds like it would work really well. But how would you make it so something floats over the game at the beginning and after, say about 15 seconds, the game becomes active? Do u have any code that could do that? maybe a link?
infinityspiral
04-20-2009, 09:44 PM
Are you using Actionscript 2 or 3?
gameringer.com
04-20-2009, 09:47 PM
i dont have access to any of the game flash files. i have to do it all with html or css or javascript. anything like that
infinityspiral
04-20-2009, 11:24 PM
Hmm have you used jQuery? That seems like a good solution for this using jquery and their timer plugin. You could also do it with regular javascript, but it would be harder. The basic process would be that you could create a div with your game flash, then set the display to none in CSS. You would do the same thing for a link that would show the flash game. The ad would be in a visible div.
You'd set a timer after the page finishes loading and when the timer counts down fully it would make the link to show the flash visible. The link when clicked would then hide the ad and the link itself, then unhide the flash game div.
Whew...
gameringer.com
05-13-2009, 04:58 PM
I have been asking this question a lot and that is the best explanation i have heard. are you good at javascript? I dont really have any experience with it. would it be hard to code that?
infinityspiral
05-13-2009, 06:03 PM
I did up a simple example for the timer which after 15 seconds hides the ad and shows the game. If I were an advertiser though I might prefer to have the ad stay up under the game window instead of hiding. If you don't want to hide the ad just take that line out of the script below.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js" type="text/javascript"></script>
<!-- jquery timers plugin downloaded from http://plugins.jquery.com/files/jquery.timers-1.1.2.js.txt -->
<script src="jquery.timers-1.1.2.js" type="text/javascript"></script>
<script>
$(function (){
var seconds = 15;
$('body').oneTime(seconds*1000, function() {
$('#ad').hide();
$('#game').show();
});
});
</script>
<style>
#ad{
width:320px;
height:100px;
background:red;
}
#game{
width:320px;
height:240px;
display:none;
background:green;
}
</style>
</head>
<body>
<div id="ad">advertising in here</div>
<div id="game">flash game in here</div>
</body>
</html>
gameringer.com
05-15-2009, 12:12 PM
THANK YOU VERRRRY verrrrryy verrrry MUCH! This is exactly what i was looking for. It works perfectly. Im going to add it to my site tonight. THANK U.
infinityspiral
05-15-2009, 01:23 PM
Glad it worked out :)