LebGeeks

A community for technology geeks in Lebanon.

You are not logged in.

#1 June 8 2010

Kassem
Member

Caching an SWF Across Website Pages

Hey guys,

I am building a website in which I'm using a Flash swf for the navigation and a Flash banner (requirement by the client). Those 2 swf's will be shared on all pages. Is there a way to make so that when navigating from page to another the swf wouldn't be loaded again?

Offline

#2 June 8 2010

arithma
Member

Re: Caching an SWF Across Website Pages

If it's small enough, it will be seamless.

Offline

#3 June 8 2010

Kassem
Member

Re: Caching an SWF Across Website Pages

The Flash banner loads the images from an XML file. The swf is extremely small itself but  I'm afraid it might load the images over and over again. Have you tried it before?

Offline

#4 June 8 2010

mrmat
Member

Re: Caching an SWF Across Website Pages

Can cookies be set from flash? If yes just store the index of the current image in a cookie and read it back.

Offline

#5 June 8 2010

Kassem
Member

Re: Caching an SWF Across Website Pages

No not really, Flash does not allow creating cookies and this kinda stuff. I do not want to store the image, I want to store the whole swf so it wouldn't be loaded whenever the user navigates from page to another.

Offline

#6 June 8 2010

hussam
Member

Re: Caching an SWF Across Website Pages

won't it be read from the user's browser cache on next page?

Offline

#7 June 8 2010

mrmat
Member

Re: Caching an SWF Across Website Pages

Although you might be able to store flash cookies/share object http://www.tutorialized.com/view/tutori … ookie/4092, this is not what i meant. What you can do is get access to the browser's cookies through flash using javascript. I think this would help http://www.permadi.com/tutorial/flashCookie/index.html

I do not want to store the image, I want to store the whole swf so it wouldn't be loaded whenever the user navigates from page to another.

You don't store the image data, but its child index in the xml file, and once the flash object is loaded check the cookie for a value and load the image "using its index" accordingly.  As for storing the swf with its current state, i don't think its possible.

Last edited by mrmat (June 8 2010)

Offline

#8 June 8 2010

Ayman
Member

Re: Caching an SWF Across Website Pages

Hey guys,

I am building a website in which I'm using a Flash swf for the navigation and a Flash banner (requirement by the client). Those 2 swf's will be shared on all pages. Is there a way to make so that when navigating from page to another the swf wouldn't be loaded again?

Why bother having the navigation in flash in the first place anyways? If the client doesn't care wether the navigation is flash or not, just do it in HTML and CSS. :)

Last edited by Ayman (June 8 2010)

Offline

#9 June 8 2010

arithma
Member

Re: Caching an SWF Across Website Pages

Though I agree with Ayman, however for academics this is what happens:
A plug in uses the browser for access to assets. It asks for the swf. The swf asks the browser for the xml. The swf asks the browser for the rest of the files (images).
The second time the page runs, everything is fetched back from the cache (given you're using method GET not POST, which is the default behavior).

Offline

#10 June 8 2010

Kassem
Member

Re: Caching an SWF Across Website Pages

Actually, I do not care whether the client wants the navigation in HTML/CSS or Flash, I'll just do it in HTML (that makes much more sense). I'm totally against hybrid websites (unless you use Flash for showing contents only inside the HTML site - no interaction). And thanks to arithma's post, now things are clear and I guess it won't cause any trouble.

Thanks for the help guys, appreciated!

Offline

#11 June 8 2010

Ayman
Member

Re: Caching an SWF Across Website Pages

I'm totally against hybrid websites(unless you use Flash for showing contents only inside the HTML site - no interaction)

Same here :)

Offline

Board footer