Reputation: 447
Our client communicates with a Rails backend to get login details and then logs into an Adobe LCCS server. We have been cruising right along but around noon yesterday we developed a bug that causes the swf to not render until you refresh the page. On subsequent refreshes it pops up right away. The problem happened even when I disabled the code that checks in with the Rails server.
How could refreshing make a difference?
Upvotes: 1
Views: 316
Reputation: 32247
It sounds like your users visit your page and the swf starts playing before it's fully downloaded and stops once it hits the last loaded frame and doesn't continue to play even when the swf is done loading.
When the user refreshes, the swf has been cached and they load the version they should have been seeing before.
An easy way to fix this is to put a stop()
action on the first frame and then add a Event.PROGRESS
listener to the main stage's loaderInfo
object. When the events bytesLoaded
match your bytesTotal
then your swf is fully loaded and you can play()
your swf at that point (or gotoAndPlay()
.
Example takes place on the first frame of your project:
function loadProgressHandler(event:Event):void {
if(event.bytesLoaded >= event.bytesTotal) {
event.target.removeEventListener(Event.PROGRESS, this.loadProgressHandler);
play();
}
}
this.stop();
this.loaderInfo.addEventListener(Event.PROGRESS, this.loadProgressHandler);
Upvotes: 1