//
// Flump - Copyright 2012 Three Rings Design

package flump.xfl {

public class XflMovie extends XflTopLevelComponent
{
    use namespace xflns;

    public var libraryItem :String;
    public var symbol :String;
    public var layers :Array;

    // The hash of the XML file for this symbol in the library
    public var md5 :String;

    public function XflMovie (baseLocation :String, xml :XML, md5 :String) {
        const converter :XmlConverter = new XmlConverter(xml);
        libraryItem = converter.getStringAttr("name");
        super(baseLocation + ":" + libraryItem);
        this.md5 = md5;
        symbol = converter.getStringAttr("linkageClassName", null);

        const layerEls :XMLList = xml.timeline.DOMTimeline[0].layers.DOMLayer;
        if (new XmlConverter(layerEls[0]).getStringAttr("name") == "flipbook") {
            layers = [new XflLayer(location, layerEls[0], _errors, true)];
            if (symbol == null) {
                addError(ParseError.CRIT, "Flipbook movie '" + libraryItem + "' not exported");
            }
            for each (var kf :XflKeyframe in layers[0].keyframes) {
                kf.id = libraryItem + "_flipbook_" + kf.index;

            }
        } else {
            layers = new Array();
            for each (var layerEl :XML in layerEls) {
                if (new XmlConverter(layerEl).getStringAttr("layerType", "") != "guide") {
                    layers.unshift(new XflLayer(location, layerEl, _errors, false));
                }
            }
        }
    }

    public function checkSymbols (lib :XflLibrary) :void {
        if (flipbook && !lib.hasSymbol(symbol)) {
            addError(ParseError.CRIT, "Flipbook movie '" + symbol + "' not exported");
        } else for each (var layer :XflLayer in layers) layer.checkSymbols(lib);
    }

    public function get frames () :int {
        var frames :int = 0;
        for each (var layer :XflLayer in layers) frames = Math.max(frames, layer.frames);
        return frames;
    }

    public function get flipbook () :Boolean { return layers[0].flipbook; }

    public function toJSON (_:*) :Object {
        return {
            symbol: symbol,
            layers: layers,
            md5: md5
        };
    }

    public function toXML () :XML
    {
        var xml :XML = <movie
            name={libraryItem}
            md5={md5}
        />;
        for each (var layer :XflLayer in layers) {
            xml.appendChild(layer.toXML());
        }
        return xml;
    }
}
}

//
// Flump - Copyright 2012 Three Rings Design

package flump.xfl {

public class XflMovie extends XflTopLevelComponent
{
    use namespace xflns;

    public var libraryItem :String;
    public var symbol :String;
    public var layers :Array;

    // The hash of the XML file for this symbol in the library
    public var md5 :String;

    public function XflMovie (baseLocation :String, xml :XML, md5 :String) {
        const converter :XmlConverter = new XmlConverter(xml);
        libraryItem = converter.getStringAttr("name");
        super(baseLocation + ":" + libraryItem);
        this.md5 = md5;
        symbol = converter.getStringAttr("linkageClassName", null);

        const layerEls :XMLList = xml.timeline.DOMTimeline[0].layers.DOMLayer;
        if (new XmlConverter(layerEls[0]).getStringAttr("name") == "flipbook") {
            layers = [new XflLayer(location, layerEls[0], _errors, true)];
            if (symbol == null) {
                addError(ParseError.CRIT, "Flipbook movie '" + libraryItem + "' not exported");
            }
            for each (var kf :XflKeyframe in layers[0].keyframes) {
                kf.id = libraryItem + "_flipbook_" + kf.index;

            }
        } else {
            layers = new Array();
            for each (var layerEl :XML in layerEls) {
                if (new XmlConverter(layerEl).getStringAttr("layerType", "") != "guide") {
                    layers.unshift(new XflLayer(location, layerEl, _errors, false));
                }
            }
        }
    }

    public function checkSymbols (lib :XflLibrary) :void {
        if (flipbook && !lib.hasSymbol(symbol)) {
            addError(ParseError.CRIT, "Flipbook movie '" + symbol + "' not exported");
        } else for each (var layer :XflLayer in layers) layer.checkSymbols(lib);
    }

    public function get frames () :int {
        var frames :int = 0;
        for each (var layer :XflLayer in layers) frames = Math.max(frames, layer.frames);
        return frames;
    }

    public function get flipbook () :Boolean { return layers[0].flipbook; }

    public function toJSON (_:*) :Object {
        return {
            symbol: symbol,
            layers: layers,
            md5: md5
        };
    }

    public function toXML () :XML
    {
        var xml :XML = <movie
            name={symbol}
            md5={md5}
        />;
        for each (var layer :XflLayer in layers) {
            xml.appendChild(layer.toXML());
        }
        return xml;
    }
}
}

Use the symbol name for exported movies.


package com.dotfold.dotvimstat.model
{

	/**
	 * VideoEntity.
	 *
	 * Model class mapped to Vimeo video object.
	 *
	 * @author jamesmcnamee
	 *
	 */
	public class VideoEntity extends BaseEntity
	{

		/**
		 * Constructor.
		 */
		public function VideoEntity()
		{
			super();
		}

		public var description:String;
		public var duration:int;
		public var embed_privacy:String;
		public var height:int;
		public var mobile_url:String;
		public var stats_number_of_comments:int;
		public var stats_number_of_likes:int;
		public var stats_number_of_plays:int;
		public var tags:String;
		public var thumbnail_large:String;
		public var thumbnail_medium:String;
		public var thumbnail_small:String;
		public var title:String;
		public var upload_date:String;
		public var url:String;
		public var user_name:String;
		public var user_portrait_huge:String;
		public var user_portrait_large:String;
		public var user_portrait_medium:String;
		public var user_portrait_small:String;
		public var user_url:String;
		public var width:int;

	}
}

package com.dotfold.dotvimstat.model
{
	import com.dotfold.dotvimstat.model.enum.ImageSize;
	import com.dotfold.dotvimstat.model.image.EntityImage;
	import com.dotfold.dotvimstat.model.image.EntityImageCollection;

	/**
	 * VideoEntity.
	 *
	 * Model class mapped to Vimeo video object.
	 *
	 * @author jamesmcnamee
	 *
	 */
	public class VideoEntity extends BaseEntity
	{

		/**
		 * Constructor.
		 */
		public function VideoEntity()
		{
			super();
		}

		public var description:String;
		public var duration:int;
		public var embed_privacy:String;
		public var height:int;
		public var mobile_url:String;
		public var stats_number_of_comments:int;
		public var stats_number_of_likes:int;
		public var stats_number_of_plays:int;
		public var tags:String;
		public var title:String;
		public var upload_date:Date;
		public var url:String;
		public var user_name:String;
		public var user_url:String;
		public var width:int;

		//
		// Images
		//

		private var _thumbnail_small:String;
		public function get thumbnail_small():String
		{
			return _thumbnail_small;
		}

		public function set thumbnail_small(value:String):void
		{
			_thumbnail_small = value;

			var image:EntityImage = new EntityImage();
			image.url = value;
			image.size = ImageSize.SMALL;
			thumbnail_images.addItem(image);
		}

		private var _thumbnail_medium:String;
		public function get thumbnail_medium():String
		{
			return _thumbnail_medium;
		}

		public function set thumbnail_medium(value:String):void
		{
			_thumbnail_medium = value;

			var image:EntityImage = new EntityImage();
			image.url = value;
			image.size = ImageSize.MEDIUM;
			thumbnail_images.addItem(image);
		}

		private var _thumbnail_large:String;
		public function get thumbnail_large():String
		{
			return _thumbnail_large;
		}

		public function set thumbnail_large(value:String):void
		{
			_thumbnail_large = value;

			var image:EntityImage = new EntityImage();
			image.url = value;
			image.size = ImageSize.LARGE;
			thumbnail_images.addItem(image);
		}

		private var _user_portrait_small:String
		public function get user_portrait_small():String
		{
			return _user_portrait_small;
		}

		public function set user_portrait_small(value:String):void
		{
			_user_portrait_small = value;

			var image:EntityImage = new EntityImage();
			image.url = value;
			image.size = ImageSize.SMALL;
			user_portrait_images.addItem(image);
		}

		private var _user_portrait_medium:String
		public function get user_portrait_medium():String
		{
			return _user_portrait_medium;
		}

		public function set user_portrait_medium(value:String):void
		{
			_user_portrait_medium = value;

			var image:EntityImage = new EntityImage();
			image.url = value;
			image.size = ImageSize.MEDIUM;
			user_portrait_images.addItem(image);
		}

		private var _user_portrait_large:String
		public function get user_portrait_large():String
		{
			return _user_portrait_large;
		}

		public function set user_portrait_large(value:String):void
		{
			_user_portrait_large = value;

			var image:EntityImage = new EntityImage();
			image.url = value;
			image.size = ImageSize.LARGE;
			user_portrait_images.addItem(image);
		}

		private var _user_portrait_huge:String
		public function get user_portrait_huge():String
		{
			return _user_portrait_huge;
		}

		public function set user_portrait_huge(value:String):void
		{
			_user_portrait_huge = value;

			var image:EntityImage = new EntityImage();
			image.url = value;
			image.size = ImageSize.HUGE;
			user_portrait_images.addItem(image);
		}

		public var user_portrait_images:EntityImageCollection = new EntityImageCollection();
		public var thumbnail_images:EntityImageCollection = new EntityImageCollection();

	}
}

update video entity

[feat] update video entity

- use read dates
- improved image handling, use collection and ImageSize enum


