Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Current »

Swiz provides two ways to help with client persistence. In both Flex and AIR projects you can use the SharedObjectBean. In AIR projects, you can also use the EncryptedLocalStorageBean, which can be found in the Swiz Desktop Extensions project on GitHub. (The EncryptedLocalStorageBean is kept in a separate project to avoid having a framework dependency on the AIR libraries.)

SharedObjectBean

To use the SharedObjectBean, you simply declare it in a BeanProvider:

<swiz:BeanProvider
	xmlns:swiz="http://swiz.swizframework.org"
	xmlns:storage="org.swizframework.storage.*">
 
	<storage:SharedObjectBean id="soBean" />

</swiz:BeanProvider>


Inject the instance into your model and declare a bindable getter/setter:

[Inject]
public var so:ISharedObjectBean;
 
[Bindable]
public function get appIndex():int
{
	// the second parameter is the initial value
	return so.getInt("appIndex", 0);
}
 
public function set appIndex(index:int):void
{
	so.setInt("appIndex", index);
} 


  • No labels