PDA

View Full Version : SharedObject in #localhost folder unavailable to projector


VidEng
07-10-2008, 06:08 AM
Hello,

I have an issue that is driving me insane. I have an SWF running in a webpage from a CD-based stunnix webserver. This SWF obtains the port that stunnix is using and writes it to a local SharedObject. The intent was to access this object from another SWF running inside a flash projector from the same CD so the projector knows the port and can thus insert it into URLS when it opens some documentation SWFs later.

Problem is, the sharedobject .sol file is placed in a folder named "#localhost", NOT in the one named "localhost" (note the presence of the hash in the first name). This renders the object unavailable to the SWF running inside the projector; if the object is moved to the localhost folder, then the projector can access it.

Is there a better way to get that port number to the projector? I'm at wits end here.

Thanks in advance!

xxneon
07-10-2008, 06:12 AM
did you try setting the localPath parameter??

var mySO = SharedObject.getLocal("test","/");

this has been asked like 4 times today .. hehe i'm just wondering if the issue is something to do with running the files from a cd.

VidEng
07-10-2008, 06:27 AM
Thanks for the reply. Yes, I did use the local path parameter "/". I think the trouble lies with the fact that the SWF creating the object is running via a local webserver (127.0.0.1 ) but the projector is a standalone.

I am hoping somebody has solved this in the past and chimes in...I've been all over the web looking for answers but this is such an obscure issue, I've had no luck.

VidEng
07-10-2008, 06:45 AM
I have just run a full test with a real CD and now the sharedobject .sol file is being created in a folder called "127.0.0.1".

The projectors still can't get to it, however.

xxneon
07-10-2008, 01:14 PM
i think the issue is when you run a projector from the main computer.. its considered like trying to access a shared object with two swfs that are on different domains .. it just simply cant be done..

i do have an idea however.. you make a very basic swf that loads in the shared object from the 127.0.0.1 location.. just stick in the same location as the swf that runs from the webserver.. this basic swf you want to load into a movieclip container of the projector.. it will just be a invisible movieclip that will load in so that you can aquire the shared object data.. in the basic swf.. you use Security.allowDomain("*"); this should allow any swf to communicate and retrieve / modify variables for that basic swf.. so at this point the projector should be able to retrieve the shared object data from the other swf.. that should be able to read it in.. i have a webserver setup on my pc i think i will try this to see if it works.. if so then this would solve the issue for you..

VidEng
07-11-2008, 01:38 AM
Hmmm... that might work, I'll try it next.

I did some smore experiments last night and they confirmed what you said - different domains (or sandboxes, if you will), even from the same CD = no access to the sharedobject.

I made a simple movie to read the sharedobject and if I called the SWF version from the web browser running on the local server (127.0.0.1) then of course it could pick up the sharedobject. I ran the same movie as a projector and it could not get the sharedobject.

Thanks,
-VidEng

VidEng
07-11-2008, 05:02 AM
Loading a "middleman" movie only works if it is loaded via the webserver, i.e., "http://127.0.0.1:9000/middleman.swf". Problem is, that syntax requires the port number to be known already, so I'm back to square one.

I wonder if there is a way for Flash to get the Apache environment variable SERVER_PORT directly? That would accomplish the task in one shot.

Or maybe a simple port scanner to start at port 9000 and work its way up until it finds the webserver?

Thanks!

VidEng
07-12-2008, 01:08 AM
Thought I'd wrap this up with the resolution, even though it's not a Flash solution:

The nice folks at Stunnix altered their webserver software to pass the server port as an argument to whatever launched applications the user sets.

I have the Stunnix server launching my flash file which is wrapped in a mProjector executable. mProjector has a "getArguments" method to pick up the value passed by Stunnix.

I highly recommend Stunnix for their great software package (Advanced Web Server) and willingness to solve problems for end-users. Also, kudos to the SceenTime guys for their mProjector and for helping out along the way via email.

-VidEng