Chapter 13 Example 5

by actionscriptbible
♥0 | Line 16 | Modified 2009-11-11 15:22:16 | MIT License
play

ActionScript3 source code

/**
 * Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7xLX
 */

package {
  import com.actionscriptbible.Example;
  import flash.utils.ByteArray;
  
  public class ch13ex5 extends Example {
    public function ch13ex5() {
      var arrayA:Array = new Array("a", "b", "c", "d");
      var byteArray:ByteArray = new ByteArray();
      byteArray.writeObject(arrayA);
      byteArray.position = 0;
      var arrayB:Array = byteArray.readObject();
      arrayB.push("e", "f", "g", "h");
      trace(arrayA.join(" "));  //a b c d
      trace(arrayB.join(" "));  //a b c d e f g h
    }
  }
}