December 5, 200718 yr Being relatively new to dynamic sites, I am developing a site using ASP and a MS SQL database. I have managed to load images from a database field to show the images related to the particular records. My problem is that I also need to load a Flash SWF that is also unique to each record. So for example if record1 has image1 and Flash1.swf, as the user moves through the record set, is it possible to load record2, image2, and Flash2.swf record3, image3, and Flash3.swf record4, image4, and Flash4.swf etc Loading the record data and image is okay since I can simply bind the image to the field 'img.src', but you don't get this option with a flash SWF. Does anyone know how I would go about loading the individual swf's dynamically? TIA, Ken
December 5, 200718 yr Ahhh a good question... It's going to need a bit of tinkering with, as there may not be universal 'all browser' ways of doing it. One way is to use InnerHTML and Divs, but if you are already quite happy about hacking around with changing images, consider using 'swfobject', which will also easily solve a lot of other problems too, such as escaping the dreaded 'activate flash now' problem quite elegantly. see: http://blog.deconcept.com/swfobject/
December 5, 200718 yr Author Hi Seige, Thanks for the reply, I am now living in Oz, having moved from the UK last Nov, so I will give this a shot in the morning as it definitely too late to start trying to understand this!!! Thanks again, Ken
December 7, 200718 yr Author Hi, Okay, I have now slept on it (several times) and I have managed to progress a little with this problem using SWFObject, but I am still struggling with the code logic; <div id="flashcontent"> My Flash file loaded here </div> <script type="text/javascript"> var swflocation = "slideshows/" + <%=(rsCurrentProject.Fields.Item("slideshow").Value)%>; var so = new SWFObject(swflocation, "mymovie", "500", "440", "8", "#336699"); so.write("flashcontent"); </script> My problem now is that when you try and add a new 'dynamic text' server behavior to the page, to load in the field variable for the swf name; <%=(rsCurrentProject.Fields.Item("slideshow").Value)%> It doesn't recognize it because it is 'inside' the <script> .... </script> tags - I think the problem here is how to pass in the value of the field "slideshow" when you declare the value of the variable 'swflocation' it is only relative to the code within the script tags, does anyone know of anyway of making the variable global, so that it can be declared outside of the script tags? TIA, Ken
December 7, 200718 yr Author Hi, Okay a bit of progress... It would seem the earlier code was working, but for some reason not loading the movie. When I load the page now using the following code; <script type="text/javascript" src="swfobject.js"></script> <div id="flashcontent"> This text is replaced by the Flash movie. </div> <script type="text/javascript"> var swflocation = <%=(rsCurrentProject.Fields.Item("slideshow").Value)%>; var so = new SWFObject(swflocation, "mymovie", "500", "440", "8", "#336699"); so.write("flashcontent"); </script> If I then view the source code with Firefox, I see the following; <script type="text/javascript"> var swflocation = noosa.swf; var so = new SWFObject(swflocation, "mymovie", "500", "440", "8", "#336699"); so.write("flashcontent"); </script> So it is picking up the value of the dynamic field okay, but I am obviously missing a trick some where, because even though the correct value of the movie, in this instance "noosa.swf" is being picked up for the variable "swflocation" all I see in the browser is the text "This text is replaced by the Flash movie." So its not actually loading the movie. So I then try and use an absolute path to ensure I am loading the right movie, I used; <script type="text/javascript"> var so = new SWFObject("noosa.swf", "mymovie", "500", "440", "8", "#336699"); so.write("flashcontent"); </script> I made sure the flash movie & the file swfobject.js are both in the same location as the page being loaded, but I still only see the text. So what is the usual cause for a flash movie not loading? I have re-saved the movies as version Flash 8 as this is the version number have been using in the script. I have also tried to save the movie as Flash 9 and set the script to version 9, but now all I see is the text line? Jeez, this is driving me crazy.... TIA, Ken
December 7, 200718 yr Just to check... you ARE putting the call to swfobject.js in the HEAD section of the page? And the rest in the BODY section? What you have there should work fine!
December 7, 200718 yr Author Hi, I would still very much like to get the SWFObject working as it seems a very neat solution to a sticky problem, but in the meantime this seems to have solved my problem. I used the following code and its working; <embed src="<%=(rsCurrentProject.Fields.Item("slideshow").Value)%>" loop="false" menu="false" quality="auto high" bgcolor="#ffffff" width="500" height="440" name="send2flash" align="middle" flashvars="<%=(rsCurrentProject.Fields.Item("slideshow").Value)%>" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> Thanks for your help, if you have any other suggestions as to why SWFObject wouldn't load the movies I would love to hear them. Ken
Create an account or sign in to comment