Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 04-09-2008, 07:57 AM   #1 (permalink)
Contributing Member
 
Join Date: 11-12-07
Location: Markham
Posts: 68
iTrader: 0 / 0%
basslion is liked by many
Alternating Flash Header on Refresh Script not working in Firefox

I have the following script which will load a random flash header when a person refreshes the page. Quite a great script. The issue i am having is that it only works in IE and when i load it in Firefox FireFox tries to download the flash file instead of displaying it. I have commented out the 2,3,4 & 5 flash banners as i just want to get the 1st one working.

Any help is greatly appreciated.

<script type="text/javascript">
function switcher()
{
var ad=new Array()

ad[0]='Movie1.swf';

//ad[1]='Movie2.swf';

//ad[2]='Movie3.swf';

//ad[3]='Movie4.swf';

//ad[4]='Movie5.swf';

var xy=Math.floor(Math.random()*ad.length);

document.getElementById('iframe1').src=ad[xy];
}
</script> </head>
<body onLoad="switcher()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (template.psd) -->
<table width="1000" height="506" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
<td height="187" colspan="9">
<iframe name="iframe1" id="iframe1" src="" width="1000" height="187" scrolling="no" frameborder="0">Click Here!</iframe>
</td>

********

You can view this script in action here

http://officialelectroniczone.staging.secure2u.com/
basslion is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-09-2008, 10:08 AM   #2 (permalink)
v7n Mentor
 
Taltos's Avatar
 
Join Date: 11-22-06
Location: Phoenix, AZ
Posts: 1,784
iTrader: 0 / 0%
Latest Blog:
None

Taltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web proTaltos is a highly respected web pro
basslion, I haven't done this in a while but taking a quick look, it doesn't look like you have put your flash file in correctly. Maybe the new browsers and player work a little different but I believe you have to setup an <object> and <embed> to make it work nicely and properly in IE, FF and other browsers. You have just set the source of your iframe to be that movie. I think the only reason it works in IE is that IE has traditionally added features that are really outside or in contradiction to the standards that try to intelligently anticipate mistakes and problems. An example is you can leave a closing tag out in a table row or data and it might still display correctly in IE but most other browsers will make a mess of it.

Hopefully, someone that has done this more recently can verify this or you can hit google real quick and get some examples.
__________________
Experimenting
Taltos is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-10-2008, 03:07 AM   #3 (permalink)
Contributing Member
 
Join Date: 11-12-07
Location: Markham
Posts: 68
iTrader: 0 / 0%
basslion is liked by many
Quote:
Originally Posted by Taltos View Post
basslion, I haven't done this in a while but taking a quick look, it doesn't look like you have put your flash file in correctly. Maybe the new browsers and player work a little different but I believe you have to setup an <object> and <embed> to make it work nicely and properly in IE, FF and other browsers. You have just set the source of your iframe to be that movie. I think the only reason it works in IE is that IE has traditionally added features that are really outside or in contradiction to the standards that try to intelligently anticipate mistakes and problems. An example is you can leave a closing tag out in a table row or data and it might still display correctly in IE but most other browsers will make a mess of it.

Hopefully, someone that has done this more recently can verify this or you can hit google real quick and get some examples.

I think the very best way to do this is to have a XML that uses Actionscript in Flash to load different flash images into a single Flash movie. I am going to give this a try.
basslion is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-10-2008, 09:43 AM   #4 (permalink)
The McLickerator
 
3ncryptabl3_lick's Avatar
 
Join Date: 05-31-04
Location: Where do any of us *really* live, I ask you?
Posts: 5,143
iTrader: 6 / 100%
3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order
Taltos has the right idea. A container movie that imports alternate .swf files into itself, but I would base it on a SharedObect file so all the scripting is action script. A well designed So file will let you do everything you need to do from alternate based on views, time, date.. whatever params you set in place and check for at each visit of the user.
3ncryptabl3_lick is online now  
Add Post to del.icio.us
Reply With Quote
Old 04-10-2008, 09:57 AM   #5 (permalink)
Contributing Member
 
Join Date: 11-12-07
Location: Markham
Posts: 68
iTrader: 0 / 0%
basslion is liked by many
Quote:
Originally Posted by 3ncryptabl3_lick View Post
Taltos has the right idea. A container movie that imports alternate .swf files into itself, but I would base it on a SharedObect file so all the scripting is action script. A well designed So file will let you do everything you need to do from alternate based on views, time, date.. whatever params you set in place and check for at each visit of the user.
I am looking on flash den and i noticed someone there has a random banner on refresh package, so i was thinking of using this. it is xml driven.
basslion is offline  
Add Post to del.icio.us
Reply With Quote
Old 04-15-2008, 04:59 AM   #6 (permalink)
The McLickerator
 
3ncryptabl3_lick's Avatar
 
Join Date: 05-31-04
Location: Where do any of us *really* live, I ask you?
Posts: 5,143
iTrader: 6 / 100%
3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order3ncryptabl3_lick is a web professional of the highest order
I think you're best bet is using SharedObject. Anything else will require page code or browser manipulation which can be tricky across platforms.

The SO file is like a cookie, but for flash and it's not stored in the regular temporary internet files directory so it typically isn't deleted. Most times it can survive the lifetime of a computer, baring a restore or reformat. And as I said, you can store any variables or params which you can use to alternate, change or manipulate data in the flash by reading and even rerwriting to it.

A good example of this was on my last flash project. I made a bandwidth tester and used a SO file to store the data for the users test. So if the user had a good highspeed connection, it rated their connection as High Bandwidth, wrote the SO file and stored the data saying they are HB then the flash suggested the High Bandwidth version. If they were Low Bandwidth, it stored the users data as LB then suggested the Low Bandwidth. When the user returned, it didn't retest because it saw the file was already present so it skips the test then recalls the stored data in it from the first test and sets that as the parameter for the return, suggesting the same bandwidth from their first visit.

Last edited by 3ncryptabl3_lick; 04-15-2008 at 05:07 AM..
3ncryptabl3_lick is online now  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with search form in the flash header Lex94 Graphic Design Forum 2 07-10-2006 08:48 AM
Refresh script thumbtak Coding Forum 1 11-24-2005 05:56 PM
Flash header aeon Graphic Design Forum 10 02-10-2004 10:42 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:01 AM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.