Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > Adobe Web Programming > Dreamweaver (all versions)
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 9th, 2004, 10:45 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default About loading a flash file once in a web page

I use Dreamweaver to construct my pages.
I have a normal index.asp web page which is the home page of my site.
I would like to know if there is any way- without renaming my index.asp page- to load a flash(swf) over this page, only once.

This could be done either before loading the index page, or when it finishes the loading of index page. I am satisfied with both cases, so we can choose to apply the easiest one.

It is important to say that I want the flash to be displayed only once: when the index page loads for the first time, not when it loads in general. This is essential because I just want to display a flash as an intro but I found it silly to be displayed when someone has to return through navigation to the index page.

Is there any way to suggest me doing this flash loading in Dreamweaver only once?
Reply With Quote
  #2 (permalink)  
Old October 9th, 2004, 11:23 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Probably the easiest way to do this is to use cookies:
Code:
<%
If Request.Cookies("FlashLoaded") <> "TRUE" Then
  ' Use Response.Write to send the <object> tag for the movie
  Response.Cookies("FlashLoaded") = "TRUE"
End If
%>
This code will see if there is a cookie called FlashLoaded with a value of True. If that's not the case, the <object> tag is written out.

Once the cookie has been set, the movie won't be loaded during the user's visit. Because the cookie has no expiry date, it gets deleted when you close the browse. Set the Expiry property of the cookie to any date in the future if you want to make it stick between browser sessions.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old October 10th, 2004, 12:01 PM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In order to test it, in addition to the code you wrote above, can you please give me the code of telling the page the filename of the flash file to load, only once?


Reply With Quote
  #4 (permalink)  
Old October 10th, 2004, 12:36 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

What do you mean with " telling the page the filename of the flash file to load"?

AFAICS, all you need is the original code for the Flash Animation, just as you would normally add it in a page. Either use Response.Write to write out that block of HTML code, or simply copy the HTML inside the If statement.

Or am I missing something here?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old October 11th, 2004, 12:41 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="115" height="70">
                <param name="movie" value="flash.swf">
                <param name="quality" value="high">
                <embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="115" height="70"></embed>
              </object>

Here is the code of flash object.
How does it fits in the above code either with response write or html code?

What is the whole code combined?

Reply With Quote
  #6 (permalink)  
Old October 11th, 2004, 01:16 AM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

If you use direct HTML, it can be as easy as this:

<%
If Request.Cookies("FlashLoaded") <> "TRUE" Then
%>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="115" height="70">
                <param name="movie" value="flash.swf">
                <param name="quality" value="high">
                <embed src="flash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="115" height="70"></embed>
              </object>
<%
End If
%>

I simply closed the ASP block before the HTML object tag, and reopened it again after the closing object tag.

Alternatively, you can do something like this:

<%
If Request.Cookies("FlashLoaded") <> "TRUE" Then
  Response.Write("<object classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"")
  Response.Write(rest of the html goes here)
End If
%>

This may be a tiny bit faster as there is no need to switch between ASP and HTML processing, but I wonder wether you'll even notice it.
The second method also allows you a bit more control over the actual object tag.
You could, for instance, make the Flash movie twice as big on Mondays and Wednesdays, if that's what you want..... ;)

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #7 (permalink)  
Old October 11th, 2004, 01:51 AM
Authorized User
 
Join Date: Nov 2003
Location: , , .
Posts: 85
Thanks: 0
Thanked 0 Times in 0 Posts
Default


So, i tested the first part of the code you wrote(direct html).
Two problems:

- Most important: the flash is always displayed! Not only once!. I navigate through the site, then I return to the page and the flash is there again.

- Second problem: positioning. Now it is displayed in the top of the page(awful). Can I set it to display over the page, something like a layer? If this is not possible, can we set it to be displayed before the appeating of any other element in the page? First display the flash, after the finish of flash(and dissapearing) display the whole page?
Reply With Quote
  #8 (permalink)  
Old October 11th, 2004, 01:30 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Did you include the line that sets the cookie with the Response.Cookies statement I showed you in an earlier post? You need that, otherwise the cookie won't be set, and the code will always display the Flash animation.

And where did you place the If statement? Since you're directly outputting the code for the Flash animation (either with Response.Write or with HTML), the Flash animation appears at the location of the code.

So, simply move the code to the location where you want the banner, and everything should be fine.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
flash movie not loading smys123 Flash (all versions) 1 July 17th, 2007 06:39 PM
Flash movie not loading smys123 XSLT 2 June 13th, 2007 02:23 PM
page have a flash file alyeng2000 HTML Code Clinic 2 April 19th, 2005 08:44 AM



All times are GMT -4. The time now is 01:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.