package goplayer
{
  import org.asspec.specification.AbstractSpecification

  import flash.display.Sprite

  public class PackerSpecification extends AbstractSpecification
  {
    override protected function execute() : void
    {
      it("should pack two static items correctly", function () : void {
        const a : Sprite = getSquare(1)
        const b : Sprite = getSquare(1)

        Packer.packLeft(a, b)

        specify(b.x).should.equal(1)
      })
    }

    private static function getSquare(side : Number) : Sprite
    {
      const result : Sprite = new Sprite

      result.graphics.beginFill(0)
      result.graphics.drawRect(0, 0, side, side)
      result.graphics.endFill()

      return result
    }
  }
}

package goplayer
{
  import org.asspec.specification.AbstractSpecification

  import flash.display.Sprite

  public class PackerSpecification extends AbstractSpecification
  {
    override protected function execute() : void
    {
      const a : Sprite = getSquare(1)
      const b : Sprite = getSquare(1)

      it("should pack using internal widths", function () : void {
        Packer.packLeft(a, b)
        specify(b.x).should.equal(1)
      })

      it("should honor explicit widths", function () : void {
        Packer.packLeft([a, 2], b)
        specify(b.x).should.equal(2)
      })
    }

    private static function getSquare(side : Number) : Sprite
    {
      const result : Sprite = new Sprite

      result.graphics.beginFill(0)
      result.graphics.drawRect(0, 0, side, side)
      result.graphics.endFill()

      return result
    }
  }
}

Add test using explicit width to PackerSpecification.


