Hi,

Zhu Feng>Can I delete files by using action script APIs? When I use the shared object, I don't want the .sol files stay in disk persistently, although >we can clear the context of the file.

You could use onUnload() see example code below [1] or use onBeforeUnload() events in IE (not sure about the other browsers FireFox/Mozilla/Opera/Safari etc) to trap the event triggered when the browser is closing down and then call Flash [2]. When the close event is detected in Flash you could "physically" delete the SharedObjects from disk using the solution described in [3].

<code>
function onUnloadHandler(){
  if(self.VBArray){
   var e = self.event, s = self.screen;
   if(e.clientX + s.width < 0 && e.clientY + s.height < 0 &&
typeof(window.onclose) == "function")
   {
    window.onclose();
   };
  };
 };
 
 >
 function onclose(){
  alert("The window has left the desktop");
 };
</code>

Zhu Feng>3. When I close the browser, I want to capture this event and clear the context of shared object (or remove the file if action script can do this). Could AS capture this >kind of event?

Basically: "Macromedia's docs don't show us how to remove the physical file from a user's drive, (although they say it's possible), but we can combine two things we know already to figure it out. Firstly, when we write a SO with no properties in its data child, no file is written. Secondly when we delete a property from the data child and re-write the SO the property is removed from the file on the disk also. So in order to delete the actual file, one need only delete all the properties of the data child. This is probably best done with a for...in loop." [3]

Source:
[1] http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2002-May/033799.html
[2] http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_15683#jt
[3] http://www.actionscript.org/tutorials/intermediate/SharedObjects/index3.shtml

HTH,

/Johan
On 4/22/05, Feng Zhu <[EMAIL PROTECTED]> wrote:

Thank you very much. This will be helpful.

And, What about the 2, 3, 4 questions, any ideas?

 

Best Regards!

Zhu Feng

-----Original Message-----
From:
[email protected] [mailto: [email protected]] On Behalf Of Johan Lopes
Sent: 2005
å 4æ21 æ 20:57
To:
[email protected]
Subject: Re: [flexcoders] Re: any ideas about flex client side caching?

 

Zhu Feng> 1. The shared object stored in local disk is plain; we can see the .sol file context easily by text editor

If you're saving sensitive data then use an encryption scheme to scramble your data before saving them as SharedObjects.

There are many implementations being ported to AS2, just google it and you'll see.

Try this one: http://www.meychi.com/archive/000031.php

HTH,

Johan

On 4/21/05, Feng Zhu < [EMAIL PROTECTED]> wrote:

Hi,
Sorry to disturb you again.
The following things for shared object/client side caching puzzle me:
1. The shared object stored in local disk is plain; we can see the .sol file context easily by text editor. Is there anything security for shared object or is there any method to cache data shared by several applications in memory not in hard disk?

2. Can I delete files by using action script APIs? When I use the shared object, I don't want the .sol files stay in disk persistently, although we can clear the context of the file.

3. When I close the browser, I want to capture this event and clear the context of shared object (or remove the file if action script can do this). Could AS capture this kind of event?

Best Regards!
Zhu Feng

Best Regards!
Zhu Feng

-----Original Message-----
From: [email protected] [mailto: [email protected]] On Behalf Of Abdul Qabiz
Sent: 2005å4æ15æ 19:36
To: [email protected]
Subject: RE: [flexcoders] Re: any ideas about flex client side caching?

Hi,

You can allow all swfs from a domain to read/write to same SharedObject,

There is second parameter to SharedObject.getLocal(..,..) method. Read about
in docs.

var so = SharedObject.getLocal ('myCookie', "/");

This way all swfs in same domain have access to myCookie SO...But remember
there name collision issues, so read the docs properly...

http://livedocs.macromedia.com/flex/15/flex_docs_en/00001668.htm

-abdul

-----Original Message-----
From: [email protected] [mailto: [email protected]]
Sent: Friday, April 15, 2005 1:54 PM
To: [email protected]
Subject: [flexcoders] Re: any ideas about flex client side caching?

HI,
I tried SharedObject. It is perfect. But I ocurs another problem. Only
the same swf can read the cache context.
For example:
I write a simple mxml file: test1.mxml:
<mx:Script>
        <![CDATA[
        function save(){
        var so= SharedObject.getLocal('myCookie');
        var str:String = text.text;
        so.data.string = str;
        var sucess:String = so.flush(1000000000);
        alert(sucess);
}
function ini(){
var so= SharedObject.getLocal("myCookie");
var str:String = so.data.string;
alert(str);
}
]]>

and in text2.mxml:
function ini(){
var so= SharedObject.getLocal ("myCookie");
var str:String = so.data.string;
alert(str);

The results in the two are different.
when browsing http:\\....\\text2.mxml, I find that the alert shows
blank while rebrowsing http:\\text1.mxml, I find the alert shows some
letters I saved.

Am I do something wrong?

--- In [email protected], Matthew Shirey <[EMAIL PROTECTED]> wrote:
> Just be careful about how much you store in the SharedObject. By
default the
> client is set to accept up to 100k A 'Huge' dataset might exceed
that. If
> you exceed that about I think the client then asks the user if more
space
> can be allocated. I've just started using a SharedObject; I'm a little
> paranoid about asking users wierd questions, so I'm trying to keep
it fairly
> limited.
>
> -- Matthew
>
> On 4/14/05, Abdul Qabiz <[EMAIL PROTECTED]> wrote:
> >
> >
> > Hi,
> >
> > You can cache object on client in SharedObject. So you can
serialize a
> > class
> > to SharedObject on client and later deserialize to use in application.
> >
> > For example, you fetch a huge dataset from server(via xml, http or
> > remoteobject), you can serialize it to SharedObject and show a
part of it
> > in
> > front-end when required. This way you can avoid network calls and
memory
> > problems...
> >
> > -abdul
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]...]
> > Sent: Thursday, April 14, 2005 10:33 AM
> > To: [email protected]
> > Subject: [flexcoders] any ideas about flex client side caching?
> >
> > Hi,all,
> > In Christophe's blog, we can code our own class to
> > cache data. Does flex provider some other solutions
> > for the client_side caching?
> >
> > Best Regards
> > Feng
> >
> > _________________________________________________________
> > Do You Yahoo!?
> > 150ÃÃÃÃMP3ÂÃÂÃÃÃÂÂÂÃÃÃÂÂÃÃÃÃÃÃÂÃÃÃ
> > http://music.yisou.com/
> > ÃÃîÃÃÃÃÃÂÃÃÂÂÃÃÂÂÃÃÂÃÃÃÃÂÂÂÃÃÃÂÂÃÂÃÃÂ
> > http://image.yisou.com
> > 1GÂÃÃÃ1000ÃÃÂÂÃÃÂÂÂÃÃÃÃÃÃÃéÃÃÂÂ
> >
> >
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1
> > g/
> >
> > Yahoo! Groups Links
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >

Yahoo! Groups Links

Yahoo! Groups Links


Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/





Yahoo! Groups Links



Yahoo! Groups Links

Reply via email to