www.webdeveloper.com
Results 1 to 10 of 10

Thread: Playing one Flash File Before The Other

  1. #1
    Join Date
    Mar 2009
    Posts
    27

    Playing one Flash File Before The Other

    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?

  2. #2
    Join Date
    Mar 2007
    Location
    USA
    Posts
    449
    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.
    infinityspiral.com

  3. #3
    Join Date
    Mar 2009
    Posts
    27

    Thumbs up Sounds Great

    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?

  4. #4
    Join Date
    Mar 2007
    Location
    USA
    Posts
    449
    Are you using Actionscript 2 or 3?
    infinityspiral.com

  5. #5
    Join Date
    Mar 2009
    Posts
    27
    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

  6. #6
    Join Date
    Mar 2007
    Location
    USA
    Posts
    449
    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...
    infinityspiral.com

  7. #7
    Join Date
    Mar 2009
    Posts
    27

    Smile Thanks for the info. wow, that sounds like it would really work

    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?

  8. #8
    Join Date
    Mar 2007
    Location
    USA
    Posts
    449
    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.

    Code:
    <!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>
    infinityspiral.com

  9. #9
    Join Date
    Mar 2009
    Posts
    27

    Thumbs up Thank you!!!!

    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.

  10. #10
    Join Date
    Mar 2007
    Location
    USA
    Posts
    449
    Glad it worked out
    infinityspiral.com

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles