473,750 Members | 2,265 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A question regarding swfobject

mikek12004
200 New Member
Trying to build a flash rotator which takes some swf from a db and rotates them.
In the head I have
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.         clock_ads(1);
  3.         function clock_ads(i)
  4.         {
  5.             <?php
  6.             $q1=mysql_query("select * from banners");
  7.             $c1=mysql_num_rows($q1);
  8.             if ($c1>0) //got banners and ok to show
  9.             {
  10.                 $maxy=0;
  11.                 //check if only one entry
  12.                 for ($j=1;$j<=$c1;$j++)
  13.                 {
  14.                     $q2=mysql_query("select * from banners where banorder='$j'");
  15.                     $r2=mysql_fetch_array($q2);
  16.                     $file="banners/".$r2[1];
  17.                     $size=getimagesize($file);
  18.                     if ($size[1]>$maxy) $maxy=$size[1];
  19.                     $life=$r2[3];
  20.                     if ($j==1) echo "if"; else echo "else if";
  21.                     ?>
  22.                     (i=='<?php echo $j;?>')
  23.                     {
  24.                         //check to see how we will display the ad based on the type (flash or image) 
  25.  
  26.                         if ( ("<?php echo $r2[1];?>".search(/.swf/i))>0 )
  27.                         {
  28.  
  29.                             swfobject.embedSWF("<?php echo $file;?>", "myContent", "<?php echo $size[0];?>", "<?php echo $size[1];?>", "9.0.0");
  30.  
  31.                         }
  32.                         else
  33.                         {
  34.  
  35.                             document.getElementById("myContent").innerHTML="<img border='0' src='<?php echo $file;?>' />";
  36.  
  37.                         }
  38.                         if (<?php echo $c1?>!='1')
  39.                             setTimeout("clock_ads(<?php echo $j+1;?>)",<?php echo $life;?>);    
  40.                     }
  41.                     <?php    
  42.                 }
  43.             }//if ($c1>0) //got banners and ok to show
  44.             ?>
  45.             if (i><?php echo $c1;?>) clock_ads(1);
  46.         }
  47.         </script>    
  48.  
and in the body a
Expand|Select|Wrap|Line Numbers
  1. <div id="myContent">
  2.                                                             <h2><?php echo GET_FLASH;?></h2>
  3.                                                             <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
  4.                                                             </div> 
  5.  
when I have only swf it works ok but when I also use images I get an error that
mycontent is null meaning that it cannot find the div, as I see it the
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("myContent").innerHTML="<img border='0' src='<?php echo $file;?>' />";
  2.  
is for some reason relating to the swf wrong logic any help?

PS Even when I moved the script below the div in the body the image was shown once and only when it was shown before a swf after that it was simply ignored and the page showed only the swfs
Oct 15 '09 #1
2 1775
mikek12004
200 New Member
a bit of further explanation about the code, all it does is to generate a javascript to do the job e.g. an image ELNAVI.jpg and after that 2 swf we have this

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.         clock_ads(1);
  3.         function clock_ads(i)
  4.         {
  5.             if    (i=='1')
  6.             {
  7.                 //check to see how we will display the ad based on the type (flash or image)     
  8.                 if ( ("ELNAVI.jpg".search(/.swf/i))>0 )
  9.                 {
  10.                     swfobject.embedSWF("banners/ELNAVI.jpg", "myContent", "160", "37", "9.0.0");
  11.                 }
  12.                 else
  13.                 {
  14.                     document.getElementById("myContent").innerHTML="<img border='0' src='banners/ELNAVI.jpg' />'";
  15.                 }
  16.                 if (3!='1')
  17.                     setTimeout("clock_ads(2)",8000);    
  18.             }
  19.             else if    (i=='2')
  20.             {
  21.             //check to see how we will display the ad based on the type (flash or image) 
  22.                 if ( ("gmlogoA.swf".search(/.swf/i))>0 )
  23.                 {
  24.                     swfobject.embedSWF("banners/gmlogoA.swf", "myContent", "779", "136", "9.0.0");
  25.                 }
  26.                 else
  27.                  {
  28.                     document.getElementById("myContent").innerHTML="<img border='0' src='banners/gmlogoA.swf' />'";
  29.                 }
  30.                 if (3!='1')
  31.                     setTimeout("clock_ads(3)",5000);    
  32.                 }
  33.                 else if    (i=='3')
  34.                 {
  35.                     //check to see how we will display the ad based on the type (flash or image) 
  36.                     if ( ("alba468x60msc150609.swf".search(/.swf/i))>0 )
  37.                     {
  38.                         swfobject.embedSWF("banners/alba468x60msc150609.swf", "myContent", "468", "60", "9.0.0");
  39.                     }
  40.                     else
  41.                     {    
  42.                         document.getElementById("myContent").innerHTML="<img border='0' src='banners/alba468x60msc150609.swf' />'";    
  43.                     }
  44.                     if (3!='1')
  45.                         setTimeout("clock_ads(4)",5000);    
  46.                 }
  47.                 if (i>3) clock_ads(1);
  48.             }
  49. </script>  
