# Cache buster button code question (CS4/AS2)

**URL:** <https://forum.kirupa.com/t/cache-buster-button-code-question-cs4-as2/326709>\
**Category:** flash\
**Created:** [January 6, 2012, 2:14pm UTC](https://forum.kirupa.com/t/cache-buster-button-code-question-cs4-as2/326709 "2012-01-06T14:14:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tina31](https://avatars.discourse-cdn.com/v4/letter/t/439d5e/32.png) [@Tina31](https://forum.kirupa.com/u/Tina31)\
**Post date:** [January 6, 2012, 2:14pm UTC](https://forum.kirupa.com/t/cache-buster-button-code-question-cs4-as2/326709/1 "2012-01-06T14:14:36Z")

</div>

I have a button that loads guestbook.swf. As guestbook would be updated by me I would like the latest non cached version of guestbook.swf to load always.

This is the current working code on the button-

> on (release) {

```
//load Movie Behavior
if(this.L == Number(this.frame)){
    loadMovieNum("guestbook.swf",this.frame);
} else {
    this.frame.loadMovie("guestbook.swf");
}
//End Behavior

```

}

I would like to do what this guy suggested-

[QUOTE=lewi-p;2581359]Using a random variable will work but it’s not exactly efficient. If you generate a random number everytime someone requests your SWF, your server will be sending a brand new version every single time…your bandwidth could potentially go through the roof!  
I would suggest using a date & time based cache buster string…so adding [COLOR=#ff0000]“movingly.swf?cache=20101028” (todays date).[/COLOR]\*\* [COLOR=#ff0000]So in this case everyone will get the same file that day.[/COLOR]\*\*  
lewi-p[/QUOTE]

I added his code like this to the button-

> on (release) {

```
//load Movie Behavior
if(this.L == Number(this.frame)){
    loadMovieNum("guestbook.swf**?cache=20101028" (todays date)**",this.frame);
} else {
    this.frame.loadMovie("guestbook.swf**?cache=20101028" (todays date)**");
}
//End Behavior

```

}

Well the button stopped working when I added that. How should the code look for it to work? Thanks :+)
