Actionscript 3 :: Make An Object Network Serialize To A File, Not A SharedObject?
Oct 10, 2011
Currently, I do serialize my model object to the SharedObject instance:
try {
var mySo:SharedObject = SharedObject.getLocal("sig");
mySo.clear();[code]....
Likewise, I load the saved model using the SharedObject instance. Works great.Ultimately, I'd like to serialize it to a file - which fails. Here is how:
var fp: File = File.applicationStorageDirectory;
fp = fp.resolvePath( PREFS_FILENAME );
var _prefsStream:FileStream;[code]....
The complementing read operation suddenly breaks and reports missing bytes.In fact, I can't image how FileStream / _model.writeExternal() is able to serialize, since it needs to somehow know, that a new serialization operation is about to start. If it doesn't know, it won't be able to determine, which object instances are left to serialize.Thus, I image that my concept is completely wrong or I missed how to initialize the serialization operation.I'd be happy to read the raw ByteArray from the shared object and write it to a file. Unfortunately, I didn't find a method to retrieve from a SharedObject a ByteArray of a certain property, in my case mySo.data.model.My question is loosely related to this one: Why does delete( DictionaryInstance[ key ] ); fail?
View 1 Replies
Similar Posts:
Oct 6, 2011
I'm about to implement
public function writeExternal( output:IDataOutput ):void {...}
public function readExternal( input:IDataInput ):void {...}
to make a set of object serializable.
Although I'm pretty sure, that I implemented all correctly, readExternal(..) at a certain point complains about too few data left to read:
RangeError: Error #2006: The supplied index is out of bounds.
at flash.filesystem::FileStream/readObject()
I wonder, if I have a circular object network like
A = { left -> B, right -> B }
B = { father -> A }
And I call
writeObject( a )
Will Flex serialize the hole object network and each object once and only one?
I did this:
Declared type annotations like this: [RemoteClass(alias="model.MyClass")]
Implemented parameter-free constructors
Declared all classes using implements IExternalizable
SharedObject's send() method is guaranteed to send each object once and only once.
Additional infos:
Reading and writing a ByteArray
Using Remote Object Components
IExternalizable interface
View 1 Replies
Feb 4, 2011
I have my class[code]...
MyClass is made for serializing but problem is that data property is Object which is not serializable. I have data property because I need to put some simple variables (data.id, data.name ...) in it and I needed to be serialized as anonymous object.
View 2 Replies
Feb 11, 2010
How can I serialize XML(meaning convert < to < and > to > etc...) using AS3. is there any build-in functionality or I have to use some regular expression to make global changes?
View 1 Replies
May 23, 2010
I'm running macromedia flash mx, and I'm trying to make a linkable swf by following this procedure: I select the object and then convert it to symbol. Then I choose " button " Right click at the object---> actions ---->[+]--->browser/network ----> getURL. I type my url and choose 'self" target.
When I test movie the hand symbol appears at first, but when clicked it turns to arrow. Exactly the same happends when I appload the swf and of course there's no link ...
View 11 Replies
Sep 6, 2011
I have the following scenario:
One application JEE / Flex 4 running on a tomcat, inside my Flex layer I have a iFrame passing a url to an ip of my internal network (http:url....) which is another application running within an industrial PLC.When access this app from within my internal network works fine, but when I try to access this iFrame to an external network in my home for example have a timeout error onhttp:[url].........
I believe this error occurs because the flex client is trying to run this url as I was in a internal network.Is there any way to run this url from an external network?
View 1 Replies
Feb 9, 2010
I am making a floor map for the company I work for. And I want to make a button map to a local printer on the network...
View 1 Replies
Feb 18, 2012
I've installed developer version of Flash Media Server 4.5 and trying to get remote object, but no matter how I call my object all i get is this error .I've rad configuration guide and it told me that I should set StorageDir for shared objects, enable RPC (<RPC enabled="true">) and allow shared object (<Allow>users</Allow> in <RPC> - <SharedObject> tags)
View 1 Replies
Jan 20, 2006
I have created a sharedobject on a local hard drive that stores multiple objects in it. I need to know how to access one particular object in that sharedobject.
View 14 Replies
Aug 22, 2009
I wrote a little script designed to save and load data using the SharedObject class. This is the meat of what I came up with.
Code:
public function saveGame(fileName:String, saveData:Object):void
{
var saveFile:SharedObject = SharedObject.getLocal(fileName);
[Code]....
Now, this little script works perfectly when I'm dealing with ints, Strings and the like. However, a problem arises when I try to save a custom made Object dedicated to holding data for another class structure. It goes through the saving process just fine, but when I try to load it it gets locked into Object. I can't access any functions and all (gameData is DataType) comparisons evaluate to false (even when testing against the dataType I saved it as).
View 7 Replies
Nov 26, 2009
im testing out some AS3 and working on my first preloader. Ive run into the file access problem and looked about for a while and found that locally I can get files to load with the compiler flag -network=off. To put this online would I have to do a compile with the network on but with a Security.allowDomain("myDomain") line. Would this then work online so long as all the required files are in the same place.
View 3 Replies
Apr 21, 2008
I have a huge SWF. Instead of loading every frame and playing from the beginning with loadMovie(), is it possible to load only say frames 100 to 120? Also, if I have a pause button, how do I make loadMovie() stop loading to conserve network bandwidth?
View 4 Replies
Oct 13, 2011
I cannot find and information on how to make a dynamic sharedObject data property.
Simplified Code for what I need/want to do
var iData:SharedObject = SharedObject.getLocal(userInfo);
var dataArray:Array = ["a","b","c"];
var property:String = "prop"
iData.data.this[property] = dataArray;
That is what i was thinking.
It doesn't matter how the property is created, just that it needs to be done on the fly.
View 2 Replies
Apr 19, 2010
StackOverflow community,[URL].. used to launch AIR applications from Flex applications requires the use of an air.swf file located here:[URL].. We have tried to download this SWF and use it in our internal network, but it is not working, we depend on using the one located in the Adobe site.
Is there anyway to use this air.swf file without having to access the Adobe site?
View 2 Replies
Apr 18, 2011
I need to open media files from a network path like this "\drivefolderfile", is it possible, if yes how? else is there any other alternative?
View 1 Replies
Mar 3, 2011
Everytime a clip is being started the line var so = SharedObject.getLocal('mysharedobject', '/'); creates new mysharedobject instead of returning the reference to the existing one. What might be the reason for this?
View 2 Replies
Sep 7, 2010
is there a way to connect a Video object to a webcam installed on another computer in the Network, without setting up a streaming server?The machines can have fixed IPs and whatever, but I'm limited to LAN/WAN technology. Using AIR is possible.
View 5 Replies
Aug 11, 2010
Is there a possibility to find out which objectEncoding was used for a loaded SOL file?(The properity is always defaultObjectEncoding when not manualy set)
View 0 Replies
Dec 14, 2011
After spending a whole week on this,which most likely will turn out to be very simple, I have an xml file (with over 1300 cNodes) that is set up like this:
Code:
<?xml version="1.0" ?>
<rNode>
<cNode theWord="A" theSynonym="A" theMeaning="A" theExample="A" />
[Code].....
What I am trying to do is to create an array (arr =[]) that hold only the cNodes chosen in the "saveText" .. in other words the cNodes assigned the value var = 1 in the SO file.
Is this easier done as a temporary array or as second SO file.
View 9 Replies
Aug 24, 2011
I try to load a file over the local network with Loader Class but I get the error "URL Not Found". I use a path like this "file://///myPCnetID/pubilcFolder/pictures/mypic.jpg" which refers to a folder on the same PC I compile and run the Air flash file.
When I copy the adress into the browser the jpg-file ist displayed corretly.
View 6 Replies
Feb 14, 2011
In a plugin context (a swf loaded by an another swf), is there any way to restrict access to file system and network in the same time to the loaded swf?Compiler option "-use-network=true|false" does not fit because you cannot restrict both file/network.[code]The loaded swf is in user's document folder, outside Air app folder. Currently, the loaded swf is abble to load "c:/Windows/regedit.exe" and I don't want it (neither sending informations on the network).
View 2 Replies
Sep 13, 2011
I monitor (and log to server) most user errors in our flash game. Quite frequently I see security errors related to trying to make requests to a cross-domain URL (usually the Facebook Graph API). 99% of our players can make these graph API calls with no issues.What I think is going on is that the client makes a request, but fails to load the crossdomain.xml file. I don't quite know how AS3 handles this in the case of a failure to load the crossdomain policy file...will it retry for every URLRequest made until it succeeds in loading it, or does it just give up forever?
View 2 Replies
Aug 3, 2011
what is the maximum size of SharedObject file?
View 2 Replies
Jul 13, 2009
I've set up a shared object using user_so.data.flashVar = value.This works fine, but as it is being used to store details for saved games, users could easily edit their saved games to cheat their way through the game. Is there any way to check if a shared object has been altered outside of Flash, or are there any other methods of saving files in AS2 that I'm unaware of?
View 4 Replies
Jul 31, 2010
I have attempted to create a save file using sharedObject but it doesn't work. I don't get any errors it just doesn't seem to save when I press the save button. In the main frame I have:
Code:
user_so = SharedObject.getLocal("user");
if(user_so.data.tclock != undefined) {
clock_txt.text = user_so.data.tclock;
gregism_txt.text = user_so.data.gregism;
} else {
gregism = 0
clock = -1
}
In the save button movie clip I have:
Code:
on(release) {
user_so.data.tclock = _root.clock_txt.text;
user_so.data.gregism = _root.gregism_txt.text;
user_so.flush()
}
View 2 Replies
Aug 12, 2010
Is there a possibility to find out which objectEncoding was used for a loaded SOL file? (The properity is always defaultObjectEncoding when not manualy set)
View 3 Replies
Jul 31, 2011
I'm uploading an image file with upload() of a FileReference object however the network monitor in Flash Builder doesn't report anything. Is that normal behavior? A google search didn't return anything.
View 1 Replies
Nov 2, 2009
I am creating a web page that allows users to upload their own swf files to my web page, which are then used by the main web page as components. This creates a security issue though because I don't want the uploaded swf files to access other files on the server.
when the main webpage starts, it loads whatever third party swf files the user specifies. Is there a way for my main web page to change the security settings of the loaded swf so that the loaded swf is treated like it was loaded from another domain? Or is there another way I can provent these uploaded swfs from accessing local files on the server.
View 5 Replies
Jun 30, 2009
I just learned how to use sharedobjects few week ago. Is it possible for Flash_A to detect Flash_B's sharedobject file?
View 1 Replies
Jun 10, 2011
I'm currently working on a chat with uploading an image and sharing it. The problem is I can upload and display the image but I can't share it to the other side. Here is some code:
[Code]...
View 1 Replies