/*
Copyright 2009, Matthew Eernisse (mde@fleegix.org) and Slide, Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/

package org.windmill.astest {
  import org.windmill.WMLogger;
  import flash.utils.*;

  public class ASTest {
    public static var testClassList:Array = [];
    public static var testList:Array = [];
    public static function run(files:Array = null):void {
      //['/flash/TestFoo.swf', '/flash/TestBar.swf']
      // If we're passed some files, load 'em up first
      // the loader will call back to this again when
      // it's done, with no args
      if (files) {
        ASTest.loadTestFiles(files);
        return;
      }
      ASTest.getCompleteListOfTests();
      ASTest.start();
    }

    public static function loadTestFiles(files:Array):void {
      ASTest.testClassList = [];
      WMLoader.load(files);
    }

    public static function start():void {
      for each (var obj:Object in ASTest.testList) {
        try {
          WMLogger.log('Running ' + obj.className + '.' + obj.methodName);
          obj.instance[obj.methodName].call(obj.instance);
        }
        catch (e:Error) {
          WMLogger.log(e.message);
        }
      }
    }

    public static function getCompleteListOfTests():void {
      var createTestItem:Function = function (item:Object,
          methodName:String):Object {
        return {
          methodName: methodName,
          instance: item.instance,
          className: item.className,
          classDescription: item.classDescription
        };
      }
      var testList:Array = [];
      // No args -- this is being re-invoked from WMLoader
      // now that we have our tests loaded
      for each (var item:Object in ASTest.testClassList) {
        WMLogger.log('className: ' + item.className);
        var currTestList:Array = [];
        var descr:XML;
        var hasSetup:Boolean = false;
        var hasTeardown:Boolean = false;
        descr = flash.utils.describeType(
            item.classDescription);
        var meth:*;
        for each (meth in descr..method) {
          var methodName:String = meth.@name.toXMLString();
          if (/^test/.test(methodName)) {
            currTestList.push(createTestItem(item, methodName));
          }
          // If there's a setup or teardown somewhere in there
          // flag them so we can prepend/append after adding all
          // the tests
          if (methodName == 'setup') {
            hasSetup = true;
          }
          if (methodName == 'teardown') {
            hasTeardown = true;
          }
        }
        // Prepend list with setup if one exists
        if (hasSetup) {
          currTestList.unshift(createTestItem(item, 'setup'));
        }
        // Append list with teardown if one exists
        if (hasTeardown) {
          currTestList.push(createTestItem(item, 'teardown'));
        }
        testList = testList.concat.apply(testList, currTestList);
      }
      ASTest.testList = testList;

    }
  }
}

/*
Copyright 2009, Matthew Eernisse (mde@fleegix.org) and Slide, Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/

package org.windmill.astest {
  import org.windmill.WMLogger;
  import flash.utils.*;

  public class ASTest {
    public static var testClassList:Array = [];
    public static var testList:Array = [];
    public static function run(files:Array = null):void {
      //['/flash/TestFoo.swf', '/flash/TestBar.swf']
      // If we're passed some files, load 'em up first
      // the loader will call back to this again when
      // it's done, with no args
      if (files) {
        ASTest.loadTestFiles(files);
        return;
      }
      ASTest.getCompleteListOfTests();
      ASTest.start();
    }

    public static function loadTestFiles(files:Array):void {
      ASTest.testClassList = [];
      ASTest.testList = [];
      WMLoader.load(files);
    }

    public static function start():void {
      for each (var obj:Object in ASTest.testList) {
        try {
          WMLogger.log('Running ' + obj.className + '.' + obj.methodName);
          obj.instance[obj.methodName].call(obj.instance);
        }
        catch (e:Error) {
          WMLogger.log(e.message);
        }
      }
    }

    public static function getCompleteListOfTests():void {
      var createTestItem:Function = function (item:Object,
          methodName:String):Object {
        return {
          methodName: methodName,
          instance: item.instance,
          className: item.className,
          classDescription: item.classDescription
        };
      }
      var testList:Array = [];
      // No args -- this is being re-invoked from WMLoader
      // now that we have our tests loaded
      for each (var item:Object in ASTest.testClassList) {
        WMLogger.log('className: ' + item.className);
        var currTestList:Array = [];
        var descr:XML;
        var hasSetup:Boolean = false;
        var hasTeardown:Boolean = false;
        descr = flash.utils.describeType(
            item.classDescription);
        var meth:*;
        for each (meth in descr..method) {
          var methodName:String = meth.@name.toXMLString();
          if (/^test/.test(methodName)) {
            currTestList.push(createTestItem(item, methodName));
          }
          // If there's a setup or teardown somewhere in there
          // flag them so we can prepend/append after adding all
          // the tests
          if (methodName == 'setup') {
            hasSetup = true;
          }
          if (methodName == 'teardown') {
            hasTeardown = true;
          }
        }
        // Prepend list with setup if one exists
        if (hasSetup) {
          currTestList.unshift(createTestItem(item, 'setup'));
        }
        // Append list with teardown if one exists
        if (hasTeardown) {
          currTestList.push(createTestItem(item, 'teardown'));
        }
        testList = testList.concat.apply(testList, currTestList);
      }
      ASTest.testList = testList;

    }
  }
}

Clear out the test list between test runs.


package aerys.minko.scene.controller.debug
{
	import aerys.minko.render.geometry.Geometry;
	import aerys.minko.render.geometry.primitive.LineGeometry;
	import aerys.minko.render.geometry.stream.iterator.TriangleIterator;
	import aerys.minko.render.geometry.stream.iterator.TriangleReference;
	import aerys.minko.render.material.line.LineMaterial;
	import aerys.minko.scene.controller.AbstractController;
	import aerys.minko.scene.node.Group;
	import aerys.minko.scene.node.ISceneNode;
	import aerys.minko.scene.node.Mesh;
	import aerys.minko.type.math.Matrix4x4;

	import flash.utils.Dictionary;

	public final class WireframeDebugController extends AbstractController
	{
		private static var _wireframeMaterial	: LineMaterial;

		private var _targetToWireframe	: Dictionary	= new Dictionary();
		private var _geometryToMesh		: Dictionary 	= new Dictionary();
		private var _visible 			: Boolean 		= true;

		public function get material() : LineMaterial
		{
			return _wireframeMaterial
				|| (_wireframeMaterial = new LineMaterial({diffuseColor : 0x509dc7ff, lineThickness	: 1.}));
		}

		public function set visible(value : Boolean) : void
		{
			_visible = value;

			for each (var wireframe : Mesh in _targetToWireframe)
				wireframe.visible = value;
		}

		public function get visible() : Boolean
		{
			return _visible;
		}

		public function WireframeDebugController()
		{
			super(Mesh);

			initialize();
		}

		private function initialize() : void
		{
			targetAdded.add(targetAddedHandler);
			targetRemoved.add(targetRemovedHandler);
		}

		private function targetAddedHandler(ctrl	: WireframeDebugController,
											target	: Mesh) : void
		{
			if (target.scene)
				addedHandler(target, target.parent);
			else
				target.added.add(addedHandler);
			target.removed.add(removedHandler);
		}

		private function addedHandler(target 	: Mesh,
									  ancestor	: Group) : void
		{
			if (!target.scene || target.geometry == null)
				return ;

			var triangles	: TriangleIterator = new TriangleIterator(
				target.geometry.getVertexStream(),
				target.geometry.indexStream
			);
			var linesGeom	: LineGeometry		= new LineGeometry();
			for each (var triangle : TriangleReference in triangles)
			{
				linesGeom.moveTo(triangle.v0.x, triangle.v0.y, triangle.v0.z)
					.lineTo(triangle.v1.x, triangle.v1.y, triangle.v1.z)
					.lineTo(triangle.v2.x, triangle.v2.y, triangle.v2.z)
					.lineTo(triangle.v0.x, triangle.v0.y, triangle.v0.z);
			}

			var lines		: Mesh				= new Mesh(linesGeom, this.material);
			lines.visible 	= _visible;
			_targetToWireframe[target] = lines;

			if (!target.localToWorldTransformChanged.hasCallback(updateTransform))
				target.localToWorldTransformChanged.add(updateTransform);

			updateTransform(target, target.getLocalToWorldTransform());
			target.scene.addChild(lines);
		}

		private function updateTransform(child : ISceneNode, childLocalToWorld : Matrix4x4) : void
		{
			var lineMesh : Mesh = _targetToWireframe[child];

			if (lineMesh == null)
				child.localToWorldTransformChanged.remove(updateTransform);
			else
				lineMesh.transform.copyFrom(childLocalToWorld);
		}

		private function removeWireframes(target : Mesh) : void
		{
			if (_targetToWireframe[target])
				_targetToWireframe[target].parent = null;
			_targetToWireframe[target] = null;
		}

		private function targetRemovedHandler(ctrl		: WireframeDebugController,
											  target	: Mesh) : void
		{
			if (target.added.hasCallback(addedHandler))
				target.added.remove(addedHandler);
			target.removed.remove(removedHandler);
			if (target.localToWorldTransformChanged.hasCallback(updateTransform))
				target.localToWorldTransformChanged.remove(updateTransform);
			removeWireframes(target);
		}

		private function removedHandler(target : Mesh, ancestor : Group) : void
		{
			removeWireframes(target);
		}

		override public function clone():AbstractController
		{
			return null;
		}
	}
}

package aerys.minko.scene.controller.debug
{
	import aerys.minko.render.geometry.Geometry;
	import aerys.minko.render.geometry.primitive.LineGeometry;
	import aerys.minko.render.geometry.stream.iterator.TriangleIterator;
	import aerys.minko.render.geometry.stream.iterator.TriangleReference;
	import aerys.minko.render.material.line.LineMaterial;
	import aerys.minko.scene.controller.AbstractController;
	import aerys.minko.scene.node.Group;
	import aerys.minko.scene.node.ISceneNode;
	import aerys.minko.scene.node.Mesh;
	import aerys.minko.type.math.Matrix4x4;

	import flash.utils.Dictionary;

	public final class WireframeDebugController extends AbstractController
	{
		private static var _wireframeMaterial	: LineMaterial;

		private var _targetToWireframe	: Dictionary	= new Dictionary();
		private var _geometryToMesh		: Dictionary 	= new Dictionary();
		private var _visible 			: Boolean 		= true;

		public function get material() : LineMaterial
		{
			return _wireframeMaterial
				|| (_wireframeMaterial = new LineMaterial({diffuseColor : 0x509dc7ff, lineThickness	: 1.}));
		}

		public function set visible(value : Boolean) : void
		{
			_visible = value;

			for each (var wireframe : Mesh in _targetToWireframe)
			{
				if (wireframe)
					wireframe.visible = value;
			}
		}

		public function get visible() : Boolean
		{
			return _visible;
		}

		public function WireframeDebugController()
		{
			super(Mesh);

			initialize();
		}

		private function initialize() : void
		{
			targetAdded.add(targetAddedHandler);
			targetRemoved.add(targetRemovedHandler);
		}

		private function targetAddedHandler(ctrl	: WireframeDebugController,
											target	: Mesh) : void
		{
			if (target.scene)
				addedHandler(target, target.parent);
			else
				target.added.add(addedHandler);
			target.removed.add(removedHandler);
		}

		private function addedHandler(target 	: Mesh,
									  ancestor	: Group) : void
		{
			if (!target.scene || target.geometry == null)
				return ;

			var triangles	: TriangleIterator = new TriangleIterator(
				target.geometry.getVertexStream(),
				target.geometry.indexStream
			);
			var linesGeom	: LineGeometry		= new LineGeometry();
			for each (var triangle : TriangleReference in triangles)
			{
				linesGeom.moveTo(triangle.v0.x, triangle.v0.y, triangle.v0.z)
					.lineTo(triangle.v1.x, triangle.v1.y, triangle.v1.z)
					.lineTo(triangle.v2.x, triangle.v2.y, triangle.v2.z)
					.lineTo(triangle.v0.x, triangle.v0.y, triangle.v0.z);
			}

			var lines		: Mesh				= new Mesh(linesGeom, this.material);
			lines.visible 	= _visible;
			_targetToWireframe[target] = lines;

			if (!target.localToWorldTransformChanged.hasCallback(updateTransform))
				target.localToWorldTransformChanged.add(updateTransform);

			updateTransform(target, target.getLocalToWorldTransform());
			target.scene.addChild(lines);
		}

		private function updateTransform(child : ISceneNode, childLocalToWorld : Matrix4x4) : void
		{
			var lineMesh : Mesh = _targetToWireframe[child];

			if (lineMesh == null)
				child.localToWorldTransformChanged.remove(updateTransform);
			else
				lineMesh.transform.copyFrom(childLocalToWorld);
		}

		private function removeWireframes(target : Mesh) : void
		{
			if (_targetToWireframe[target])
				_targetToWireframe[target].parent = null;
			_targetToWireframe[target] = null;
		}

		private function targetRemovedHandler(ctrl		: WireframeDebugController,
											  target	: Mesh) : void
		{
			if (target.added.hasCallback(addedHandler))
				target.added.remove(addedHandler);
			target.removed.remove(removedHandler);
			if (target.localToWorldTransformChanged.hasCallback(updateTransform))
				target.localToWorldTransformChanged.remove(updateTransform);
			removeWireframes(target);
		}

		private function removedHandler(target : Mesh, ancestor : Group) : void
		{
			removeWireframes(target);
		}

		override public function clone():AbstractController
		{
			return null;
		}
	}
}

Fix bug when a mesh is null during one frame


/*
 PureMVC AS3/MultiCore Pipes Utility Unit Tests
 Copyright (c) 2008 Cliff Hall<cliff.hall@puremvc.org>
 Your reuse is governed by the Creative Commons Attribution 3.0 License
*/
package org.puremvc.as3.multicore.utilities.pipes.plumbing
{
	import flexunit.framework.TestCase;
	import flexunit.framework.TestSuite;

	import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeFitting;
	import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeMessage;
	import org.puremvc.as3.multicore.utilities.pipes.messages.FilterControlMessage;
	import org.puremvc.as3.multicore.utilities.pipes.messages.Message;

 	/**
	 * Test the Filter class.
	 */
	public class FilterTest extends TestCase
	{

   		/**
  		 * Constructor.
  		 *
  		 * @param methodName the name of the test method an instance to run
  		 */
 	    public function FilterTest( methodName:String )
 	    {
   			super( methodName );
        }

 		/**
		 * Create the TestSuite.
		 */
 		public static function suite():TestSuite
 		{
   			var ts:TestSuite = new TestSuite();

   			ts.addTest( new FilterTest( "testConnectingIOPipes" ) );
   			ts.addTest( new FilterTest( "testFilteringNormalMessage" ) );
   			ts.addTest( new FilterTest( "testBypassAndFilterModeToggle" ) );
   			ts.addTest( new FilterTest( "testSetParamsByControlMessage" ) );
   			ts.addTest( new FilterTest( "testSetFilterByControlMessage" ) );
   			return ts;
   		}

  		/**
  		 * Test connecting input and output pipes to a filter.
  		 */
  		public function testConnectingIOPipes():void
  		{

  			// create output pipes 1
   			var pipe1:IPipeFitting = new Pipe();
   			var pipe2:IPipeFitting = new Pipe();

  			// create filter
   			var filter:Filter = new Filter( 'TestFilter' );

   			// connect input fitting
   			var connectedInput:Boolean 	= pipe1.connect( filter );

   			// connect output fitting
   			var connectedOutput:Boolean = filter.connect( pipe2 );

   			// test assertions
   			assertTrue( "Expecting pipe1 is Pipe", pipe1 is Pipe );
   			assertTrue( "Expecting pipe2 is Pipe", pipe2 is Pipe );
   			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting connected input", connectedInput );
   			assertTrue( "Expecting connected output", connectedOutput );
   		}

  		/**
  		 * Test applying filter to a normal message.
  		 */
  		public function testFilteringNormalMessage():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

   			// write messages to the filter
   			var written:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote message to filter", written );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions
   			var recieved:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved is IPipeMessage", recieved is IPipeMessage );
   			assertTrue( "Expecting recieved === message", recieved === message ); // object equality
   			assertTrue( "Expecting recieved.getHeader().width == 100", recieved.getHeader().width == 100 );
   			assertTrue( "Expecting recieved.getHeader().height == 20", recieved.getHeader().height == 20 );
   		}

  		/**
  		 * Test setting filter to bypass mode, writing, then setting back to filter mode and writing.
  		 */
  		public function testBypassAndFilterModeToggle():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

			// create bypass control message
			var bypassMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.BYPASS, 'scale');

   			// write bypass control message to the filter
   			var bypassWritten:Boolean = filter.write( bypassMessage );

   			// write normal message to the filter
   			var written1:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote bypass message to filter", bypassWritten );
   			assertTrue( "Expecting wrote normal message to filter", written1 );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (no change to message)
   			var recieved1:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved1 is IPipeMessage", recieved1 is IPipeMessage );
   			assertTrue( "Expecting recieved1 === message", recieved1 === message ); // object equality
   			assertTrue( "Expecting recieved1.getHeader().width == 10", recieved1.getHeader().width == 10 );
   			assertTrue( "Expecting recieved1.getHeader().height == 2", recieved1.getHeader().height == 2 );

			// create filter control message
			var filterMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.FILTER, 'scale');

   			// write bypass control message to the filter
   			var filterWritten:Boolean = filter.write( filterMessage );

   			// write normal message to the filter again
   			var written2:Boolean = filter.write( message );

			// test assertions
   			assertTrue( "Expecting wrote bypass message to filter", bypassWritten );
   			assertTrue( "Expecting wrote normal message to filter", written1 );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (message filtered)
   			var recieved2:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved2 is IPipeMessage", recieved2 is IPipeMessage );
   			assertTrue( "Expecting recieved2 === message", recieved2 === message ); // object equality
   			assertTrue( "Expecting recieved2.getHeader().width == 100", recieved2.getHeader().width == 100 );
   			assertTrue( "Expecting recieved2.getHeader().height == 20", recieved2.getHeader().height == 20 );
   		}

  		/**
  		 * Test setting filter parameters by sending control message.
  		 */
  		public function testSetParamsByControlMessage():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

			// create setParams control message
			var setParamsMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.SET_PARAMS, 'scale', null, {factor:5});

   			// write filter control message to the filter
   			var setParamsWritten:Boolean = filter.write( setParamsMessage );

   			// write normal message to the filter
   			var written:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote bypass message to filter", setParamsWritten );
   			assertTrue( "Expecting wrote normal message to filter", written );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (message filtered with overridden parameters)
   			var recieved:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved is IPipeMessage", recieved is IPipeMessage );
   			assertTrue( "Expecting recieved === message", recieved === message ); // object equality
   			assertTrue( "Expecting recieved.getHeader().width == 50", recieved.getHeader().width == 50 );
   			assertTrue( "Expecting recieved.getHeader().height == 10", recieved.getHeader().height == 10 );

   		}

  		/**
  		 * Test setting filter function by sending control message.
  		 */
  		public function testSetFilterByControlMessage():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

			// create setParams control message
			var setFilterMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.SET_FILTER, 'scale', function( message:IPipeMessage, params:Object ):void { message.getHeader().width /= params.factor; message.getHeader().height /= params.factor;  } );

   			// write filter control message to the filter
   			var setFilterWritten:Boolean = filter.write( setFilterMessage );

   			// write normal message to the filter
   			var written:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote bypass message to filter", setFilterWritten );
   			assertTrue( "Expecting wrote normal message to filter", written );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (message filtered with overridden filter function)
   			var recieved:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved is IPipeMessage", recieved is IPipeMessage );
   			assertTrue( "Expecting recieved === message", recieved === message ); // object equality
   			assertTrue( "Expecting recieved.getHeader().width == 1", recieved.getHeader().width == 1 );
   			assertTrue( "Expecting recieved.getHeader().height == .2", recieved.getHeader().height == .2 );

   		}

		/**
		 * Array of received messages.
		 *

		 * Used by callBackMedhod as a place to store
		 * the recieved messages.

		 */
   		private var messagesReceived:Array = new Array();

   		/**
   		 * Callback given to PipeListener for incoming message.
   		 *

   		 * Used by testReceiveMessageViaPipeListener
   		 * to get the output of pipe back into this  test to see
   		 * that a message passes through the pipe.

   		 */
   		private function callBackMethod( message:IPipeMessage ):void
   		{
   			this.messagesReceived.push( message );
   		}

	}
}

