ActionScript 2.0 :: Save Instance Of Custom Class With Local Shared Object?

Mar 26, 2008

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?

View 4 Replies


Similar Posts:


ActionScript 3.0 :: Save (and Load) Bitmap To Local Shared Object

Dec 8, 2009

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";

[Code].....

View 14 Replies

ActionScript 2.0 :: Save The Local Shared Object(.sol) File At A Desired Location?

Jun 8, 2004

!--Does anyone know if it possible to save the local shared object(.sol) file at a desired location or to embed it within the flash movie?

2--Is it possible to create an image file at runtime from a flash projector file?

View 1 Replies

ActionScript 2.0 :: Save The Local Shared Object(.sol) File At A Desired Location Or To Embed It Within The Flash Movie?

Jun 8, 2004

!--Does anyone know if it possible to save the local shared object(.sol) file at a desired location or to embed it within the flash movie?

2--Is it possible to create an image file at runtime from a flash projector file?

View 1 Replies

ActionScript 3.0 :: Accessing Object Instance From A Custom Class?

Jun 22, 2011

I have created some (TextInput, ComboBox, CheckBox) Component instances  (created as a public objects) in a Document class and added them to the stage.
 
Now I have created a custom class for a movieclip in library and instantiated it in the document class (also a public instance).
 
I need to access the component instances in the custom class. How to do this ?
 
Also, Is it a good practice to use ENTER_FRAME event frequently ? because if I can't access the above components instances in the custom class then I will be left with no choice but to use ENTER_FRAME event in the document class every time I need to change some value in the components...

View 7 Replies

Flex :: Casting Object From ArrayCollection To Instance Of Custom Class

Jan 28, 2011

I am using Flex 4 and for whatever reason I cannot get the following code to work which happens inside of a ListEvent handler for a dataGrid:
_tempRule = DataGrid(event.currentTarget).selectedItem as Rule;

Rule is a custom class, and the above code always returns null. The dataprovider for the datagrid is an ArrayCollection. If I try to wrap the above code to make it like the following:
DataGrid(event.currentTarget).selectedItem as Rule

I get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert Object@e15a971 to com.mycompany.arcc.business.Rule

Now I know I have done this before with native Flex classes like Button, etc, but it my case it will not work. Here is the Rule class:
package com.mycompaany.arcc.business {
import flash.utils.describeType;
import mx.collections.ArrayCollection;
[Code] .....

View 2 Replies

IDE :: Local Shared Object (LSO) On A CD-ROM?

Jan 28, 2010

Does anyone know if it's possible to save and access a LSO from an EXE projector on a CD?

Obviously the LSO couldn't be saved on the CD itself - would it be able to save the LSO somewhere on the users hard drive?

View 4 Replies

ActionScript 3.0 :: Save Visual Object Data In Shared Object?

Jan 22, 2011

I'm using a loader for people to use to upload their own images for a background, and I want it to remember the image the next time they come to the page, so is there any way to save the loader data in a shared object? I haven't tried just using something like

Code:
sharedObject.data.dataName=loader

because I assume it doesn't work that way.

View 9 Replies

ActionScript 2.0 :: Use Local Instance Variables Vs Attach New Properties To The Instance Object?

Mar 14, 2006

I am wrapping my brain around OOP in AS2. I am making two posts on two different subjects. My question here is: when should I use local instance variables, and when should I attach new properties to the instance object? (Feel free to correct my terminology.) Let's say I have a class for a scrolling background, which scrolls when I mouse over its edge. I want to put these values somewhere:

1) How wide is the border in which a mouseOver makes it scroll? This is basically a semi-constant I set it up once and keep it the same, unless the user changes it in an options menu to make the border wider or narrower. Call this scrollBorderWidth.

2) How fast is the background scrolling now? I want to track this so I can smoothly change the scroll speed over several frames. This is often changed. Call this scrollSpeed.

It seems I have two ways I can store and access these values and darned if I know which is better practice. METHOD A: Make them local variables in the class, so the scrolling background instance has them as local vars. I set them up thusly:

