Flex 使用 ShareObject 類別

2021-08-30 20:04:49 字數 1469 閱讀 6259

測試環境:

1. windows xp pro

2. flex builder 2.0.1

shareobject 類別允許你將小量資料儲存在使用者端電腦。shareobject 有點類似瀏覽器的 cookie。應用程式只能訪問屬於自己的資料,且應用程式必須和資料同屬於同乙個網域(domain)。但是這個資料並不能傳送到伺服器端。

shareobject 提供下面的方法

clear()

從 shareobject 中清空所有的資料,並從檔案磁碟刪除 shareobject 檔案。

flush()

將 shareobject 直接寫入使用者端的檔案

getlocal()

回傳 shareobject 所在的 domain。假如不存在,這個方法會在使用者端建立乙個新的 shareobject

getsize()

gets the size of the sharedobject file, in bytes. the default size limit is 100kb, although it can be larger if the client allows it.

屬性:data

(唯讀)儲存在 shareobject 中的資料

onstatus

當 shareobject 發生警告、錯誤或其他訊息時會觸發這個事件

建立 shareobject 的語法如下:

sharedobject.getlocal("objectname" [, pathname]): sharedobject
下面是簡單的範例:

public var myso:sharedobject;

myso = sharedobject.getlocal("preferences");

上述如果在 local 端執行,flash player 會產生 preferences.sol 到下面路徑

sharedobject 範例:紀錄登出時間

點一下 log out 在重新載入 flash 會看到上次登入時間

<?xml version="1.0"?>

public var myso:sharedobject;

[bindable]

public var welcomemessage:string;

myso = sharedobject.getlocal("mydata");

if (myso.data.visitdate==null) else

} private function getvisitdate():date

private function storedate():void

private function deletelso():void

]]>

Flex 字型使用

今天在把玩開源的flex系統和控制項時碰到了字型不能編譯的問題,所以對字型進行了較為深入的研究。flex 支援的true type和open type型別的字型 講下他們之間的區別 truetype 字型可調整到任意大小,並且在所有大小情況下,都是清晰可讀的。可以將它們傳送給 windows 支援的...

Flex 字型使用

flex 支援的true type和open type型別的字型 講下他們之間的區別 truetype 字型可調整到任意大小,並且在所有大小情況下,都是清晰可讀的。可以將它們傳送給 windows 支援的任何印表機或其他輸出裝置。opentype 字型與 truetype 字型相關,但包括更大的基本...

flex使用學習

display flex行內元素也可以使用flex布局。display inline flex 注意,設為flex布局以後,子元素的float clear和vertical align屬性將失效。容器預設存在兩根軸 水平主軸 垂直的交叉軸flex direction flex wrap flex f...