0
that.preloadQueue.loadManifest([
  { id: 'ball', src: '/swf/ball.swf' },
]); 

Then I use swfobject and just use the normal filepath of '/swf/ball.swf'. Currently it does not preload, but instead reloads each time.

How should I change it?

Kirk Strobeck
  • 17,984
  • 20
  • 75
  • 114

1 Answers1

1

There is no SWF-based preloading available for PreloadJS. If the file extension is not recognized, the file will be loaded as plain text via XHR, and will therefore not be stored in the browser cache. When the Embed/Object is created in HTML, it will need to load it again from scratch, so the preload is just overhead.

In order to support SWF loading, a "SWFLoader" plugin would have to be created which properly loads the SWF using SWFObject or something similar. Due to the lack of Flash on the web these days, I don't think official support will ever be added to PreloadJS, unless there is overwhelming requests for it. Feel free to log a request on GitHub.

[edit: Looks like you filed a request already]

Lanny
  • 11,244
  • 1
  • 22
  • 30
  • Dang! I see solutions for it around the web, wishing this had it since its trying to be **the standard** – Kirk Strobeck May 17 '16 at 20:43
  • The main issue with SWF preloading is that it is not super straightforward with all the different versions of the Flash player, and it is likely overkill to bundle SWFObject into the PreloadJS source. Maybe the plugin could be separate from the main source, similar to the FlashAudioPlugin in SoundJS... – Lanny May 17 '16 at 20:50
  • Anything to solve the problem -- i went with preloadjs because i was confident that it would tackle any preloading, but feeling like i shoulnt have adapted my code to it and brought the lib in if it will only hande *some* preloading, and still need to double check if its even handing other items – Kirk Strobeck May 17 '16 at 20:53
  • Understandable. PreloadJS does handle most common content. But some special cases have been difficult, such as fonts (there has been a Git branch for it for some time, hopefully it will get integrated soon), and we are always trying to be aware of filesize. Including the JSON library was tough, since it is so big, but it was a super common use case. Even with SWF support, I am sure there are other things not supported, though we are always looking for a good reason to add a feature or format. – Lanny May 17 '16 at 22:44