I'm a little rusty with Flash, have not done anything for about a year.
I have a probably simple question about shared objects:
If I have a flash movie hosted on domain A, which drops a shared object, can I read that shared object from a movie hosted on domain A but embedded in a page on site B?
Essentially I want to track users across a small number of related sites, and I thought I could do this with a single flash movie embedded in the various domains' pages. It would then read/write shared object data and transmit that to a central server.
I have access to all domains so could add in cross-domain xml files if required
The sharedObject is stored on the end users computer so cross-domain wont come into it.
I did a quick test myself and from what i can see it can't be done.
As I understand it sharedobjects are stored on the users machine... solreader I think you might be looking for session variables, I believe you would need to talk to backend for that.
I obviously did not make it clear - I am definitely looking at shared objects.
Lets say I have domains A, B, C, D, E
I have a flash movie hosted on, and database running on A
When a visitor goes to site B, the flash movie hosted on A is embedded in a page on B, and writes an identifying shared object.
When the visitor goes to site C, the flash movie is hosted on A but now served embedded in a page on C, the shared object is read, the information returned to site A via POST.
When the visitor goes to site D, the flash movie is hosted on A but now served embedded in a page on D, the shared object is read, the information returned to site A via POST.
etc etc
Can this scenario work?
I think the only way your going to know if this is going to work or not is to go try. If you are posting from server B,C,D,E to A then you will need a crossdomain policy file on A allow those other domains access.
Yes, I guess I will try.
I am pretty sure I should not need a crossdomain.xml if the flash movie is posting back to its own domain.. but I'll give it a whirl.
You can't even load the Movie from A without one. You may also need to look into the cross-scripting allowances in addition to cross-domain policies.
But really, it all depends on who is actually asking to access the Shared Object. B is not going to be able to access A's SO. A has to ask for it, but each .swf has it's own domain identifier (not sure how it works or why but it does) so A always knows it came from A even though its being accessed on B.
Really this is one confusing subject and you're going to have to run your own tests to find out for sure.
----- ok wait.....I read it again..... I think you confused everyone by not specifiying Flash v HTML on the domains. B, C, D, and E are only HTML pages loading an .SWF? There is no SWF calling an SWF from A?
You will still need a cross-domain policy for sure, but A should be able to read it's own SO because it does have it's own domain identifier. I can't guarantee it but it should work.
this thread makes my brain hurt... there also seems to be confusion on crossdomain.xml. That isn't needed to POST to a server. It's to allow the movie from A to be called and accessed by a foreign domain. A gets asked to be accessed, A says "server can I go?" and looks for the CD file, it states what domains can call it and if allowed then A can be accessed. Sending data back is something completely different. If a B SWF (but I'm not sure that's what we're talking about because scud only said 'pages') wants to send data to A for A to post then you get into cross-scripting......allowDomainAccess or whatever it's called.
The other thing you didn't specify though scud is are you trying to have someone get the exact same information from one SO if they visit different domains? If they visit C and you save info (window position lets say) then when they go to the D site, are you trying to read that exact information? I doubt that's going to work.
one confusing thread......and I know I didn't explain all my thoughts well either.
Its not reliable to assume that if it works today it will in the future I don't think this is a good idea to even try, I think you should be looking at cookies.
It is intended to be in addition to cookies - but cookies suffer from the same issue, domain A cannot read domain B's cookies, for security.
So to clarify, I have 4 HTML pages, each hosted on a different domain, B, C, D, E
I have a .swf hosted on A
I embed my .swf in each HTML page using the fullhttp://www.A.com/myswf.swf path
The swf drops a SO with unique ID on first visit - lets say to domain B
When a user then goes to an HTML page on domain C, the swf reads the SO and sends the unique ID back to server A (in theory, no cross domain access here)
Similarly, when the user goes to an HTML page on domain D, the swf can read the unique ID and send it back to A
The purpose is to do with tracking.
We have several sites which are sell a premium product, and a couple that offer a free version with reduced functionality. We try to get the users of the free product to upgrade to the premium product.
Alas, the 3rd part software supplier who supplies both the free and premium product has made it so that the only link between a user who uses the free service, and then decides to use the premium service, is his email address- so it is hard to measure the success of the marketing aimed at the free-software user (many people use fake email addresses for the free product)
In addition to various other methods of tracking I want to try to flag a user with a unique SO when they visit the free service. That means that if, later, they then sign up for the premium product, the SO will be read and add one more possibility for determining their origin.
There is no way (at present) that the 3rd party supplier will change their methodology, and my company currently does make a fair amount of money off the business so we can't dump them!
Edit - got around to doing a basic test - the swf resides onhttp://development
If I go tohttp://development/test.swf I get text saying
"you've visited 1 times"
If I go to localhost, with a page with thehttp://development/test.swf embedded in it... I get
"you've visited 2 times" - even though that is my 1st visit.
Rocking.
In other news, just 5 months after I suggested this to our software suppliers, they are actually supplying it.
WOOO HOOOOOOOO!
You probably cant understand my excitement, but it gets around a massive data lag, whereby certain users have data that should be immediate displayed up to 10 minutes late.