Hi.

I made up this little class to manage Shared Objects.
But there is something (or more than simply "something") in AS I don't 
perfectly understand.

The problem (I imagine there can be many more, but...) is that I can't add more 
than one data property. I post the code with some comment:



---
class
---

class com.FlashCookie extends SharedObject {
    var _name:String;
    var _data:Object;
    var _so:SharedObject;
    var _propName:Object;
    //
    function FlashCookie(name:String) {
        if (name == undefined) {
            trace("you must pass me something");
            return;
        }
        this._name = name;
        this._so = SharedObject.getLocal(this._name);
        this._data = this._so.data;
    }
// one problem could live here:
    public function setData(_propName:Object, _value:Object):Void {
        this._propName = _propName;
        if (this._data[this._propName] == undefined) {
            this._data[this._propName] = _value;
        }
    }
//
    function deleteCookie():Void {
        this._so.clear();
    }
//
    function writeCookie():Object {
        var res = this._so.flush();
        return res;
    }
//
    function getCookieSize():Number {
        var num = this._so.getSize();
        return num;
    }
// I only get the array (A):
    function getContent() {
        trace("!");
        //trace(this._data);
        var i;
        for (i in this._data) {
            trace([i]+"--"+this._data[i]);
        }
    }
}

---
FLA code:

//
import com.*;
//
var coo:FlashCookie = new FlashCookie("foo_bar_baz");
//
var A:Array = [1, 2, 4];
var B:String = "string_";
var C:Number = 6;
//
coo.setData(_propA, A);
coo.setData(_propB, B);
coo.setData(_propC, C);

---


I hope you can help me understand.   :-)
Thanks in advance.
CC




 Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to