/*
 PureMVC AS3/MultiCore Pipes Utility Unit Tests
 Copyright (c) 2008 Cliff Hall<cliff.hall@puremvc.org>
 Your reuse is governed by the Creative Commons Attribution 3.0 License
*/
package org.puremvc.as3.multicore.utilities.pipes.plumbing
{
	import flexunit.framework.TestCase;
	import flexunit.framework.TestSuite;

	import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeFitting;
	import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeMessage;
	import org.puremvc.as3.multicore.utilities.pipes.messages.FilterControlMessage;
	import org.puremvc.as3.multicore.utilities.pipes.messages.Message;

 	/**
	 * Test the Filter class.
	 */
	public class FilterTest extends TestCase
	{

   		/**
  		 * Constructor.
  		 *
  		 * @param methodName the name of the test method an instance to run
  		 */
 	    public function FilterTest( methodName:String )
 	    {
   			super( methodName );
        }

 		/**
		 * Create the TestSuite.
		 */
 		public static function suite():TestSuite
 		{
   			var ts:TestSuite = new TestSuite();

   			ts.addTest( new FilterTest( "testConnectingAndDisconnectingIOPipes" ) );
   			ts.addTest( new FilterTest( "testFilteringNormalMessage" ) );
   			ts.addTest( new FilterTest( "testBypassAndFilterModeToggle" ) );
   			ts.addTest( new FilterTest( "testSetParamsByControlMessage" ) );
   			ts.addTest( new FilterTest( "testSetFilterByControlMessage" ) );
   			return ts;
   		}

  		/**
  		 * Test connecting input and output pipes to a filter as well as disconnecting the output.
  		 */
  		public function testConnectingAndDisconnectingIOPipes():void
  		{

  			// create output pipes 1
   			var pipe1:IPipeFitting = new Pipe();
   			var pipe2:IPipeFitting = new Pipe();

  			// create filter
   			var filter:Filter = new Filter( 'TestFilter' );

   			// connect input fitting
   			var connectedInput:Boolean 	= pipe1.connect( filter );

   			// connect output fitting
   			var connectedOutput:Boolean = filter.connect( pipe2 );

   			// test assertions
   			assertTrue( "Expecting pipe1 is Pipe", pipe1 is Pipe );
   			assertTrue( "Expecting pipe2 is Pipe", pipe2 is Pipe );
   			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting connected input", connectedInput );
   			assertTrue( "Expecting connected output", connectedOutput );

   			// disconnect pipe 2 from filter
   			var disconnectedPipe:IPipeFitting = filter.disconnect();
   			assertTrue( "Expecting disconnected pipe2 from filter", disconnectedPipe === pipe2 );
   		}

  		/**
  		 * Test applying filter to a normal message.
  		 */
  		public function testFilteringNormalMessage():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

   			// write messages to the filter
   			var written:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote message to filter", written );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions
   			var recieved:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved is IPipeMessage", recieved is IPipeMessage );
   			assertTrue( "Expecting recieved === message", recieved === message ); // object equality
   			assertTrue( "Expecting recieved.getHeader().width == 100", recieved.getHeader().width == 100 );
   			assertTrue( "Expecting recieved.getHeader().height == 20", recieved.getHeader().height == 20 );
   		}

  		/**
  		 * Test setting filter to bypass mode, writing, then setting back to filter mode and writing.
  		 */
  		public function testBypassAndFilterModeToggle():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

			// create bypass control message
			var bypassMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.BYPASS, 'scale');

   			// write bypass control message to the filter
   			var bypassWritten:Boolean = filter.write( bypassMessage );

   			// write normal message to the filter
   			var written1:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote bypass message to filter", bypassWritten );
   			assertTrue( "Expecting wrote normal message to filter", written1 );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (no change to message)
   			var recieved1:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved1 is IPipeMessage", recieved1 is IPipeMessage );
   			assertTrue( "Expecting recieved1 === message", recieved1 === message ); // object equality
   			assertTrue( "Expecting recieved1.getHeader().width == 10", recieved1.getHeader().width == 10 );
   			assertTrue( "Expecting recieved1.getHeader().height == 2", recieved1.getHeader().height == 2 );

			// create filter control message
			var filterMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.FILTER, 'scale');

   			// write bypass control message to the filter
   			var filterWritten:Boolean = filter.write( filterMessage );

   			// write normal message to the filter again
   			var written2:Boolean = filter.write( message );

			// test assertions
   			assertTrue( "Expecting wrote bypass message to filter", bypassWritten );
   			assertTrue( "Expecting wrote normal message to filter", written1 );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (message filtered)
   			var recieved2:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved2 is IPipeMessage", recieved2 is IPipeMessage );
   			assertTrue( "Expecting recieved2 === message", recieved2 === message ); // object equality
   			assertTrue( "Expecting recieved2.getHeader().width == 100", recieved2.getHeader().width == 100 );
   			assertTrue( "Expecting recieved2.getHeader().height == 20", recieved2.getHeader().height == 20 );
   		}

  		/**
  		 * Test setting filter parameters by sending control message.
  		 */
  		public function testSetParamsByControlMessage():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

			// create setParams control message
			var setParamsMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.SET_PARAMS, 'scale', null, {factor:5});

   			// write filter control message to the filter
   			var setParamsWritten:Boolean = filter.write( setParamsMessage );

   			// write normal message to the filter
   			var written:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote bypass message to filter", setParamsWritten );
   			assertTrue( "Expecting wrote normal message to filter", written );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (message filtered with overridden parameters)
   			var recieved:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved is IPipeMessage", recieved is IPipeMessage );
   			assertTrue( "Expecting recieved === message", recieved === message ); // object equality
   			assertTrue( "Expecting recieved.getHeader().width == 50", recieved.getHeader().width == 50 );
   			assertTrue( "Expecting recieved.getHeader().height == 10", recieved.getHeader().height == 10 );

   		}

  		/**
  		 * Test setting filter function by sending control message.
  		 */
  		public function testSetFilterByControlMessage():void
  		{
			// create messages to send to the queue
   			var message:IPipeMessage = new Message( Message.NORMAL, { width:10, height:2 });

  			// create filter, attach an anonymous listener to the filter output to receive the message,
  			// pass in an anonymous function an parameter object
   			var filter:Filter = new Filter( 'scale',
   											new PipeListener( this ,callBackMethod ),
   											function( message:IPipeMessage, params:Object ):void { message.getHeader().width *= params.factor; message.getHeader().height *= params.factor;  },
   											{ factor:10 }
   										  );

			// create setParams control message
			var setFilterMessage:FilterControlMessage = new FilterControlMessage(FilterControlMessage.SET_FILTER, 'scale', function( message:IPipeMessage, params:Object ):void { message.getHeader().width /= params.factor; message.getHeader().height /= params.factor;  } );

   			// write filter control message to the filter
   			var setFilterWritten:Boolean = filter.write( setFilterMessage );

   			// write normal message to the filter
   			var written:Boolean = filter.write( message );

   			// test assertions
			assertTrue( "Expecting message is IPipeMessage", message is IPipeMessage );
			assertTrue( "Expecting filter is Filter", filter is Filter );
   			assertTrue( "Expecting wrote bypass message to filter", setFilterWritten );
   			assertTrue( "Expecting wrote normal message to filter", written );
   			assertTrue( "Expecting received 1 messages", messagesReceived.length == 1 );

   			// test filtered message assertions (message filtered with overridden filter function)
   			var recieved:IPipeMessage = messagesReceived.shift() as IPipeMessage;
   			assertTrue( "Expecting recieved is IPipeMessage", recieved is IPipeMessage );
   			assertTrue( "Expecting recieved === message", recieved === message ); // object equality
   			assertTrue( "Expecting recieved.getHeader().width == 1", recieved.getHeader().width == 1 );
   			assertTrue( "Expecting recieved.getHeader().height == .2", recieved.getHeader().height == .2 );

   		}

		/**
		 * Array of received messages.
		 *

		 * Used by callBackMedhod as a place to store
		 * the recieved messages.

		 */
   		private var messagesReceived:Array = new Array();

   		/**
   		 * Callback given to PipeListener for incoming message.
   		 *

   		 * Used by testReceiveMessageViaPipeListener
   		 * to get the output of pipe back into this  test to see
   		 * that a message passes through the pipe.

   		 */
   		private function callBackMethod( message:IPipeMessage ):void
   		{
   			this.messagesReceived.push( message );
   		}

	}
}

