IDE :: Accessing Local Shared Object From Diff SWFs
Jan 19, 2009
I am facing a problem in accessing Local shared object from 2 diff. swfs. Let me explain the scenario clearly.I am developing a radio widget (in maindomain.com for ex)which has a button to open a html page (placed in contentserver.com) as a popup with specific wt and ht. The html page loads the same SWF file of radio widget from "maindomain.com", means whatever changes we do for the SWF in maindomain will be reflected automatically in the popup also.Here where the problem is:
1. Say I am playing radio station "A" in main window and added this station to favourite list (which is done by storing in Share object). So when i open the popup its reflect there.
2. Now when i change radio station "A" to "B" in the popup and added "B" to favourites and closed the popup.
3. When I refresh the main window, I can get both "A" and "B" in fav, as expected.
4. But if without refreshing in main window when I changed to some new station "C" and then open the popup, it has got only radio station "A" in the fav list.
I am pretty sure this is because of Sharedobject.flush(). The thing I am wondering is, why the station "B" which is also pushed to sharedobject when added to favourite is getting deleted when I flush() the SO.?I googled many forums but not satisfied solution for this. Even I tried to get the Sharedobject.getLocal("SO","/") every time before using data in it. but no use.Is it a Flash limitation accessing LSO from diff SWF?
I am building an application that uses a Shared Object that is shared (ironically) between 3 separate applications. 1 application listens for updates, and the others update the app. The problem I am having is that I need the main application to be able to detect changes to the Shared Object. Unfortunately there seems to be no events to listen for that are not for 'remote objects'. Because of this I created a timer that gets a new local instance of the shared object every X seconds.I just call the following before I read or write to the sharedObject:[code]This is causing a CPU Hiccup every 3 seconds and bogging down the system. so all this being said, does anyone know of a clean way to refresh a copy of the sharedobject without creating a brand new instance of it
read a local shared object with a servlet even if there is no flash present on a page? I want to set a local shared object like a cookie, and then access it again from a page that doesn't have a flash movie.If I can't do this, is it standard to have the initial flash movie call an external javascript to set a traditional cookie that can later be read?
I have a Flash.exe projector that stores data in a Shared Object. Anything works fine if I launch it from my desktop. The Flash.exe will be recorded and used from a CD-rom. Will the path of the Shared Object change? Say, will it try to record itself on the cd?!
What are some possible reasons that an LSO will not update/store information when nested within an IFRAME nested in another IFRAME?The mark-up structure was not determined/dictated by me.
I have begun to use Local Shared Objects in my projects but i appear to have got a bit stuck. To be more specific, i have two input fields, first and last names, the user enters his/her first and last names into these fields, the user clicks the "Save details" button and the Local Shared Objects are then set to remember the two names. The text above the first and last name fields change from "Welcome guest" to "Welcome, First Last!". So at this point the whole system works.
The point at which the code fails to work is when the user navigates away from the page where he/she entered the first and last names. The user then returns back to that page and the Local Shared Object has been set to the two input fields which are now blank because of the scene change. The Local Shared Object is set to nothing but is still accepted as a variable and thus makes the text above the two text fields display "Welcome, !".
I understand that what i just wrote may appear a bit compicated, but what i am essentially needing to find out is how to set the Local Shared Objects to the two input values only once when the "Save Details" button is clicked, instead of constantly checking the values of the inputs and changing the Local Shared Objects.
In code:
Code: save.onRelease //only do this once// = function() { first_name_txt.text = name_details.data.first_name last_name_txt.text = name_details.data.last_name }
Alright, so I have a projector application running, and an SWF on a server. The projector loads the SWF on the server.The projector will save all of the sharedobjects it creates in the local-host folder, whereas the swf on the server will store it in it's own folder "or example. I want to be able to have them both store shared objects in the same folder, so that they can interact with each other through shared objects. Even if I load the SWF from the projector, it still creates it's own folder.
I need to have this because it stores level data for a game I'm making, where all the levels are on the server, and you can download each one individually, and make your own levels, and upload them, so others can play. The data would be loaded from a swf on the server, and then create the S/O on the users computer. Then, the actual game would load this SO and then create the map, based on the data.
PHP Code: package import flash.net.SharedObject; import flash.display.MovieClip; public class Example extends MovieClip var currentStage:int;var SOData:SharedObject; public function Example
I am looking for a way to edit .sol-files (LSO/Local Shared Object). I have tried searching quite a bit, but I have not been able to find any program that can edit AS3-files properly. Is there a solution for me out there?
In one of the classes in my Flex application I have a dictionary, which is periodically updated from other parts of the application. It contains some sort of user preferences and I want to keep it in sync with a local shared object - the dictionary needs to be read during the class initialization and saved to the local storage when an element is changed, added or deleted.
The "Dictionary" object inherits only "Object" and does not have a change event - like the "collectionChange" in ArrayCollection. So I can't sync the dictionary just by listening for an event and manipulating the shared object in the event handler. The other possible solution would be to make the dictionary private and manipulate it using special methods in my class. Something like:
public function setValue(key:String, value:String):void public function getValue(key:String):String public function delValue(key:String):void
But using bindings will become a real nightmare and I will have to make changes in many other parts of the application.
I would like to know how to save more than 1 score into the text file and not overwriting the previous score so that it can be displayed in the high score list...I'm not sure how to write the array and where to write itwrite a sample code of for example getting 3 scores, saving it and displaying it in the high score board ?
I've read and tried every post concerning shared objects on this and other boards but it's not working: Trying to access shared object for 2 or more swfs Code: This is what I have on the swf that will flush the object:
i have prepared a login screee. using shared object i have saved username and password, now i want to know the sol path. Is there any way to actually retrieve the shared object local path.like C:Documents and Settings[userName]Application DataMacromediaFlash Player#SharedObjectsXXXXXlocalhost ext.sol
I need to make a local shared object (or javascript cookie function- below) that I can use to calculate the time since an ad was last loaded. It's an expanding ad, and I only want it to expand once every 2 hours. (Trying to keep the expanding-annoyance to a minimum!) I understand the basics of creating an "lso" but the action script for retrieving the time, placing it as a variable in the lso, and later retrieving it to figure the time is well beyond me. I considered a normal browser cookie, set to delete after the session, bypassing all time calculations... Forcing javascript to create a cookie ONLY when flash tells it to (after the ad has expanded) is tripping me up and creating a function to check for the cookie on the first frame to decide whether or not to continue is also beyond my simple animation skills.
I am trying to have a local shared object in flash to detect whether a user is a new user or a returning user. If they are a new user I want to do newUser function and if they are a previous user I want to do a previousUser function. This should all be happening on an onEnterFrame.
Here is my code I have so far: //shared object - cookie newUser_test = SharedObject.getLocal("newUser"); newUser.text = newUser_test.data.title = "new user"; newUser.text.onEnterFrame = function () { newUser.text = "new user"; } newUser.text.onEnterFrame = function(){ newUser.text = newUser_test.data.title = "previous user"; newUser_test.flush(); }
I'm playing with Local Shared Objects, and I was able to save and load simple data types like strings and integers. Pretty cool.
I want to Save/Load a Bitmap Object but I'm having problems. I think I got a Bitmap Object to save but when I loaded it back in, it was basically a blank bitmap. I located the actual .SOL file on my computer and opened it up. It had some basic Bitmap info like scale, rotation, visible, width, height, etc, but NOT the actual bitmap.
So I realized that I need to be saving/loading a BitmapData object instead of just Bitmap. BitmapData holds the actual bitmap pixels, I think. Anyway I saved out a BitmapData object. When i tried to load it back in, I get a type coercion error: "Type Coercion failed: cannot convert Object@df355b1 to flash.display.BitmapData". I dont get it because this error didnt occur for Strings, ints, or Bitmap Objects. Whats happening?
Also, I looked again at the .SOL file after saving out the BitmapData object, And I dont see any pixel data there. The bitmap I'm saving is 800x800 so the .SOL file should be pretty big but its just a tiny file so I know the pixels havn't been saved properly.
Here is the code I'm using (Simplified - error handling removed, etc)
Code: // save var mySo:SharedObject = SharedObject.getLocal("mysharedobjecttest"); mySo.data.testA = 14; mySo.data.testB = "hello this is a test";
I have a button instance mc "mcBtn", inside this instance i have the actual Btn graphic symbol and AS layer.inside the AS layer i have defined onRollover, onRelease, onRollOut methods.if i rollOver/Out/Press Btn it works fine and Btn animates in some way. I needed to access mcBtn from _parent timeline AS WELL, so i defined a method mcBtn.onPress [one which is not defined inside mcBtn yet], and inside onPress told mcBtn to animate some other content....
What happened is, that onPress works fine and after pressing Btn, requested content is animated, BUT all other methods defined inside mcBtn stopped working! [no animation when rollOvered, rollOut-ed, onRelease-d]
I am programming a web based application with Actionscript 2.0 classes for flash 8, and I want to save user data using the local shared object.As the data is potentially rather complex I would prefer to store it in an instance of a custom class that I then stick in an array property of the local shared object data property.However, when I try to do this, if I retrieve the stored object it seems to have lost all its instance methods. If I do a for in on it, I can see the private properties to which I have assigned my data, but as they are private I cannot retrieve them.how I can store an instance of a custom class in a local shared object without it being corrupted in this way?
I'm wondering if it's possible to access a shared object's data (once it's been changed) without reloading the swf. Specifically, I have two swfs: one changes the data in the so and lets the second swf "know" via a localconnection. I have a function in the second swf that fires via the local connection.[code]This function looks for the new value however it doesn't show the updated value in my textfield unless I refresh the browser. Thoughts?
There is a small feature I have implemented that makes uses of the Local Shared Objects to work properly.
I wish to be able to help the user self-diagnose if he is unable to use the said feature because he refused access for this computer to writing local shared objects and give him instructions to work around the issue if it applies to him.
I'm looking for something similar to the muted property of the Microphone class [URL] or the Camera class.
case: user clicks button and flash goes frame 2 what I want is that flash knows, that user has pressed the button once earlier. So flash goes straight to frame 2 if th user refresh the page. I ques I have to do this with local shared objects? How do I do it? Or should I use php/javascript?