Skip to main content
June 1, 2009
Answered

Load local swf file by flash

  • June 1, 2009
  • 2 replies
  • 3614 views

dear my friends

I have a big problem with as3. I have two .swf file : 1- Index.swf and 2-page1.swf. Index file has one frame with the following action :

var loader_mc:Loader =new Loader();

addChild( loader_mc );// Add the loader to the display list
loader_mc.load( "d:\\page1.swf"));// Load the file

I upload Index file in my site and it can't load page1.swf.

Please help me.

Best regards

This topic has been closed for replies.
Correct answer

How can I have this swf on my machine and use the URL to access it? that is so important for me. the reason that I want to do it is that per my swf file is 10MB and I want to give an install file to my users to install the swf files on their system. now they can read the locad files fast. but if I host the swf files on server they can reas them so slowly.

Best regards

Hanif


For that you will have to have some web server if you are using Windows you might have IIS or you can choose free one like Apache

You will start the webserver and place the swf file on to wwwroot directory then you will be able to access it using

http://<your IP address>/page1.swf

2 replies

June 1, 2009

Use following code:

var loader_mc:Loader =new Loader();

addChild( loader_mc );// Add the loader to the display list
loader_mc.load( "page1.swf"));// Load the file

Keep this in mind that you will have to upload the other swf in the same folder where your index file is.

June 1, 2009

Dear my friend

I konw that. but I am trying to load local swf to flash. I don't want to upload page1.swf in the server. I want to upload Index.swf to server and keeo page1.swf in my hard drive.(d:). how can O do that?

Best regards

Hanif

June 1, 2009

That is not exactly possible with flash due to security restrictions.

But what you can do is host this swf on some server and access it or you can also have this swf hosted on your machine.

and use the URL to access it.

In this case your application to work properly, you might need a crossdomain  policy file.

June 1, 2009

At first when you are loading a swf why you are using absolute path?

because once you upload the swf file to server its path gets changed...

in URL request give the relative path if your swf is ion the same folder then just use the name of swf file which you want to load.

also upload the swf you want to load along with your original swf.