test disconnect

test disconnect


//
// $Id: $

package flash.errors {

public class MemoryError extends Error
{
}

public class IllegalOperationError extends Error
{
    public function IllegalOperationError (str :String = null)
    {
    }
}
}

package flash.events {

import flash.utils.Dictionary;

public class Event
{
    public static const CONNECT :String = "connect";
    public static const CLOSE :String = "close";

    public function Event (type :String, bubbles :Boolean = false, cancelable :Boolean = false)
    {
        if (bubbles || cancelable) {
            throw new Error("Not implemented");
        }
        _type = type;
    }

    public function get type () :String
    {
        return _type;
    }

    public function get target () :Object
    {
        return null;
    }

    public function clone () :Event
    {
        return new Event(_type);
    }

    private var _type :String;
}

public class EventDispatcher
{
    public function addEventListener (
        type :String, listener :Function, useCapture :Boolean = false,
        priority :int = 0, useWeakReference :Boolean = false) :void
    {
        if (useCapture || priority != 0 || useWeakReference) {
            throw new Error("Fancy addEventListener not implemented");
        }

        var listeners :Array = _listenerMap[type] as Array;
        if (listeners == null) {
            _listenerMap[type] = listeners = new Array();

        } else if (-1 == _listenerMap.indexOf(listener)) {
            return;
        }
        listeners.push(listener);
    }

    public function removeEventListener (
        type :String, listener :Function, useCapture :Boolean = false) :void
    {
        if (useCapture) {
            throw new Error("Fancy removeListener not implemented");
        }
        var listeners :Array = _listenerMap[type] as Array;
        if (listeners != null) {
            var ix :int = listeners.indexOf(listener);
            if (ix >= 0) {
                listeners.splice(ix, 1);
            }
        }
    }

    public function dispatchEvent (event :Event) :Boolean
    {
        var listeners :Array = _listenerMap[event.type] as Array;
        for each (var listener :Function in listeners) {
            try {
                listener(event);
            } catch (err :Error) {
                trace("Event[" + event + "] dispatch error: " + err);
            }
        }
        // TODO: "A value of true unless preventDefault() is called on the event,
        //        in which case it returns false. "
        return true;
    }

    private var _listenerMap :Dictionary = new Dictionary();
}

public class TimerEvent extends Event
{
    public static const TIMER :String = "timer";
    public static const TIMER_COMPLETE :String = "timerComplete";

    public function TimerEvent (
        type :String, bubbles :Boolean = false, cancelable :Boolean = false, text :String = "")
    {
        super(type, bubbles, cancelable);
    }
}
}

package flash.utils {

import flash.events.EventDispatcher;

import avmplus.*;

public function describeType (c :Object) :XML
{
    throw new Error("describeType() Not implemented");
}

public function getDefinitionByName (c :String) :Class
{
    return getClassByName(c);
}

public function getQualifiedClassName (c :Object) :String
{
    return "Test";
    throw new Error("Not implemented");
}

public function getTimer () :int
{
    return System.getTimer();
}

public interface IDataInput
{
    function readBytes(bytes :ByteArray, offset :uint=0, length :uint=0) :void;
    function readBoolean() :Boolean;
    function readByte() :int;
    function readUnsignedByte() :uint;
    function readShort() :int;
    function readUnsignedShort() :uint;
    function readInt() :int;
    function readUnsignedInt() :uint;
    function readFloat() :Number;
    function readDouble() :Number;
    function readUTF() :String;
    function readUTFBytes(length :uint) :String;
    function get bytesAvailable() :uint;
    function get endian() :String;
    function set endian(type :String) :void;
}

public interface IDataOutput
{
    function writeBytes(bytes :ByteArray, offset :uint = 0, length :uint = 0) :void;
    function writeBoolean(value :Boolean) :void;
    function writeByte(value :int) :void;
    function writeShort(value :int) :void;
    function writeInt(value :int) :void;
    function writeUnsignedInt(value :uint) :void;
    function writeFloat(value :Number) :void;
    function writeDouble(value :Number) :void;
    function writeUTF(value :String) :void;
    function writeUTFBytes(value :String) :void;
    function get endian() :String;
    function set endian(type :String) :void;
}
}

//
// $Id: $

package flash.errors {

public class MemoryError extends Error
{
}

public class IllegalOperationError extends Error
{
    public function IllegalOperationError (str :String = null)
    {
    }
}
}

package flash.events {

import flash.utils.Dictionary;

public class Event
{
    public static const CONNECT :String = "connect";
    public static const CLOSE :String = "close";

    public function Event (type :String, bubbles :Boolean = false, cancelable :Boolean = false)
    {
        if (bubbles || cancelable) {
            throw new Error("Not implemented");
        }
        _type = type;
    }

    public function get type () :String
    {
        return _type;
    }

    public function get target () :Object
    {
        return null;
    }

    public function clone () :Event
    {
        return new Event(_type);
    }

    private var _type :String;
}

public class EventDispatcher
{
    public function addEventListener (
        type :String, listener :Function, useCapture :Boolean = false,
        priority :int = 0, useWeakReference :Boolean = false) :void
    {
        if (useCapture || priority != 0 || useWeakReference) {
            throw new Error("Fancy addEventListener not implemented");
        }

        var listeners :Array = _listenerMap[type] as Array;
        if (listeners == null) {
            _listenerMap[type] = listeners = new Array();

        } else if (-1 == _listenerMap.indexOf(listener)) {
            return;
        }
        listeners.push(listener);
    }

    public function removeEventListener (
        type :String, listener :Function, useCapture :Boolean = false) :void
    {
        if (useCapture) {
            throw new Error("Fancy removeListener not implemented");
        }
        var listeners :Array = _listenerMap[type] as Array;
        if (listeners != null) {
            var ix :int = listeners.indexOf(listener);
            if (ix >= 0) {
                listeners.splice(ix, 1);
            }
        }
    }

    public function dispatchEvent (event :Event) :Boolean
    {
        var listeners :Array = _listenerMap[event.type] as Array;
        for each (var listener :Function in listeners) {
            try {
                listener(event);
            } catch (err :Error) {
                trace("Event[" + event + "] dispatch error: " + err);
            }
        }
        // TODO: "A value of true unless preventDefault() is called on the event,
        //        in which case it returns false. "
        return true;
    }

    private var _listenerMap :Dictionary = new Dictionary();
}

public class TimerEvent extends Event
{
    public static const TIMER :String = "timer";
    public static const TIMER_COMPLETE :String = "timerComplete";

    public function TimerEvent (
        type :String, bubbles :Boolean = false, cancelable :Boolean = false, text :String = "")
    {
        super(type, bubbles, cancelable);
    }
}
}