[Code]....

View 4 Replies

ActionScript 3.0 :: Refreshing A Local Shared Object

Oct 13, 2010

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

View 2 Replies

Read Local Shared Object With A Servlet?

Sep 16, 2009

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?

View 1 Replies

Flash :: Local Shared Object Path?

May 10, 2011

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?!

View 1 Replies

ActionScript 2.0 :: Local Shared Object (LSO) In IFRAME

Dec 2, 2009

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.

View 0 Replies

ActionScript 2.0 :: Local Shared Object OnRelease?

Oct 3, 2010

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
}

View 2 Replies

ActionScript 2.0 :: Shared Object Local/server?

Oct 4, 2007

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.

View 1 Replies

ActionScript 3.0 :: Local Shared Object Corrupt?

May 3, 2011

Do you see anything wrong with this?

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

[code].....

View 3 Replies

Flash :: Editing .sol-files (LSO / Local Shared Object)

Jan 18, 2011

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?

View 4 Replies

Flash :: Dictionary In Sync With A Local Shared Object?

Mar 22, 2011

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.

View 2 Replies

ActionScript 2.0 :: Game Scoreboard Using Local Shared Object?

Oct 10, 2003

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 ?

View 2 Replies

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?

View 4 Replies

ActionScript 3.0 :: Save XML In Shared Object?

Apr 10, 2010

Is there a way in which xml can be saved as shared object?

View 1 Replies

Flash :: Retrieve The Actual Shared Object Local Path?

May 12, 2011

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

View 1 Replies

ActionScript 2.0 :: Local Shared Object Or Cookie To Track Time

Jan 28, 2010

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.

View 0 Replies

ActionScript 2.0 :: Can A Shared Local Object (.sol) Store Nested Arrays

Oct 30, 2005

can a shared local object (.sol) store nested arrays? like:

myArray = new Array([a, b, c], [1, 2, 3]);

View 5 Replies

ActionScript 2.0 :: Local Shared Object - Detecting User Status

Aug 28, 2007

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();
}

View 3 Replies

ActionScript 2.0 :: Save MovieClip With Shared Object?

Jun 6, 2011

i`m going to attach movie from library i need when i click save button and close swf and run again the movieClip are loaded

View 3 Replies

Professional :: Local Shared Object (undefined) - Retrieve Data From A SOL File

Mar 14, 2011

I am trying to write a piece of code to retreive data from a SOL file : this is my code :[CODE]//get External interfaceimport flash.external.*;

[Code]...

How can that be ? what can I do ? What am I doing wrong ?(bear with me, as I said, I'm kind AS newbie).

View 4 Replies

ActionScript 2.0 :: Use The Shared Object To Save The _x And _y Positions Of Several Attached MC's

Mar 4, 2004

I am trying to use the shared object to save the _x and _y positions of several attached MC's. The attached MC's have all been given a variable name and attached to a dynamically created MC called "world".I need to loop through all of the MC's in _root.world to save their postions to the shared object. Here is what I have tried,.... when I trace so.flush.. it traces to true but the object postions are not saved.......

Code:
_global.initSo = function() {
_global.so = SharedObject.getLocal("marinaSave");
// if the SharedObject object created a new shared object

[code]....

Am I using the for... in method correctly to loop through the MC's in _root.world and save their values?

View 4 Replies

ActionScript 3.0 :: Shared Object - Save Without Pushing Button

Sep 14, 2010

I'd like to get the input text in the SWF to save on exiting the SWF without pushing a button. Here's what I have so far that incorporates pushing a button

Code:
var savedstuff:SharedObject = SharedObject.getLocal("Cookie");
btnSave.addEventListener(MouseEvent.CLICK, SaveData);
function SaveData(MouseEvent) {

[Code]....

View 1 Replies

ActionScript 3.0 :: Shared Object - Save And Load Color

Feb 9, 2011

I wanna to make some flash for save and load color...
Click button to change button color and click again return to old color and
Save lase color
When run project to show last save color

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved