PDA

View Full Version : Preloading external swf help!!


shwoll
04-05-2005, 11:25 PM
Ok im having a problem PREloading external swfs from an EXTERNAL site.....is it possible?

i cant seem to getBytesTotal....of the external movie...
the script isnt the problem because if i run the swf that loads the external one on my local drive it works perfect....but if i load it from my webserver it doesnt....any suggestions? thanks!!

jamiehill
04-05-2005, 11:37 PM
Have to provide some more info I'm afraid. Any AS you can show?

SCook
04-05-2005, 11:49 PM
The probelm is possibly due to the streaming of the data over the wide connection,and you're not getting the file info. What would be a good idea to try, is create a small PHP script that reads the file on the remote server and returns to FLASH the file size.

You can then use geBytesLoaded and compare that with the filesize that was initially brought in. Maybe that will circumvent your problem.

Flash Gordon
04-06-2005, 12:21 AM
the external site needs to ALLOW access to your site. it is done with a certain file uploaded to the server. It is a securty precausion.

shwoll
04-06-2005, 01:03 AM
thanks everyone

flash jordon: I was wondering whether is that is still true if i can still load the file even though it doesnt preload correctly? itll load the external swf ... it just wont send me the getbytes....

Flash Gordon
04-06-2005, 01:11 AM
if it loads correctly then yes, I suppose you already have access. I don't know why you can't the bytes then.

shwoll
04-06-2005, 01:11 AM
also....use of _root or any of the like in the external movie when loaded into the caller swf does not work...i dont know if that helps...but if i load it into a movie clip and in the external swf it have _root or _parent calls they dont coorespond to the caller swf...

everything works if i run the caller from my computer..but not from my webserver...any comments?

SCook
04-06-2005, 02:11 AM
Hmmmm, well, I still think it could be a aremote file system thing. Two possible things you could do:

First, do as I suggested and acquire the file's size beforehand with php (or whatever server-side language you use).

Second, try loading the ext. swf off-stage while something else is going on. That way, once you have it completely loaded, you can then move it into position and it will appear to the user to be instanly available.

This only works if this isn't some linear process. Load the swf early in the app, before it's needed. It's not the best solution, but one that could solve some issues.

I do know that flash uses the calling swf as the root in a file system. For example, let's say you've got two swf's. First, main.swf, your main calling swf. It sits on the root directory of your server. Next you've got products.swf, which sits in the /products folder on your server. You have to referenace anything loaded, like pics, in the products.swf as products/image.jpg. Because even though you'r loading a pic from the products.swf, it's being run from the main.swf which it was imported into.

:-) I hope that made sense....it looks kind of wierd from here lol.