package flash.utils {

import flash.events.EventDispatcher;
import flash.events.TimerEvent;

import avmplus.*;

public function describeType (c :Object) :XML
{
    throw new Error("describeType() Not implemented");
}

public function getDefinitionByName (c :String) :Class
{
    return getClassByName(c);
}

public function getQualifiedClassName (c :Object) :String
{
    return "Test";
    throw new Error("Not implemented");
}

var timers :Dictionary = new Dictionary();
var timerIx :uint = 1;

public function setTimeout (closure :Function, delay :Number, ... arguments) :uint
{
    return createTimer(closure, delay, true, arguments);
}

public function setInterval (closure :Function, delay :Number, ... arguments) :uint
{
    return createTimer(closure, delay, false, arguments);
}

public function clearTimeout (id :uint): void
{
    destroyTimer(id);
}

public function clearInterval (id :uint): void
{
    destroyTimer(id);
}

public function getTimer () :int
{
    return System.getTimer();
}

function createTimer (closure :Function, delay :Number, timeout :Boolean, ... arguments) :uint
{
    var timer :Timer = new Timer(delay, timeout ? 1 : 0);
    var fun :Function = function (event :TimerEvent) :void {
        if (timeout) {
            destroyTimer(timerIx);
        }
        closure.apply(null, arguments);
    };
    timer.addEventListener(TimerEvent.TIMER, fun);
    timers[timerIx] = [ timer, fun ];
    return timerIx ++;
}

function destroyTimer (id :uint) :void
{
    var bits :Array = timers[id];
    if (bits) {
        bits[0].removeEventListener(TimerEvent.TIMER, bits[1]);
        bits[0].stop();
        delete timers[id];
    }
}

public interface IDataInput
{
    function readBytes(bytes :ByteArray, offset :uint=0, length :uint=0) :void;
    function readBoolean() :Boolean;
    function readByte() :int;
    function readUnsignedByte() :uint;
    function readShort() :int;
    function readUnsignedShort() :uint;
    function readInt() :int;
    function readUnsignedInt() :uint;
    function readFloat() :Number;
    function readDouble() :Number;
    function readUTF() :String;
    function readUTFBytes(length :uint) :String;
    function get bytesAvailable() :uint;
    function get endian() :String;
    function set endian(type :String) :void;
}

public interface IDataOutput
{
    function writeBytes(bytes :ByteArray, offset :uint = 0, length :uint = 0) :void;
    function writeBoolean(value :Boolean) :void;
    function writeByte(value :int) :void;
    function writeShort(value :int) :void;
    function writeInt(value :int) :void;
    function writeUnsignedInt(value :uint) :void;
    function writeFloat(value :Number) :void;
    function writeDouble(value :Number) :void;
    function writeUTF(value :String) :void;
    function writeUTFBytes(value :String) :void;
    function get endian() :String;
    function set endian(type :String) :void;
}
}

Implement flash.utils.setTimeout() and friends. We don't use them, but user code surely does. Is it kosher to instantiate a lookup table like this, right in the global context? Is it private to my code?


package dolly.data {

public class PropertyLevelCopyableCloneableClass {

	[Copyable]
	[Cloneable]
	public static var staticProperty1:String;

	[Copyable]
	[Cloneable]
	private var _writableField1:String;

	[Copyable]
	[Cloneable]
	private var _readOnlyField1:String = "read-only field value";

	[Cloneable]
	public var property1:String;

	public function PropertyLevelCopyableCloneableClass() {
	}

	[Copyable]
	[Cloneable]
	public function get writableField1():String {
		return _writableField1;
	}

	public function set writableField1(value:String):void {
		_writableField1 = value;
	}

	[Copyable]
	[Cloneable]
	public function get readOnlyField1():String {
		return _readOnlyField1;
	}
}
}

package dolly.data {

public class PropertyLevelCopyableCloneableClass {

	[Copyable]
	[Cloneable]
	public static var staticProperty1:String = "Value of first-level static property.";

	[Copyable]
	[Cloneable]
	private var _writableField1:String = "Value of first-level writable field.";

	[Cloneable]
	public var property1:String = "Value of first-level public property.";

	public function PropertyLevelCopyableCloneableClass() {
	}

	[Copyable]
	[Cloneable]
	public function get writableField1():String {
		return _writableField1;
	}

	public function set writableField1(value:String):void {
		_writableField1 = value;
	}

	[Copyable]
	[Cloneable]
	public function get readOnlyField1():String {
		return "Value of first-level read-only field.";
	}
}
}

Change properties' values.

Change properties' values.


/* Vivified
 * Copyright (C) 2007 Benjamin Otte <otte@gnome.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

/*** general objects ***/

Wrap = function () {};
Wrap.prototype = {};
Wrap.prototype.toString = Native.wrap_toString;

Frame = function () extends Wrap {};
Frame.prototype = new Wrap ();
Frame.prototype.addProperty ("code", Native.frame_code_get, null);
Frame.prototype.addProperty ("name", Native.frame_name_get, null);
Frame.prototype.addProperty ("next", Native.frame_next_get, null);

/*** breakpoints ***/

Breakpoint = function () extends Native.Breakpoint {
  super ();
  Breakpoint.list.push (this);
};
Breakpoint.list = new Array ();
Breakpoint.prototype.addProperty ("active", Native.breakpoint_active_get, Native.breakpoint_active_set);

/*** information about the player ***/

Player = {};
Player.addProperty ("frame", Native.player_frame_get, null);

/*** commands available for debugging ***/

Commands = new Object ();
Commands.print = Native.print;
Commands.error = Native.error;
Commands.r = Native.run;
Commands.run = Native.run;
Commands.halt = Native.stop;
Commands.stop = Native.stop;
Commands.s = Native.step;
Commands.step = Native.step;
Commands.reset = Native.reset;
Commands.restart = function () {
  Commands.reset ();
  Commands.run ();
};
Commands.quit = Native.quit;
/* can't use "break" as a function name, it's a keyword in JS */
Commands.add = function (name) {
  if (name == undefined) {
    Commands.error ("add command requires a function name");
    return undefined;
  }
  var ret = new Breakpoint ();
  ret.onStartFrame = function (frame) {
    if (frame.name != name)
      return false;

    Commands.print ("Breakpoint: function " + name + " called");
    Commands.print ("  " + frame);
    return true;
  };
  ret.toString = function () {
    return "function call " + name;
  };
  return ret;
};
Commands.list = function () {
  var a = Breakpoint.list;
  var i;
  for (i = 0; i < a.length; i++) {
    Commands.print (i + ": " + a[i]);
  }
};
Commands.del = function (id) {
  var a = Breakpoint.list;
  if (id == undefined) {
    while (a[0])
      Commands.del (0);
  }
  var b = a[id];
  a.splice (id, 1);
  b.active = false;
};
Commands.delete = Commands.del;
Commands.where = function () {
  var frame = Player.frame;
  if (frame == undefined) {
    print ("---");
    return;
  }
  while (frame) {
    print (frame);
    frame = frame.next;
  }
};
Commands.backtrace = Commands.where;
Commands.bt = Commands.where;

/* Vivified
 * Copyright (C) 2007 Benjamin Otte <otte@gnome.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

/*** general objects ***/

Wrap = function () {};
Wrap.prototype = {};
Wrap.prototype.toString = Native.wrap_toString;

Frame = function () extends Wrap {};
Frame.prototype = new Wrap ();
Frame.prototype.addProperty ("code", Native.frame_code_get, null);
Frame.prototype.addProperty ("name", Native.frame_name_get, null);
Frame.prototype.addProperty ("next", Native.frame_next_get, null);

/*** breakpoints ***/

Breakpoint = function () extends Native.Breakpoint {
  super ();
  Breakpoint.list.push (this);
};
Breakpoint.list = new Array ();
Breakpoint.prototype.addProperty ("active", Native.breakpoint_active_get, Native.breakpoint_active_set);

/*** information about the player ***/

Player = {};
Player.addProperty ("frame", Native.player_frame_get, null);

/*** commands available for debugging ***/

Commands = new Object ();
Commands.print = Native.print;
Commands.error = Native.error;
Commands.r = Native.run;
Commands.run = Native.run;
Commands.halt = Native.stop;
Commands.stop = Native.stop;
Commands.s = Native.step;
Commands.step = Native.step;
Commands.reset = Native.reset;
Commands.restart = function () {
  Commands.reset ();
  Commands.run ();
};
Commands.quit = Native.quit;
/* can't use "break" as a function name, it's a keyword in JS */
Commands.add = function (name) {
  if (name == undefined) {
    Commands.error ("add command requires a function name");
    return undefined;
  }
  var ret = new Breakpoint ();
  ret.onStartFrame = function (frame) {
    if (frame.name != name)
      return false;

    Commands.print ("Breakpoint: function " + name + " called");
    Commands.print ("  " + frame);
    return true;
  };
  ret.toString = function () {
    return "function call " + name;
  };
  return ret;
};
Commands.list = function () {
  var a = Breakpoint.list;
  var i;
  for (i = 0; i < a.length; i++) {
    Commands.print (i + ": " + a[i]);
  }
};
Commands.del = function (id) {
  var a = Breakpoint.list;
  if (id == undefined) {
    while (a[0])
      Commands.del (0);
  }
  var b = a[id];
  a.splice (id, 1);
  b.active = false;
};
Commands.delete = Commands.del;
Commands.where = function () {
  var frame = Player.frame;
  if (frame == undefined) {
    Commands.print ("---");
    return;
  }
  var i = 0;
  while (frame) {
    Commands.print (i++ + ": " + frame);
    frame = frame.next;
  }
};
Commands.backtrace = Commands.where;
Commands.bt = Commands.where;

make backtrace function actually work

make backtrace function actually work


import mx.transitions.easing.*;
import com.mosesSupposes.fuse.*;

class com.segonquart.menuColouridiomes extends MoviieClip

	{
		public var cat, es, en ,fr:MovieClip;
		public var arrayLang_arr:Array = new Array ("cat", "es", "en", "fr");

		function menuColourIdiomes ():Void

		{

		this.onRollOver = this.mOver;
		this.onRollOut = this.mOut;
		this.onRelease =this.mOver;

		}

		private function mOver():Void

		{

                arrayLang_arr[i].colorTo("#95C60D", 0.3, "easeOutCirc");

		}

		private function mOut():Void

		{

                arrayLang_arr[i].colorTo("#010101", 0.3, "easeInCirc");

		}

	}

import mx.transitions.easing.*;
import com.mosesSupposes.fuse.*;

class menuColouridiomes extends MoviieClip

	{
		public var cat, es, en ,fr:MovieClip;
		public var arrayLang_arr:Array = new Array ("cat", "es", "en", "fr");

		function menuColourIdiomes ():Void

		{

		this.onRollOver = this.mOver;
		this.onRollOut = this.mOut;
		this.onRelease =this.mOver;

		}

		private function mOver():Void

		{

                arrayLang_arr[i].colorTo("#95C60D", 0.3, "easeOutCirc");

		}

		private function mOut():Void

		{

                arrayLang_arr[i].colorTo("#010101", 0.3, "easeInCirc");

		}

	}

