Dealing with Flash Modules in SharePoint

flash sharepoint 2010There are a number of problems adding flash to SharePoint 2010. A few issues and resolutions follow:

ErrorPROBLEM: Flash files won’t open from a document library

  • What’s actually happening here is that SharePoint adds special headers to disallow applications and scripts from being run in the browser.
  • This is a security measure to keep users from uploading dangerous content.
  • The user gets prompted to download the file instead.

Tick SOLUTION:

ErrorPROBLEM: I can’t access swf files from the 14 hive!

  • I can’t tell you what’s actually happening here. The “14 hive” (12 hive, in SP2007) is found at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14. It is a local file that sharepoint has access to. It contains:
  • Occasionally the swf files will not load when pulled from the hive. Not sure why this happens.

TickSOLUTION:

  • Load the web part and user control with file handling set to permissive (see the problem above).
  • Verify it works.
  • Set browser handling back to strict.

ErrorPROBLEM: I’m using a Flash module with a menu. I can load the first page, but the menu links don’t work!

  • If your menu page and content pages are seperate modules, this may happen.
  • I ran into a similar problem with a rather large module made of linked flash files. To get every file in the project (all 126 of them) and have them transfer properly to the hive seemed like it was the issue, although I have yet to verify this.

TickSOLUTION:

  • In order to get the entire module to work, every swf file has to be present.
  • Each of them must be in the same document library.
  • If you create a page outside of that document library, you have to make sure you have some kind of reference to each seperate swf, or the menu won’t work:
  • The menu doesn’t work because the links in the flash are relational to the web part page address. In other words:
    • If you put the swf files in a document library called “Flash” and the web part page in a document library called “Pages” the menu page will load if the user control is hard coded to that address:  “…SP2010/Flash/main.swf”
    • However, if the page updates, you may end up looking for the non-existant “…SP2010/Pages/SecondFlashFile.swf.”
    • This is because the code in the swf has no way to access the code in the user control. It can, however, grab the current url, which is the address for the web part page.
  • In short, if you want it to work, everything has to be in the same document library – all the swf files and the web part page.

ErrorPROBLEM: My start page loads, the menu works, but not every swf works!

  • If you set file handling to permissive, uploaded your files and loaded your user control, then set file handling back to strict this will happen.
  • Since strict file handling prompts the user to download a file, sometimes the module will run into the same problem – has to “download the file.”

TickSOLUTION:

  • The most secure option (still not terribly secure) is to make a MIME type exception (allow a single type of file through). You can follow the link above.

IN SUMMATION: Flash pretty much just needs to all be in the same place (14 hive or document library) with file handling set to “Permissive.” Although this does pose a certain security issue, Moss 2007 didn’t add headers to media content, and un-trustable users probably shouldn’t have upload permissions anyway.

Related posts: