# Loading SWF

**URL:** <https://forum.kirupa.com/t/loading-swf/261208>\
**Category:** Uncategorized\
**Created:** [May 24, 2008, 8:54am UTC](https://forum.kirupa.com/t/loading-swf/261208 "2008-05-24T08:54:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kerepuki](https://avatars.discourse-cdn.com/v4/letter/k/df705f/32.png) [@kerepuki](https://forum.kirupa.com/u/kerepuki)\
**Post date:** [May 24, 2008, 8:54am UTC](https://forum.kirupa.com/t/loading-swf/261208/1 "2008-05-24T08:54:02Z")

</div>

Heyall!

Hopefully this is a quick one.

I am trying to load multiple swf files in a div element on an HTML page. What I mean by this is I have a “gallery” type page where users can click on the work and see the results.

The div that displays the work is a sliding div that shows the selected work when a user clicks it and hides the work, returning to the “gallery” ready to select another piece.

Button 1: View Work  
Button 2: Work 1  
Button 3: Work 2

Button 1 will unload any work items currently loaded. Button 2 and Button 3 will load the selected piece into the div.

Any ideas?

---

<div class="post-metadata">

**Author:** ![djheru](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/djheru/32/3190_2.png) [@djheru](https://forum.kirupa.com/u/djheru)\
**Post date:** [May 24, 2008, 1:20pm UTC](https://forum.kirupa.com/t/loading-swf/261208/2 "2008-05-24T13:20:09Z")

</div>

I would load the multiple swfs into a container swf and then do the animation in actionscript.

---

<div class="post-metadata">

**Author:** ![kerepuki](https://avatars.discourse-cdn.com/v4/letter/k/df705f/32.png) [@kerepuki](https://forum.kirupa.com/u/kerepuki)\
**Post date:** [May 25, 2008, 8:48am UTC](https://forum.kirupa.com/t/loading-swf/261208/3 "2008-05-25T08:48:00Z")

</div>

That was one option but not really acceptable as I will eventually be building the page through ajax and MySQL.

I figured out a method:

\<script language=“javascript”\>

function loadFlash(file){

var so = new SWFObject(file, “myFlashFile”, “800”, “600”, “1”, “#ffffff”);  
so.addParam(“wmode”, “transparent”);  
so.write(“flashcontent”);

}

\</script\>

and then have a div with the id “flashcontent” and any ‘a’ element to have onClick=“javascript:loadFlash(’\_swf/test\_outter.swf’);”

This doesnt unload any flash but does load the new content.

Hope this helps someone.
