Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Load local swf file by flash

Guest
Jun 01, 2009 Jun 01, 2009

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

TOPICS
ActionScript
3.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Jun 01, 2009 Jun 01, 2009

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

Translate
Guest
Jun 01, 2009 Jun 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009

But whatever you have asked for can be done by keeping the files on the same server why you specifically asked for it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009

Dear SwapnilVJ

Thanks alot

that works good in localhost. I have to host the files on the user's system beacause of the size of the files.

Best regards

Hanif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009

I have one problem

when I tried to load page1.swf from localhost the following eeror apear :

*** Security Sandbox Violation ***
SecurityDomain 'http://localhost/icdl/030101.swf' tried to access incompatible context 'file:///C|/Documents%20and%20Settings/farahnak/Desktop/Local/Index.swf'
SecurityError: Error #2047: Security sandbox violation: parent: http://localhost/icdl/030101.swf cannot access file:///C|/Documents%20and%20Settings/farahnak/Desktop/Local/Index.swf.
    at flash.display::DisplayObject/get parent()
    at 030101_fla::MainTimeline/frame1()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009

You will need a cross domain policy file.

See following link for more details:

http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 01, 2009 Jun 01, 2009
LATEST

Dear SwapnilVJ

I can't understand. I attached a zip file for you. please extract it. then copy test.fla in your desktop and copy 030101.swf in wwwroot. then try to load 030101.swf file. I don't know what can I do. Please do it for me. that is so important for me.

Best regards

Hanif

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines