Log in

View Full Version : how to load an swf file inside itself



harsath24330
08-24-2007, 01:09 PM
hi friends please help me to load an swf file inside with it. it is for my site i will explain u my friend please don ignore my questions.....
my first swf file is my menu as header the next page should be my about us page as an .swf file likewise the third page for portfolio as other .wsf file similarly
for other two pages ...... so please help me my friends to do these things plzzzzzzzzz.

Medyman
08-24-2007, 01:52 PM
To just load another .swf into an existing Flash project (without a preloader):

1. Create a shape on the stage that is the same size as the .swf that you want to import. Turn it into a MC and give it an instance name (anything will do, i'll use menuHolder in this example).

2. Add the following actionscript to import your menu.swf into menuHolder


menuHolder.loadMovie("menu.swf")

Note: Make sure the registration point is in the upper left hand corner.

You could also use some of the other methods of the MovieClipLoader class (especially if you want a preloader).

HTH

evan
07-22-2008, 04:30 PM
As I sift through posts to solve a problem I though I might add a prudent question here:

Has anyone had a problem loading a swf into a swf -have it load ok, and then have the new swf display but "freezes"

I had it work the first time -what things would make it display and stop like that?

Medyman
07-22-2008, 05:19 PM
As I sift through posts to solve a problem I though I might add a prudent question here:

Has anyone had a problem loading a swf into a swf -have it load ok, and then have the new swf display but "freezes"

I had it work the first time -what things would make it display and stop like that?

Hmm...peculiar. Memory issue? or relative paths, perhaps?

evan
08-01-2008, 07:58 PM
I have messed around some more

the background is the fla and swf versions run fine by themselves

it's when I use a manging file to load it I get this:


TypeError: Error #1009: Cannot access a property or method of a null object reference.
at DEMO_BETA_5_fla::MainTimeline/DEMO_BETA_5_fla::frame1()


weird.
If I comment out the external class I use -the error is gone -but what's the point.
-any insight otherwise I'll find a workaround somehow.

Medyman
08-04-2008, 10:23 PM
That does indeed sound like a path issue. You have to keep in mind that references to _root and the main timeline within the embedded SWF change once you import it. Could that be the problem?

evan
08-05-2008, 07:17 PM
Thanks for checking back, but there aren't any _root refs there.

BTY , FYI
harsath24330:
This link might be usefull (http://www.flashloaded.com/flashcomponents/advancedloader/)
-if you want to control alot of swfs without coding it's a fun toy.(No I do not work for them -nor do I get anything for the link -but I should)