Wednesday, March 13, 2013

Flex pass data or objects from one mxml to another

The best way to pass the objects or array across the mxml's is to use Shared Objects.

Declaring a Shared Object :

public var studentSO:SharedObject = SharedObject.getLocal("student","/");

Set values to Shared Objects :

studentSO.data.id = 101;
studentSO.arr = new Array([1,2,3]);

studentSO.flush();


Get values from Shared Objects :

private var i:int = studentSO.data.id;
private var arr:Array = studentSO.arr;

No comments:

Post a Comment