Update menuColourIdiomes.as

Update menuColourIdiomes.as


package {

  import flash.display.Sprite;
  import flash.display.Stage;
  import flash.display.StageAlign;
  import flash.display.StageScaleMode;
  import flash.display.StageDisplayState;
  import flash.events.Event;
  import flash.events.MouseEvent;
  import flash.external.ExternalInterface;
  import flash.media.Video;
  import flash.system.Security;

  import com.axis.http.url;
  import com.axis.IClient;
  import com.axis.ClientEvent;

  import com.axis.rtspclient.RTSPClient;
  import com.axis.rtspclient.IRTSPHandle;
  import com.axis.rtspclient.RTSPoverTCPHandle;
  import com.axis.rtspclient.RTSPoverHTTPHandle;
  import com.axis.httpclient.HTTPClient;
  import com.axis.rtmpclient.RTMPClient;

  import com.axis.audioclient.AxisTransmit;

  [SWF(frameRate="60")]
  [SWF(backgroundColor="#efefef")]

  public class Player extends Sprite {
    private var config:Object = {
      'buffer' : 1,
      'scaleUp' : false
    };
    private var video:Video;
    private var audioTransmit:AxisTransmit = new AxisTransmit();
    private var meta:Object = {};
    private var client:IClient;

    public function Player() {
      var self:Player = this;

      Security.allowDomain("*");
      Security.allowInsecureDomain("*");

      ExternalInterface.marshallExceptions = true;

      /* Media player API */
      ExternalInterface.addCallback("play", play);
      ExternalInterface.addCallback("pause", pause);
      ExternalInterface.addCallback("resume", resume);
      ExternalInterface.addCallback("stop", stop);

      /* Audio Transmission API */
      ExternalInterface.addCallback("startAudioTransmit", audioTransmitStartInterface);
      ExternalInterface.addCallback("stopAudioTransmit", audioTransmitStopInterface);

      this.stage.align = StageAlign.TOP_LEFT;
      this.stage.scaleMode = StageScaleMode.NO_SCALE;
      addEventListener(Event.ADDED_TO_STAGE, onStageAdded);

      video = new Video(stage.stageWidth, stage.stageHeight);
      addChild(video);

      this.stage.doubleClickEnabled = true;
      this.stage.addEventListener(MouseEvent.DOUBLE_CLICK, fullscreen);
      this.stage.addEventListener(Event.FULLSCREEN, function(event:Event):void {
        videoResize();
      });
    }

    public function fullscreen(event:MouseEvent):void
    {
      this.stage.displayState = (StageDisplayState.NORMAL === stage.displayState) ?
        StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL;
    }

    public function videoResize():void
    {
      var stagewidth:uint = (StageDisplayState.NORMAL === stage.displayState) ?
        stage.stageWidth : stage.fullScreenWidth;
      var stageheight:uint = (StageDisplayState.NORMAL === stage.displayState) ?
        stage.stageHeight : stage.fullScreenHeight;

      var scale:Number = ((stagewidth / meta.width) > (stageheight / meta.height)) ?
        (stageheight / meta.height) : (stagewidth / meta.width);

      video.width = meta.width;
      video.height = meta.height;
      if ((scale < 1.0) || (scale > 1.0 && true === config.scaleUp)) {
        trace('scaling video, scale:', scale.toFixed(2), ' (aspect ratio: ' +  (video.width / video.height).toFixed(2) + ')');
        video.width = meta.width * scale;
        video.height = meta.height * scale;
      }

      video.x = (stagewidth - video.width) / 2;
      video.y = (stageheight - video.height) / 2;
    }

    public function play(iurl:String = null):void
    {
      var urlParsed:Object = url.parse(iurl);

      if (client) {
        client.stop();
        video.clear();
      }

      switch (urlParsed.protocol) {
      case 'rtsph':
        /* RTSP over HTTP */
        client = new RTSPClient(this.video, urlParsed, new RTSPoverHTTPHandle(urlParsed));
        break;

      case 'rtsp':
        /* RTSP over TCP */
        client = new RTSPClient(this.video, urlParsed, new RTSPoverTCPHandle(urlParsed));
        break;

      case 'http':
        /* Progressive download over HTTP */
        client = new HTTPClient(this.video, urlParsed);
        break;

      case 'rtmp':
        /* RTMP */
        client = new RTMPClient(this.video, urlParsed);
        break;

      default:
        trace('Unknown streaming protocol:', urlParsed.protocol)
        return;
      }

      client.addEventListener(ClientEvent.NETSTREAM_CREATED, onNetStreamCreated);
      client.start();
    }

    public function pause():void
    {
      client.pause();
    }

    public function resume():void
    {
      client.resume();
    }

    public function stop():void
    {
      client.stop();
    }

    public function audioTransmitStopInterface():void {
      audioTransmit.stop();
    }

    public function audioTransmitStartInterface(url:String = null):void {
      audioTransmit.start(url);
    }

    private function onStageAdded(e:Event):void {
      trace('stage added');
    }

    public function onMetaData(item:Object):void
    {
      this.meta = item;
      this.videoResize();
    }

    public function onNetStreamCreated(ev:ClientEvent):void
    {
      ev.data.ns.bufferTime = config.bufferTime;
      ev.data.ns.client = this;
    }
  }
}

package {

  import flash.display.Sprite;
  import flash.display.Stage;
  import flash.display.StageAlign;
  import flash.display.StageScaleMode;
  import flash.display.StageDisplayState;
  import flash.events.Event;
  import flash.events.MouseEvent;
  import flash.external.ExternalInterface;
  import flash.media.Video;
  import flash.system.Security;

  import com.axis.http.url;
  import com.axis.IClient;
  import com.axis.ClientEvent;

  import com.axis.rtspclient.RTSPClient;
  import com.axis.rtspclient.IRTSPHandle;
  import com.axis.rtspclient.RTSPoverTCPHandle;
  import com.axis.rtspclient.RTSPoverHTTPHandle;
  import com.axis.httpclient.HTTPClient;
  import com.axis.rtmpclient.RTMPClient;

  import com.axis.audioclient.AxisTransmit;

  [SWF(frameRate="60")]
  [SWF(backgroundColor="#efefef")]

  public class Player extends Sprite {
    private var config:Object = {
      'buffer' : 1,
      'scaleUp' : false
    };
    private var video:Video;
    private var audioTransmit:AxisTransmit = new AxisTransmit();
    private var meta:Object = {};
    private var client:IClient;

    public function Player() {
      var self:Player = this;

      Security.allowDomain("*");
      Security.allowInsecureDomain("*");

      ExternalInterface.marshallExceptions = true;

      /* Media player API */
      ExternalInterface.addCallback("play", play);
      ExternalInterface.addCallback("pause", pause);
      ExternalInterface.addCallback("resume", resume);
      ExternalInterface.addCallback("stop", stop);

      /* Audio Transmission API */
      ExternalInterface.addCallback("startAudioTransmit", audioTransmitStartInterface);
      ExternalInterface.addCallback("stopAudioTransmit", audioTransmitStopInterface);

      this.stage.align = StageAlign.TOP_LEFT;
      this.stage.scaleMode = StageScaleMode.NO_SCALE;
      addEventListener(Event.ADDED_TO_STAGE, onStageAdded);

      video = new Video(stage.stageWidth, stage.stageHeight);
      addChild(video);

      this.stage.doubleClickEnabled = true;
      this.stage.addEventListener(MouseEvent.DOUBLE_CLICK, fullscreen);
      this.stage.addEventListener(Event.FULLSCREEN, function(event:Event):void {
        videoResize();
      });
    }

    public function fullscreen(event:MouseEvent):void
    {
      this.stage.displayState = (StageDisplayState.NORMAL === stage.displayState) ?
        StageDisplayState.FULL_SCREEN : StageDisplayState.NORMAL;
    }

    public function videoResize():void
    {
      var stagewidth:uint = (StageDisplayState.NORMAL === stage.displayState) ?
        stage.stageWidth : stage.fullScreenWidth;
      var stageheight:uint = (StageDisplayState.NORMAL === stage.displayState) ?
        stage.stageHeight : stage.fullScreenHeight;

      var scale:Number = ((stagewidth / meta.width) > (stageheight / meta.height)) ?
        (stageheight / meta.height) : (stagewidth / meta.width);

      video.width = meta.width;
      video.height = meta.height;
      if ((scale < 1.0) || (scale > 1.0 && true === config.scaleUp)) {
        trace('scaling video, scale:', scale.toFixed(2), ' (aspect ratio: ' +  (video.width / video.height).toFixed(2) + ')');
        video.width = meta.width * scale;
        video.height = meta.height * scale;
      }

      video.x = (stagewidth - video.width) / 2;
      video.y = (stageheight - video.height) / 2;
    }

    public function play(iurl:String = null):void
    {
      var urlParsed:Object = url.parse(iurl);

      if (client) {
        stop();
      }

      switch (urlParsed.protocol) {
      case 'rtsph':
        /* RTSP over HTTP */
        client = new RTSPClient(this.video, urlParsed, new RTSPoverHTTPHandle(urlParsed));
        break;

      case 'rtsp':
        /* RTSP over TCP */
        client = new RTSPClient(this.video, urlParsed, new RTSPoverTCPHandle(urlParsed));
        break;

      case 'http':
        /* Progressive download over HTTP */
        client = new HTTPClient(this.video, urlParsed);
        break;

      case 'rtmp':
        /* RTMP */
        client = new RTMPClient(this.video, urlParsed);
        break;

      default:
        trace('Unknown streaming protocol:', urlParsed.protocol)
        return;
      }

      client.addEventListener(ClientEvent.NETSTREAM_CREATED, onNetStreamCreated);
      client.start();
    }

    public function pause():void
    {
      client.pause();
    }

    public function resume():void
    {
      client.resume();
    }

    public function stop():void
    {
      client.stop();
      video.clear();
    }

    public function audioTransmitStopInterface():void {
      audioTransmit.stop();
    }

    public function audioTransmitStartInterface(url:String = null):void {
      audioTransmit.start(url);
    }

    private function onStageAdded(e:Event):void {
      trace('stage added');
    }

    public function onMetaData(item:Object):void
    {
      this.meta = item;
      this.videoResize();
    }

    public function onNetStreamCreated(ev:ClientEvent):void
    {
      ev.data.ns.bufferTime = config.bufferTime;
      ev.data.ns.client = this;
    }
  }
}