Oct 16 '09 #2
acoder
16,027 Recognized Expert Moderator MVP
See line 14:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("myContent").innerHTML="<img border='0' src='banners/ELNAVI.jpg' />'"
You have an extraneous ' (single quote).
Oct 24 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1819
by: Francis Lavoie | last post by:
Hello I have some questions regarding webframework, I must say that I quite lost and these questions are basicly to help me understand the way it work. I have some knowledge with PHP and JSP. I have looked for a python web framework to build a web site, a site that I had start in php (and quite finish), but for some reason I wont explain, I lost everything. I have started writting app with python 6
8
5260
by: Mike | last post by:
Hello, I have a few rather urgent questions that I hope someone can help with (I need to figure this out prior to a meeting tomorrow.) First, a bit of background: The company I work for is developing a web-based application, one part of which involves allowing the user the ability to page through transaction "history" information. The _summary_ history table will have the following fields: ServiceName, Date, User-Ref1, User-Ref2,...
1
2724
by: dragze | last post by:
Hi, On one of the pages of my site i use two javascripts, one makes transparency of png's work in IE, and the other embeds a flash player. Now use one of the scripts it works fine, use both and the transparency script stops working. So for example, use just the png transparency script and it displays the png's correctly in IE, as soon as i add the SWFobject (flash embedding) script the transparency script stops working!!?? :S Any help...
3
1613
by: K. | last post by:
Hello! I have a problem with javascript script called: SWFObject. I have a web page which displays on IE 7.0. i Firefox in a good way. All flash objects are displayed on a web page. The problem is on IE 6.0. I have i.e. 9 flash swf objects, but only 6 of them are displayed. I don`t know why. I think it is not my fault as a code programmer.
49
5964
anfetienne
by: anfetienne | last post by:
is it possible to add php array to vars in the swfobject code?
3
3144
by: yogarajan | last post by:
hi friend this is my code <script type="text/javascript"> // <!]> </script> it is working fine for (open file) file:///D:/WebSite4/swfobject/swfobject1-5/fullpage.html
0
1697
by: jay11 | last post by:
Hello peeps I am trying to run a banner with SWFObject from within PHP/Mambo. I have two others SWF in the same page, so I know it works. Also checked the Developer tool in Chrome and saw that the .js file was loaded. Clicked the link of the SWF I want to see displayed and it runs in another window. Also if I call it via localhost ..../x.swf it works. It just DOESN'T work when called from within PHP. Here is the code I am using. If any...
0
1930
by: jeddiki | last post by:
I am reading up on this swfobject which uses javascript to embed the swf files. They say that I need to have adobe flash player 9.0 Well I was going to use Flowplayer. Does this mean that if I use swfobject then I can not use Flowplayer? Or am I getting mixed up ?
0
9000
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9577
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9339
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6804
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3322
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2804
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2225
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.