Monday, December 12, 2011

How can I create a flash file that forwards to an HTML file if the page doesn't laod within X seconds?

I have this really cool home page idea with some nice animation, but I don't want to scare customers away if the page takes to long to load. I would like to make a preloader that determines how long it is before the animation starts playing. IF it takes longer than say 2 or 3 seconds, I want the flash file to go to an alternative html version of the page. Can this be done? Are there any good websites out there that can help me?How can I create a flash file that forwards to an HTML file if the page doesn't laod within X seconds?
Yes that can be easily done with a preloader.There are a number of ways to do it depending on your preloader. If you are using code on the first frame of your preloader that checks the percent loaded with code on the second frame that sends the playhead back to your first frame, you can add something similar to the following to check the time and send to another page. Time is in milliseconds so 3000 = 3 seconds.

var now:Number = getTimer();

if(now %26gt; 3000){

getURL(';http://www.yourdomainname.com/yo?br>
}



This would have to be integrated into your exisiting preloader so that the preloader continues to check the load progress, but that's the main idea anyway. If you need more help with this, you can contact me through my website at http://www.discwritecd.com/. If you send me your preloader code, I can add the timer code to it. John

No comments:

Post a Comment