Stop and clear video properly.

Player: Stop and clear video properly.


////////////////////////////////////////////////////////////////////////////////
//
//  Licensed to the Apache Software Foundation (ASF) under one or more
//  contributor license agreements.  See the NOTICE file distributed with
//  this work for additional information regarding copyright ownership.
//  The ASF licenses this file to You under the Apache License, Version 2.0
//  (the "License"); you may not use this file except in compliance with
//  the License.  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.beads.layouts
{
	import org.apache.flex.core.IBeadLayout;
	import org.apache.flex.core.IMeasurementBead;
	import org.apache.flex.core.IStrand;
	import org.apache.flex.core.IContainer;
	import org.apache.flex.core.IUIBase;
	import org.apache.flex.core.UIBase;
	import org.apache.flex.events.Event;
	import org.apache.flex.events.IEventDispatcher;

	/**
	 * ColumnLayout is a class that organizes the positioning of children
	 * of a container into a set of columns where each column's width is set to
	 * the maximum size of all of the children in that column.
	 *
	 *  @langversion 3.0
	 *  @playerversion Flash 10.2
	 *  @playerversion AIR 2.6
	 *  @productversion FlexJS 0.0
	 */
	public class VerticalColumnLayout implements IBeadLayout
	{
		/**
		 *  constructor
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10.2
		 *  @playerversion AIR 2.6
		 *  @productversion FlexJS 0.0
		 */
		public function VerticalColumnLayout()
		{
		}

		private var _strand:IStrand;

		/**
		 *  @copy org.apache.flex.core.IBead#strand
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10.2
		 *  @playerversion AIR 2.6
		 *  @productversion FlexJS 0.0
		 */
		public function set strand(value:IStrand):void
		{
			_strand = value;
		}

		private var _numColumns:int;

		/**
		 * The number of columns.
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10.2
		 *  @playerversion AIR 2.6
		 *  @productversion FlexJS 0.0
		 */
		public function get numColumns():int
		{
			return _numColumns;
		}
		public function set numColumns(value:int):void
		{
			_numColumns = value;
		}

        /**
         * @copy org.apache.flex.core.IBeadLayout#layout
         */
		public function layout():Boolean
		{
			var sw:Number = UIBase(_strand).width;
			var sh:Number = UIBase(_strand).height;

			var e:IUIBase;
			var i:int;
			var col:int = 0;
			var columns:Array = [];
			for (i = 0; i < numColumns; i++)
				columns[i] = 0;

			var children:Array = IContainer(_strand).getChildren();
			var n:int = children.length;

			// determine max widths of columns
			for (i = 0; i < n; i++) {
				e = children[i];
				var thisPrefWidth:int = 0;
				if (e is IStrand)
				{
					var mb:IMeasurementBead = e.getBeadByType(IMeasurementBead) as IMeasurementBead;
					if (mb)
						thisPrefWidth = mb.measuredWidth;
					else
						thisPrefWidth = e.width;
				}
				else
					thisPrefWidth = e.width;

				columns[col] = Math.max(columns[col], thisPrefWidth);
				col = (col + 1) % numColumns;
			}

			var curx:int = 0;
			var cury:int = 0;
			var maxHeight:int = 0;
			col = 0;
			for (i = 0; i < n; i++) {
				e = children[i];
				e.x = curx;
				e.y = cury;
				curx += columns[col++];
				maxHeight = Math.max(e.height, maxHeight);
				if (col == numColumns)
				{
					cury += maxHeight;
					maxHeight = 0;
					col = 0;
					curx = 0;
				}
			}

			return true;
		}
	}
}

////////////////////////////////////////////////////////////////////////////////
//
//  Licensed to the Apache Software Foundation (ASF) under one or more
//  contributor license agreements.  See the NOTICE file distributed with
//  this work for additional information regarding copyright ownership.
//  The ASF licenses this file to You under the Apache License, Version 2.0
//  (the "License"); you may not use this file except in compliance with
//  the License.  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package org.apache.flex.html.beads.layouts
{
	import org.apache.flex.core.IBeadLayout;
	import org.apache.flex.core.IContainer;
	import org.apache.flex.core.IMeasurementBead;
	import org.apache.flex.core.IStrand;
	import org.apache.flex.core.IUIBase;
	import org.apache.flex.core.UIBase;
    import org.apache.flex.core.ValuesManager;
	import org.apache.flex.events.Event;
	import org.apache.flex.events.IEventDispatcher;
	import org.apache.flex.utils.CSSUtils;

	/**
	 * ColumnLayout is a class that organizes the positioning of children
	 * of a container into a set of columns where each column's width is set to
	 * the maximum size of all of the children in that column.
	 *
	 *  @langversion 3.0
	 *  @playerversion Flash 10.2
	 *  @playerversion AIR 2.6
	 *  @productversion FlexJS 0.0
	 */
	public class VerticalColumnLayout implements IBeadLayout
	{
		/**
		 *  constructor
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10.2
		 *  @playerversion AIR 2.6
		 *  @productversion FlexJS 0.0
		 */
		public function VerticalColumnLayout()
		{
		}

		private var _strand:IStrand;

		/**
		 *  @copy org.apache.flex.core.IBead#strand
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10.2
		 *  @playerversion AIR 2.6
		 *  @productversion FlexJS 0.0
		 */
		public function set strand(value:IStrand):void
		{
			_strand = value;
		}

		private var _numColumns:int;

		/**
		 * The number of columns.
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10.2
		 *  @playerversion AIR 2.6
		 *  @productversion FlexJS 0.0
		 */
		public function get numColumns():int
		{
			return _numColumns;
		}
		public function set numColumns(value:int):void
		{
			_numColumns = value;
		}

        /**
         * @copy org.apache.flex.core.IBeadLayout#layout
         */
		public function layout():Boolean
		{
            var host:UIBase = UIBase(_strand);
			var sw:Number = host.width;
			var sh:Number = host.height;

			var e:IUIBase;
			var i:int;
			var col:int = 0;
			var columns:Array = [];
            var rows:Array = [];
            var data:Array = [];
			for (i = 0; i < numColumns; i++)
				columns[i] = 0;

            var marginLeft:Object;
            var marginRight:Object;
            var marginTop:Object;
            var marginBottom:Object;
            var margin:Object;
            var ml:Number;
            var mr:Number;
            var mt:Number;
            var mb:Number;
			var children:Array = IContainer(_strand).getChildren();
			var n:int = children.length;
            var rowData:Object = { rowHeight: 0 };

			// determine max widths of columns
			for (i = 0; i < n; i++) {
				e = children[i];
                margin = ValuesManager.valuesImpl.getValue(e, "margin");
                marginLeft = ValuesManager.valuesImpl.getValue(e, "margin-left");
                marginTop = ValuesManager.valuesImpl.getValue(e, "margin-top");
                marginRight = ValuesManager.valuesImpl.getValue(e, "margin-right");
                marginBottom = ValuesManager.valuesImpl.getValue(e, "margin-bottom");
                mt = CSSUtils.getTopValue(marginTop, margin, sh);
                mb = CSSUtils.getBottomValue(marginBottom, margin, sh);
                mr = CSSUtils.getRightValue(marginRight, margin, sw);
                ml = CSSUtils.getLeftValue(marginLeft, margin, sw);
                data.push({ mt: mt, mb: mb, mr: mr, ml: ml});
				var thisPrefWidth:int = 0;
				if (e is IStrand)
				{
					var measure:IMeasurementBead = e.getBeadByType(IMeasurementBead) as IMeasurementBead;
					if (measure)
						thisPrefWidth = measure.measuredWidth + ml + mr;
					else
						thisPrefWidth = e.width + ml + mr;
				}
				else
					thisPrefWidth = e.width + ml + mr;

                rowData.rowHeight = Math.max(rowData.rowHeight, e.height + mt + mb);
				columns[col] = Math.max(columns[col], thisPrefWidth);
                col = col + 1;
                if (col == numColumns)
                {
                    rows.push(rowData);
                    rowData = {rowHeight: 0};
                    col = 0;
                }
			}

            var lastmb:Number = 0;
			var curx:int = 0;
			var cury:int = 0;
			var maxHeight:int = 0;
			col = 0;
			for (i = 0; i < n; i++)
            {
				e = children[i];
				e.x = curx + ml;
				e.y = cury + data[i].mt;
				curx += columns[col++];
                maxHeight = Math.max(maxHeight, e.y + e.height + data[i].mb);
				if (col == numColumns)
				{
					cury += rows[0].rowHeight;
                    rows.shift();
					col = 0;
					curx = 0;
				}
			}

			return true;
		}
	}
}

fix bugs in this layout

fix bugs in this layout