Updated QuadBatch2D class.

Updated QuadBatch2D class.

--- src/engine/tetragon/view/render2d/display/QuadBatch2D.as
+++ src/engine/tetragon/view/render2d/display/QuadBatch2D.as
@@ -54,7 +54,8 @@
 	import flash.utils.getQualifiedClassName;

-	/** Optimizes rendering of a number of quads with an identical state.
+	/**
+	 * 	Optimizes rendering of a number of quads with an identical state.
 	 *
 	 *  <p>The majority of all rendered objects in Render2D are quads. In fact, all the default
 	 *  leaf nodes of Render2D are quads (the Image and Quad classes). The rendering of those
@@ -82,7 +83,16 @@
 	 */
 	public class QuadBatch2D extends DisplayObject2D
 	{
+		//-----------------------------------------------------------------------------------------
+		// Constants
+		//-----------------------------------------------------------------------------------------
+
 		private static const QUAD_PROGRAM_NAME:String = "QB_q";
+
+
+		//-----------------------------------------------------------------------------------------
+		// Properties
+		//-----------------------------------------------------------------------------------------

 		private var _numQuads:int;
 		private var _syncRequired:Boolean;
@@ -99,8 +109,12 @@
 		private static var _renderAlpha:Vector.<Number> = new <Number>[1.0, 1.0, 1.0, 1.0];
 		private static var _renderMatrix:Matrix3D = new Matrix3D();
 		private static var _programNameCache:Dictionary = new Dictionary();
-
-
+
+
+		//-----------------------------------------------------------------------------------------
+		// Constructor
+		//-----------------------------------------------------------------------------------------
+
 		/** Creates a new QuadBatch instance with empty batch data. */
 		public function QuadBatch2D()
 		{
@@ -113,10 +127,15 @@
 			// Handle lost context. We use the conventional event here (not the one from Render2D)
 			// so we're able to create a weak event listener; this avoids memory leaks when people
 			// forget to call "dispose" on the QuadBatch.
-			Render2D.current.stage3D.addEventListener(Event2D.CONTEXT3D_CREATE, onContextCreated, false, 0, true);
-		}
-
-
+			Render2D.current.stage3D.addEventListener(Event2D.CONTEXT3D_CREATE,
+				onContextCreated, false, 0, true);
+		}
+
+
+		//-----------------------------------------------------------------------------------------
+		// Public Methods
+		//-----------------------------------------------------------------------------------------
+
 		/** Disposes vertex- and index-buffer. */
 		public override function dispose():void
 		{
@@ -127,15 +146,8 @@

 			super.dispose();
 		}
-
-
-		private function onContextCreated(event:Object):void
-		{
-			createBuffers();
-			registerPrograms();
-		}
-
-
+
+
 		/** Creates a duplicate of the QuadBatch object. */
 		public function clone():QuadBatch2D
 		{
@@ -151,8 +163,243 @@
 			clone.alpha = alpha;
 			return clone;
 		}
-
-
+
+
+		/** Renders the current batch with custom settings for model-view-projection matrix, alpha
+		 *  and blend mode. This makes it possible to render batches that are not part of the
+		 *  display list. */
+		public function renderCustom(mvpMatrix:Matrix, parentAlpha:Number = 1.0, blendMode:String = null):void
+		{
+			if (_numQuads == 0) return;
+			if (_syncRequired) syncBuffers();
+
+			var pma:Boolean = _vertexData.premultipliedAlpha;
+			var context:Context3D = Render2D.context;
+			var tinted:Boolean = _tinted || (parentAlpha != 1.0);
+			var programName:String = _texture ? getImageProgramName(tinted, _texture.mipMapping, _texture.repeat, _texture.format, _smoothing) : QUAD_PROGRAM_NAME;
+
+			_renderAlpha[0] = _renderAlpha[1] = _renderAlpha[2] = pma ? parentAlpha : 1.0;
+			_renderAlpha[3] = parentAlpha;
+
+			MatrixUtil.convertTo3D(mvpMatrix, _renderMatrix);
+			RenderSupport2D.setBlendFactors(pma, blendMode ? blendMode : this.blendMode);
+
+			context.setProgram(Render2D.current.getProgram(programName));
+			context.setProgramConstantsFromVector(Context3DProgramType.VERTEX, 0, _renderAlpha, 1);
+			context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 1, _renderMatrix, true);
+			context.setVertexBufferAt(0, _vertexBuffer, VertexData2D.POSITION_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
+
+			if (_texture == null || tinted)
+				context.setVertexBufferAt(1, _vertexBuffer, VertexData2D.COLOR_OFFSET, Context3DVertexBufferFormat.FLOAT_4);
+
+			if (_texture)
+			{
+				context.setTextureAt(0, _texture.base);
+				context.setVertexBufferAt(2, _vertexBuffer, VertexData2D.TEXCOORD_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
+			}
+
+			context.drawTriangles(_indexBuffer, 0, _numQuads * 2);
+
+			if (_texture)
+			{
+				context.setTextureAt(0, null);
+				context.setVertexBufferAt(2, null);
+			}
+
+			context.setVertexBufferAt(1, null);
+			context.setVertexBufferAt(0, null);
+		}
+
+
+		/** Resets the batch. The vertex- and index-buffers remain their size, so that they
+		 *  can be reused quickly. */
+		public function reset():void
+		{
+			_numQuads = 0;
+			_texture = null;
+			_smoothing = null;
+			_syncRequired = true;
+		}
+
+
+		/** Adds an image to the batch. This method internally calls 'addQuad' with the correct
+		 *  parameters for 'texture' and 'smoothing'. */
+		public function addImage(image:Image2D, parentAlpha:Number = 1.0, modelViewMatrix:Matrix = null, blendMode:String = null):void
+		{
+			addQuad(image, parentAlpha, image.texture, image.smoothing, modelViewMatrix, blendMode);
+		}
+
+
+		/** Adds a quad to the batch. The first quad determines the state of the batch,
+		 *  i.e. the values for texture, smoothing and blendmode. When you add additional quads,
+		 *  make sure they share that state (e.g. with the 'isStageChange' method), or reset
+		 *  the batch. */
+		public function addQuad(quad:Quad2D, parentAlpha:Number = 1.0, texture:Texture2D = null, smoothing:String = null, modelViewMatrix:Matrix = null, blendMode:String = null):void
+		{
+			if (modelViewMatrix == null)
+				modelViewMatrix = quad.transformationMatrix;
+
+			var tinted:Boolean = texture ? (quad.tinted || parentAlpha != 1.0) : false;
+			var alpha:Number = parentAlpha * quad.alpha;
+			var vertexID:int = _numQuads * 4;
+
+			if (_numQuads + 1 > _vertexData.numVertices / 4) expand();
+			if (_numQuads == 0)
+			{
+				this.blendMode = blendMode ? blendMode : quad.blendMode;
+				_texture = texture;
+				_tinted = tinted;
+				_smoothing = smoothing;
+				_vertexData.setPremultipliedAlpha(texture ? texture.premultipliedAlpha : true, false);
+			}
+
+			quad.copyVertexDataTo(_vertexData, vertexID);
+			_vertexData.transformVertex(vertexID, modelViewMatrix, 4);
+
+			if (alpha != 1.0)
+				_vertexData.scaleAlpha(vertexID, alpha, 4);
+
+			_syncRequired = true;
+			_numQuads++;
+		}
+
+
+		public function addQuadBatch(quadBatch:QuadBatch2D, parentAlpha:Number = 1.0, modelViewMatrix:Matrix = null, blendMode:String = null):void
+		{
+			if (modelViewMatrix == null)
+				modelViewMatrix = quadBatch.transformationMatrix;
+
+			var tinted:Boolean = quadBatch._tinted || parentAlpha != 1.0;
+			var alpha:Number = parentAlpha * quadBatch.alpha;
+			var vertexID:int = _numQuads * 4;
+			var numQuads:int = quadBatch.numQuads;
+
+			if (_numQuads + numQuads > capacity) expand(_numQuads + numQuads);
+			if (_numQuads == 0)
+			{
+				this.blendMode = blendMode ? blendMode : quadBatch.blendMode;
+				_texture = quadBatch._texture;
+				_tinted = tinted;
+				_smoothing = quadBatch._smoothing;
+				_vertexData.setPremultipliedAlpha(quadBatch._vertexData.premultipliedAlpha, false);
+			}
+
+			quadBatch._vertexData.copyTo(_vertexData, vertexID, 0, numQuads * 4);
+			_vertexData.transformVertex(vertexID, modelViewMatrix, numQuads * 4);
+
+			if (alpha != 1.0)
+				_vertexData.scaleAlpha(vertexID, alpha, numQuads * 4);
+
+			_syncRequired = true;
+			_numQuads += numQuads;
+		}
+
+
+		/** Indicates if specific quads can be added to the batch without causing a state change.
+		 *  A state change occurs if the quad uses a different base texture, has a different
+		 *  'tinted', 'smoothing', 'repeat' or 'blendMode' setting, or if the batch is full
+		 *  (one batch can contain up to 8192 quads). */
+		public function isStateChange(tinted:Boolean, parentAlpha:Number, texture:Texture2D, smoothing:String, blendMode:String, numQuads:int = 1):Boolean
+		{
+			if (_numQuads == 0) return false;
+			else if (_numQuads + numQuads > 8192) return true; // maximum buffer size
+			else if (_texture == null && texture == null) return false;
+			else if (_texture != null && texture != null)
+				return _texture.base != texture.base || _texture.repeat != texture.repeat || _smoothing != smoothing || _tinted != (tinted || parentAlpha != 1.0) || this.blendMode != blendMode;
+			else return true;
+		}
+
+
+		// display object methods
+		/** @inheritDoc */
+		public override function getBounds(targetSpace:DisplayObject2D, resultRect:Rectangle = null):Rectangle
+		{
+			if (resultRect == null) resultRect = new Rectangle();
+
+			var transformationMatrix:Matrix = targetSpace == this ? null : getTransformationMatrix(targetSpace, _helperMatrix);
+
+			return _vertexData.getBounds(transformationMatrix, 0, _numQuads * 4, resultRect);
+		}
+
+
+		/** @inheritDoc */
+		public override function render(support:RenderSupport2D, parentAlpha:Number):void
+		{
+			if (_numQuads)
+			{
+				support.finishQuadBatch();
+				support.raiseDrawCount();
+				renderCustom(support.mvpMatrix, alpha * parentAlpha, support.blendMode);
+			}
+		}
+
+
+		// compilation (for flattened sprites)
+		/** Analyses an object that is made up exclusively of quads (or other containers)
+		 *  and creates a vector of QuadBatch objects representing it. This can be
+		 *  used to render the container very efficiently. The 'flatten'-method of the Sprite
+		 *  class uses this method internally. */
+		public static function compile(object:DisplayObject2D, quadBatches:Vector.<QuadBatch2D>):void
+		{
+			compileObject(object, quadBatches, -1, new Matrix());
+		}
+
+
+		//-----------------------------------------------------------------------------------------
+		// Accessors
+		//-----------------------------------------------------------------------------------------
+
+		public function get numQuads():int
+		{
+			return _numQuads;
+		}
+
+
+		public function get tinted():Boolean
+		{
+			return _tinted;
+		}
+
+
+		public function get texture():Texture2D
+		{
+			return _texture;
+		}
+
+
+		public function get smoothing():String
+		{
+			return _smoothing;
+		}
+
+
+		private function get capacity():int
+		{
+			return _vertexData.numVertices / 4;
+		}
+
+
+		//-----------------------------------------------------------------------------------------
+		// Callback Handlers
+		//-----------------------------------------------------------------------------------------
+
+		/**
+		 * @private
+		 */
+		private function onContextCreated(e:Object):void
+		{
+			createBuffers();
+			registerPrograms();
+		}
+
+
+		//-----------------------------------------------------------------------------------------
+		// Private Methods
+		//-----------------------------------------------------------------------------------------
+
+		/**
+		 * @private
+		 */
 		private function expand(newCapacity:int = -1):void
 		{
 			var oldCapacity:int = capacity;
@@ -178,224 +425,53 @@
 		}

+		/**
+		 * @private
+		 */
 		private function createBuffers():void
 		{
 			var numVertices:int = _vertexData.numVertices;
 			var numIndices:int = _indexData.length;
 			var context:Context3D = Render2D.context;
-
+
 			if (_vertexBuffer) _vertexBuffer.dispose();
 			if (_indexBuffer) _indexBuffer.dispose();
 			if (numVertices == 0) return;
-			if (context == null) throw new MissingContext3DException();
-
+			if (!context) throw new MissingContext3DException();
+
 			_vertexBuffer = context.createVertexBuffer(numVertices, VertexData2D.ELEMENTS_PER_VERTEX);
 			_vertexBuffer.uploadFromVector(_vertexData.rawData, 0, numVertices);
-
+
 			_indexBuffer = context.createIndexBuffer(numIndices);
 			_indexBuffer.uploadFromVector(_indexData, 0, numIndices);
-
+
 			_syncRequired = false;
 		}
-
-
+
+
 		/** Uploads the raw data of all batched quads to the vertex buffer. */
 		private function syncBuffers():void
 		{
-			if (_vertexBuffer == null)
+			if (!_vertexBuffer)
+			{
 				createBuffers();
+			}
 			else
 			{
 				// as 3rd parameter, we could also use 'mNumQuads * 4', but on some GPU hardware (iOS!),
 				// this is slower than updating the complete buffer.
-
 				_vertexBuffer.uploadFromVector(_vertexData.rawData, 0, _vertexData.numVertices);
 				_syncRequired = false;
 			}
 		}
-
-
-		/** Renders the current batch with custom settings for model-view-projection matrix, alpha
-		 *  and blend mode. This makes it possible to render batches that are not part of the
-		 *  display list. */
-		public function renderCustom(mvpMatrix:Matrix, parentAlpha:Number = 1.0, blendMode:String = null):void
-		{
-			if (_numQuads == 0) return;
-			if (_syncRequired) syncBuffers();
-
-			var pma:Boolean = _vertexData.premultipliedAlpha;
-			var context:Context3D = Render2D.context;
-			var tinted:Boolean = _tinted || (parentAlpha != 1.0);
-			var programName:String = _texture ? getImageProgramName(tinted, _texture.mipMapping, _texture.repeat, _texture.format, _smoothing) : QUAD_PROGRAM_NAME;
-
-			_renderAlpha[0] = _renderAlpha[1] = _renderAlpha[2] = pma ? parentAlpha : 1.0;
-			_renderAlpha[3] = parentAlpha;
-
-			MatrixUtil.convertTo3D(mvpMatrix, _renderMatrix);
-			RenderSupport2D.setBlendFactors(pma, blendMode ? blendMode : this.blendMode);
-
-			context.setProgram(Render2D.current.getProgram(programName));
-			context.setProgramConstantsFromVector(Context3DProgramType.VERTEX, 0, _renderAlpha, 1);
-			context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 1, _renderMatrix, true);
-			context.setVertexBufferAt(0, _vertexBuffer, VertexData2D.POSITION_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
-
-			if (_texture == null || tinted)
-				context.setVertexBufferAt(1, _vertexBuffer, VertexData2D.COLOR_OFFSET, Context3DVertexBufferFormat.FLOAT_4);
-
-			if (_texture)
-			{
-				context.setTextureAt(0, _texture.base);
-				context.setVertexBufferAt(2, _vertexBuffer, VertexData2D.TEXCOORD_OFFSET, Context3DVertexBufferFormat.FLOAT_2);
-			}
-
-			context.drawTriangles(_indexBuffer, 0, _numQuads * 2);
-
-			if (_texture)
-			{
-				context.setTextureAt(0, null);
-				context.setVertexBufferAt(2, null);
-			}
-
-			context.setVertexBufferAt(1, null);
-			context.setVertexBufferAt(0, null);
-		}
-
-
-		/** Resets the batch. The vertex- and index-buffers remain their size, so that they
-		 *  can be reused quickly. */
-		public function reset():void
-		{
-			_numQuads = 0;
-			_texture = null;
-			_smoothing = null;
-			_syncRequired = true;
-		}
-
-
-		/** Adds an image to the batch. This method internally calls 'addQuad' with the correct
-		 *  parameters for 'texture' and 'smoothing'. */
-		public function addImage(image:Image2D, parentAlpha:Number = 1.0, modelViewMatrix:Matrix = null, blendMode:String = null):void
-		{
-			addQuad(image, parentAlpha, image.texture, image.smoothing, modelViewMatrix, blendMode);
-		}
-
-
-		/** Adds a quad to the batch. The first quad determines the state of the batch,
-		 *  i.e. the values for texture, smoothing and blendmode. When you add additional quads,
-		 *  make sure they share that state (e.g. with the 'isStageChange' method), or reset
-		 *  the batch. */
-		public function addQuad(quad:Quad2D, parentAlpha:Number = 1.0, texture:Texture2D = null, smoothing:String = null, modelViewMatrix:Matrix = null, blendMode:String = null):void
-		{
-			if (modelViewMatrix == null)
-				modelViewMatrix = quad.transformationMatrix;
-
-			var tinted:Boolean = texture ? (quad.tinted || parentAlpha != 1.0) : false;
-			var alpha:Number = parentAlpha * quad.alpha;
-			var vertexID:int = _numQuads * 4;
-
-			if (_numQuads + 1 > _vertexData.numVertices / 4) expand();
-			if (_numQuads == 0)
-			{
-				this.blendMode = blendMode ? blendMode : quad.blendMode;
-				_texture = texture;
-				_tinted = tinted;
-				_smoothing = smoothing;
-				_vertexData.setPremultipliedAlpha(texture ? texture.premultipliedAlpha : true, false);
-			}
-
-			quad.copyVertexDataTo(_vertexData, vertexID);
-			_vertexData.transformVertex(vertexID, modelViewMatrix, 4);
-
-			if (alpha != 1.0)
-				_vertexData.scaleAlpha(vertexID, alpha, 4);
-
-			_syncRequired = true;
-			_numQuads++;
-		}
-
-
-		public function addQuadBatch(quadBatch:QuadBatch2D, parentAlpha:Number = 1.0, modelViewMatrix:Matrix = null, blendMode:String = null):void
-		{
-			if (modelViewMatrix == null)
-				modelViewMatrix = quadBatch.transformationMatrix;
-
-			var tinted:Boolean = quadBatch._tinted || parentAlpha != 1.0;
-			var alpha:Number = parentAlpha * quadBatch.alpha;
-			var vertexID:int = _numQuads * 4;
-			var numQuads:int = quadBatch.numQuads;
-
-			if (_numQuads + numQuads > capacity) expand(_numQuads + numQuads);
-			if (_numQuads == 0)
-			{
-				this.blendMode = blendMode ? blendMode : quadBatch.blendMode;
-				_texture = quadBatch._texture;
-				_tinted = tinted;
-				_smoothing = quadBatch._smoothing;
-				_vertexData.setPremultipliedAlpha(quadBatch._vertexData.premultipliedAlpha, false);
-			}
-
-			quadBatch._vertexData.copyTo(_vertexData, vertexID, 0, numQuads * 4);
-			_vertexData.transformVertex(vertexID, modelViewMatrix, numQuads * 4);
-
-			if (alpha != 1.0)
-				_vertexData.scaleAlpha(vertexID, alpha, numQuads * 4);
-
-			_syncRequired = true;
-			_numQuads += numQuads;
-		}
-
-
-		/** Indicates if specific quads can be added to the batch without causing a state change.
-		 *  A state change occurs if the quad uses a different base texture, has a different
-		 *  'tinted', 'smoothing', 'repeat' or 'blendMode' setting, or if the batch is full
-		 *  (one batch can contain up to 8192 quads). */
-		public function isStateChange(tinted:Boolean, parentAlpha:Number, texture:Texture2D, smoothing:String, blendMode:String, numQuads:int = 1):Boolean
-		{
-			if (_numQuads == 0) return false;
-			else if (_numQuads + numQuads > 8192) return true; // maximum buffer size
-			else if (_texture == null && texture == null) return false;
-			else if (_texture != null && texture != null)
-				return _texture.base != texture.base || _texture.repeat != texture.repeat || _smoothing != smoothing || _tinted != (tinted || parentAlpha != 1.0) || this.blendMode != blendMode;
-			else return true;
-		}
-
-
-		// display object methods
-		/** @inheritDoc */
-		public override function getBounds(targetSpace:DisplayObject2D, resultRect:Rectangle = null):Rectangle
-		{
-			if (resultRect == null) resultRect = new Rectangle();
-
-			var transformationMatrix:Matrix = targetSpace == this ? null : getTransformationMatrix(targetSpace, _helperMatrix);
-
-			return _vertexData.getBounds(transformationMatrix, 0, _numQuads * 4, resultRect);
-		}
-
-
-		/** @inheritDoc */
-		public override function render(support:RenderSupport2D, parentAlpha:Number):void
-		{
-			if (_numQuads)
-			{
-				support.finishQuadBatch();
-				support.raiseDrawCount();
-				renderCustom(support.mvpMatrix, alpha * parentAlpha, support.blendMode);
-			}
-		}
-
-
-		// compilation (for flattened sprites)
-		/** Analyses an object that is made up exclusively of quads (or other containers)
-		 *  and creates a vector of QuadBatch objects representing it. This can be
-		 *  used to render the container very efficiently. The 'flatten'-method of the Sprite
-		 *  class uses this method internally. */
-		public static function compile(object:DisplayObject2D, quadBatches:Vector.<QuadBatch2D>):void
-		{
-			compileObject(object, quadBatches, -1, new Matrix());
-		}
-
-
-		private static function compileObject(object:DisplayObject2D, quadBatches:Vector.<QuadBatch2D>, quadBatchID:int, transformationMatrix:Matrix, alpha:Number = 1.0, blendMode:String = null, ignoreCurrentFilter:Boolean = false):int
+
+
+		/**
+		 * @private
+		 */
+		private static function compileObject(object:DisplayObject2D,
+			quadBatches:Vector.<QuadBatch2D>, quadBatchID:int, transformationMatrix:Matrix,
+			alpha:Number = 1.0, blendMode:String = null, ignoreCurrentFilter:Boolean = false):int
 		{
 			var i:int;
 			var quadBatch:QuadBatch2D;
@@ -503,49 +579,17 @@

 			return quadBatchID;
 		}
-
-
-		// properties
-		public function get numQuads():int
-		{
-			return _numQuads;
-		}
-
-
-		public function get tinted():Boolean
-		{
-			return _tinted;
-		}
-
-
-		public function get texture():Texture2D
-		{
-			return _texture;
-		}
-
-
-		public function get smoothing():String
-		{
-			return _smoothing;
-		}
-
-
-		private function get capacity():int
-		{
-			return _vertexData.numVertices / 4;
-		}
-
-
-		// program management
+
+
+		/**
+		 * @private
+		 */
 		private static function registerPrograms():void
 		{
 			var target:Render2D = Render2D.current;
-			if (target.hasProgram(QUAD_PROGRAM_NAME)) return;
-			// already registered
-
-			var assembler:AGALMiniAssembler = new AGALMiniAssembler();
-			var vertexProgramCode:String;
-			var fragmentProgramCode:String;
+			if (target.hasProgram(QUAD_PROGRAM_NAME)) return; // already registered
+
+			var agal:AGALMiniAssembler = new AGALMiniAssembler();

 			// this is the input data we'll pass to the shaders:
 			//
@@ -557,38 +601,47 @@
 			// fs0 -> texture

 			// Quad:
-
-			vertexProgramCode = "m44 op, va0, vc1 \n" + // 4x4 matrix transform to output clipspace
-			"mul v0, va1, vc0 \n";
-			// multiply alpha (vc0) with color (va1)
-
-			fragmentProgramCode = "mov oc, v0       \n";
-			// output color
-
-			target.registerProgram(QUAD_PROGRAM_NAME, assembler.assemble(Context3DProgramType.VERTEX, vertexProgramCode), assembler.assemble(Context3DProgramType.FRAGMENT, fragmentProgramCode));
-
+			var vertexASM:String =
+				"m44 op, va0, vc1 \n" +	// 4x4 matrix transform to output clipspace
+				"mul v0, va1, vc0 \n";	// multiply alpha (vc0) with color (va1)
+
+			var fragmentASM:String =
+				"mov oc, v0       \n";	// output color
+
+			target.registerProgram(QUAD_PROGRAM_NAME,
+				agal.assemble(Context3DProgramType.VERTEX, vertexASM),
+				agal.assemble(Context3DProgramType.FRAGMENT, fragmentASM));
+
 			// Image:
 			// Each combination of tinted/repeat/mipmap/smoothing has its own fragment shader.
-
 			for each (var tinted:Boolean in [true, false])
 			{
-				vertexProgramCode = tinted ? "m44 op, va0, vc1 \n" + // 4x4 matrix transform to output clipspace
-				"mul v0, va1, vc0 \n" + // multiply alpha (vc0) with color (va1)
-				"mov v1, va2      \n"   // pass texture coordinates to fragment program
-				: "m44 op, va0, vc1 \n" + // 4x4 matrix transform to output clipspace
-				"mov v1, va2      \n";
-				// pass texture coordinates to fragment program
-
-				fragmentProgramCode = tinted ? "tex ft1,  v1, fs0 <???> \n" + // sample texture 0
-				"mul  oc, ft1,  v0       \n"   // multiply color with texel color
-				: "tex  oc,  v1, fs0 <???> \n";
-				// sample texture 0
-
-				var smoothingTypes:Array = [TextureSmoothing2D.NONE, TextureSmoothing2D.BILINEAR, TextureSmoothing2D.TRILINEAR];
-
-				var formats:Array = [Context3DTextureFormat.BGRA, Context3DTextureFormat.COMPRESSED, "compressedAlpha"// use explicit string for compatibility
+				vertexASM = tinted
+					? "m44 op, va0, vc1 \n" +	// 4x4 matrix transform to output clipspace
+					  "mul v0, va1, vc0 \n" +	// multiply alpha (vc0) with color (va1)
+					  "mov v1, va2      \n"		// pass texture coordinates to fragment program
+					: "m44 op, va0, vc1 \n" +	// 4x4 matrix transform to output clipspace
+					  "mov v1, va2      \n";	// pass texture coordinates to fragment program
+
+				fragmentASM = tinted
+					? "tex ft1,  v1, fs0 <???> \n" +	// sample texture 0
+					  "mul  oc, ft1,  v0       \n"		// multiply color with texel color
+					: "tex  oc,  v1, fs0 <???> \n";		// sample texture 0
+
+				var smoothingTypes:Array =
+				[
+					TextureSmoothing2D.NONE,
+					TextureSmoothing2D.BILINEAR,
+					TextureSmoothing2D.TRILINEAR
 				];

+				var formats:Array =
+				[
+					Context3DTextureFormat.BGRA,
+					Context3DTextureFormat.COMPRESSED,
+					Context3DTextureFormat.COMPRESSED_ALPHA
+				];
+
 				for each (var repeat:Boolean in [true, false])
 				{
 					for each (var mipmap:Boolean in [true, false])
@@ -601,51 +654,53 @@

 								if (format == Context3DTextureFormat.COMPRESSED)
 									options.push("dxt1");
-								else if (format == "compressedAlpha")
+								else if (format == Context3DTextureFormat.COMPRESSED_ALPHA)
 									options.push("dxt5");
-
+
 								if (smoothing == TextureSmoothing2D.NONE)
 									options.push("nearest", mipmap ? "mipnearest" : "mipnone");
 								else if (smoothing == TextureSmoothing2D.BILINEAR)
 									options.push("linear", mipmap ? "mipnearest" : "mipnone");
 								else
 									options.push("linear", mipmap ? "miplinear" : "mipnone");
-
-								target.registerProgram(getImageProgramName(tinted, mipmap, repeat, format, smoothing), assembler.assemble(Context3DProgramType.VERTEX, vertexProgramCode), assembler.assemble(Context3DProgramType.FRAGMENT, fragmentProgramCode.replace("???", options.join())));
+
+								target.registerProgram(getImageProgramName(tinted, mipmap, repeat,
+									format, smoothing), agal.assemble(Context3DProgramType.VERTEX,
+										vertexASM), agal.assemble(Context3DProgramType.FRAGMENT,
+										fragmentASM.replace("???", options.join())));
 							}
 						}
 					}
 				}
 			}
 		}
-
-
-		private static function getImageProgramName(tinted:Boolean, mipMap:Boolean = true, repeat:Boolean = false, format:String = "bgra", smoothing:String = "bilinear"):String
+
+
+		/**
+		 * @private
+		 */
+		private static function getImageProgramName(tinted:Boolean, mipMap:Boolean = true,
+			repeat:Boolean = false, format:String = "bgra", smoothing:String = "bilinear"):String
 		{
 			var bitField:uint = 0;
-
+
 			if (tinted) bitField |= 1;
 			if (mipMap) bitField |= 1 << 1;
 			if (repeat) bitField |= 1 << 2;
-
-			if (smoothing == TextureSmoothing2D.NONE)
-				bitField |= 1 << 3;
-			else if (smoothing == TextureSmoothing2D.TRILINEAR)
-				bitField |= 1 << 4;
-
-			if (format == Context3DTextureFormat.COMPRESSED)
-				bitField |= 1 << 5;
-			else if (format == "compressedAlpha")
-				bitField |= 1 << 6;
-
+
+			if (smoothing == TextureSmoothing2D.NONE) bitField |= 1 << 3;
+			else if (smoothing == TextureSmoothing2D.TRILINEAR) bitField |= 1 << 4;
+
+			if (format == Context3DTextureFormat.COMPRESSED) bitField |= 1 << 5;
+			else if (format == Context3DTextureFormat.COMPRESSED_ALPHA) bitField |= 1 << 6;
+
 			var name:String = _programNameCache[bitField];
-
 			if (name == null)
 			{
 				name = "QB_i." + bitField.toString(16);
 				_programNameCache[bitField] = name;
 			}
-
+
 			return name;
 		}
 	}


As per discussion http://www.igniterealtime.org/community/message/179673 added a line to the deserialize method.
This extension needs more investigation.

git-svn-id: c197267f952b24206666de142881703007ca05d5@11549 b35dd754-fafc-0310-a699-88a17e54d16e

--- src/org/igniterealtime/xiff/data/xhtml/XHTMLExtension.as
+++ src/org/igniterealtime/xiff/data/xhtml/XHTMLExtension.as
@@ -1,20 +1,20 @@
 /*
  * Copyright (C) 2003-2009 Igniterealtime Community Contributors
- *
+ *
  *     Daniel Henninger
  *     Derrick Grigg <dgrigg@rogers.com>
  *     Juga Paazmaya <olavic@gmail.com>
  *     Nick Velloff <nick.velloff@gmail.com>
  *     Sean Treadway <seant@oncotype.dk>
  *     Sean Voisen <sean@voisen.org>
- *
- *
+ *
+ *
  * 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.
@@ -36,11 +36,13 @@

 	/**
 	 * This class provides an extension for XHTML body text in messages.
+	 *
html --> http://jabber.org/protocol/xhtml-im

+	 *
body --> http://www.w3.org/1999/xhtml

+
 	 * @see http://xmpp.org/extensions/xep-0071.html
 	 */
 	public class XHTMLExtension extends Extension implements IExtension, ISerializable
 	{
-		// Static class variables to be overridden in subclasses;
 		public static const NS:String = "http://www.w3.org/1999/xhtml";
 		public static const ELEMENT:String = "html";

@@ -61,15 +63,17 @@
 		 */
 		public function serialize( parent:XMLNode ):Boolean
         {
-             return true;
+            return true;
         }

 		/**
 		 *
 		 * @param	parent The parent node for this extension
+		 * @see http://www.igniterealtime.org/community/message/179673
 		 */
         public function deserialize( node:XMLNode ):Boolean
         {
+			getNode().appendChild(node);
         	return true;
         }


A bit of better wording for auth docs

A bit of better wording for auth docs

--- src/org/igniterealtime/xiff/core/XMPPConnection.as
+++ src/org/igniterealtime/xiff/core/XMPPConnection.as
@@ -126,7 +126,7 @@
 		public static const STREAM_TYPE_FLASH_TERMINATED:uint = 3;

 		/**
-		 * The types of SASL mechanisms available.
+		 * The types of SASL mechanisms available. Indexed by their MECHANISM constant.
 		 *
 		 *
By default, only Anonymous and DigestMD5 are enabled.

 		 * @see org.igniterealtime.xiff.auth.Anonymous
@@ -529,7 +529,11 @@
 		}

 		/**
-		 * @private
+		 * SASL Authentication should been set up, begin the authentication
+		 * process by sending the initial request.
+		 *
+		 *
Make sure that the username and password are set, or the connection is using
+		 * anonymous authentication before calling this method.

 		 */
 		protected function beginAuthentication():void
 		{
@@ -1207,7 +1211,10 @@
 				switch (localName)
 				{
 					case "starttls":
-						handleStreamTLS( feature ); // Checks for 'required'
+						if ( !loggedIn )
+						{
+							handleStreamTLS( feature ); // Checks for 'required'
+						}
 						break;
 					case "register":
 						// In-Band Registration, if enabled.... TODO
@@ -1216,7 +1223,10 @@
 						if ( !loggedIn )
 						{
 							configureAuthMechanisms( feature );
-							beginAuthentication();
+							if ( ( username != null && username.length > 0 ) || useAnonymousLogin )
+							{
+								beginAuthentication();
+							}
 						}
 						break;
 					case "compression":
@@ -1226,7 +1236,6 @@
 						}
 						break;
 					case "bind":
-						// compression needed, done? else auth done?
 						if ( ((_compress && compressionNegotiated) || !_compress) && loggedIn )
 						{
 							bindConnection();


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1283837 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/spark/src/spark/effects/Wipe.as
+++ frameworks/projects/spark/src/spark/effects/Wipe.as
@@ -1,13 +1,3 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2008 Adobe Systems Incorporated
-//  All Rights Reserved.
-//
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
-//
-////////////////////////////////////////////////////////////////////////////////
 package spark.effects
 {
 import flash.display.Shader;


Modify priority queue: add debug trace

Modify priority queue: add debug trace

--- krew-framework/krewfw/data_structure/PriorityQueue.as
+++ krew-framework/krewfw/data_structure/PriorityQueue.as
@@ -9,6 +9,8 @@

         private var _queue:Vector.<PriorityNode>;
         private var _isDirty:Boolean;
+
+        public var verbose:Boolean = false;

         //------------------------------------------------------------
         public function PriorityQueue() {
@@ -27,6 +29,11 @@
             var pNode:PriorityNode = new PriorityNode(priority, item);
             _queue.push(pNode);
             _isDirty = true;
+
+            if (verbose) {
+                trace("[PriorityQueue :: enqueue] priority:", priority);
+                dumpPriority();
+            }
         }

         /**
@@ -35,10 +42,16 @@
          * If queue is empty, return null.
          */
         public function dequeue():* {
+            if (verbose) {
+                trace("[PriorityQueue :: dequeue] length:", _queue.length);
+            }
             if (!_queue.length) { return null; }

             if (_isDirty) { _sort(); }
-            return _queue.pop().item;
+            var topItem:* = _queue.pop().item;
+
+            if (verbose) { dumpPriority(); }
+            return topItem;
         }

         /**
@@ -96,6 +109,18 @@
             return (a.priority > b.priority) ? -1 : 1;
         }

+        //------------------------------------------------------------
+        // debug
+        //------------------------------------------------------------
+
+        public function dumpPriority():void {
+            var priorities:Array = [];
+            for each (var item:PriorityNode in _queue) {
+                priorities.push(item.priority);
+            }
+            trace(" -", priorities);
+        }
+
     }
 }


Change 20090404-bargull-i95 by bargull@dell--p4--2-53 on 2009-04-04 19:17:30
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix sprite layer problem

New Features:

Bugs Fixed: LPP-8018 (SWF9: clickable sprite layering problem)

Technical Reviewer: max
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
When calling "sendToBack()", don't move sprite to position 0, instead move in front of all non-LzSprite DisplayObjects (clickbutton, resourceContainer, etc.)

Tests:
testcase from bugreport, smokecheck

git-svn-id: d62bde4b5aa582fdf07c8d403e53e0399a7ed285@13597 fa20e4f9-1d0a-0410-b5f3-dc9c16b8b17c

--- WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
+++ WEB-INF/lps/lfc/kernel/swf9/LzSprite.as
@@ -1279,7 +1279,10 @@
       */
       public function sendToBack():void {
           if (!this.isroot) {
-              parent.setChildIndex(this, 0);
+              var pos:int = 0;
+              // skip all non-LzSprites (clickbutton, resourceContainer, etc.)
+              for (; ! (parent.getChildAt(pos) is LzSprite); ++pos) {}
+              parent.setChildIndex(this, pos);
           }
       }


M Viewport : now takes scale into account

--- src/aerys/minko/render/Viewport.as
+++ src/aerys/minko/render/Viewport.as
@@ -7,6 +7,7 @@
 	import aerys.minko.type.Signal;

 	import flash.display.DisplayObject;
+	import flash.display.DisplayObjectContainer;
 	import flash.display.Graphics;
 	import flash.display.Shape;
 	import flash.display.Sprite;
@@ -232,6 +233,8 @@
 			stage.addEventListener(Event.ADDED_TO_STAGE, displayObjectAddedToStageHandler);
 			stage.addEventListener(Event.REMOVED_FROM_STAGE, displayObjectRemovedFromStageHandler);

+			stage.addEventListener(Event.RESIZE, stageResizedHandler);
+
 			setupOnStage(stage);
 		}

@@ -243,6 +246,8 @@

 			stage.removeEventListener(Event.ADDED_TO_STAGE, displayObjectAddedToStageHandler);
 			stage.removeEventListener(Event.REMOVED_FROM_STAGE, displayObjectRemovedFromStageHandler);
+
+			stage.removeEventListener(Event.RESIZE, stageResizedHandler);

 			if (_stage3d != null)
 				_stage3d.visible = false;
@@ -322,6 +327,8 @@
 		private function stageResizedHandler(event : Event) : void
 		{
 			updateMask();
+			updateStage3D();
+			updateBackBuffer();
 		}

 		private function parentResizedHandler(event : Event) : void
@@ -351,8 +358,12 @@
 				return ;

 			_invalidBackBuffer = false;
-			_stage3d.context3D.configureBackBuffer(_width, _height, _antiAliasing, true);
-			_backBuffer = new RenderTarget(_width, _height, null, 0, _backgroundColor);
+
+			var backBufferWidth		: Number = _width * getGlobalScaleX();
+			var backBufferHeight	: Number = _height * getGlobalScaleY();
+
+			_stage3d.context3D.configureBackBuffer(backBufferWidth, backBufferHeight, _antiAliasing, true);
+			_backBuffer = new RenderTarget(backBufferWidth, backBufferHeight, null, 0, _backgroundColor);

 			graphics.clear();
 			graphics.beginFill(0, 0);
@@ -446,5 +457,33 @@
 			if (_autoResize && displayObject.parent == stage)
 				displayObject.mask = null;
 		}
+
+		private function getGlobalScaleX() : Number
+		{
+			var currentParent	: DisplayObjectContainer	= parent;
+			var scale			: Number					= scaleX;
+
+			while(currentParent != stage)
+			{
+				scale *= currentParent.scaleX;
+				currentParent = currentParent.parent;
+			}
+
+			return scale;
+		}
+
+		private function getGlobalScaleY() : Number
+		{
+			var currentParent	: DisplayObjectContainer	= parent;
+			var scale			: Number					= scaleY;
+
+			while(currentParent != stage)
+			{
+				scale *= currentParent.scaleY;
+				currentParent = currentParent.parent;
+			}
+
+			return scale;
+		}
 	}
 }


Move these variables where they belong and add some documentation. Also apparently whitespace.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@6506 542714f4-19e9-0310-aa3c-eee0fc999fb1

--- src/main/as/com/threerings/presents/dobj/DObject.as
+++ src/main/as/com/threerings/presents/dobj/DObject.as
@@ -37,7 +37,11 @@
 public class DObject // extends EventDispatcher
     implements Streamable
 {
-    private static const log :Log = Log.getLog(DObject);
+    /** Dispatched when a message is posted to the DObject */
+    public const messageReceived :Signal = new Signal(String, Array);
+
+    /** Dispatched when the DObject is destroyed */
+    public const destroyed :Signal = new Signal();

     public function DObject ()
     {
@@ -77,9 +81,6 @@
             }
         }
     }
-
-    public const messageReceived :Signal = new Signal(String, Array);
-    public const destroyed :Signal = new Signal();

     public function setDestroyOnLastSubscriberRemoved (deathWish :Boolean) :void
     {
@@ -231,9 +232,9 @@
         }
     }

-    /**
+    /**
      * Commits the transaction in which this distributed object is involved.
-     */
+     */
     public function commitTransaction () :void
     {
         if (_tevent == null) {
@@ -339,7 +340,7 @@
         // dispatch an attribute changed event
         postEvent(new ElementUpdatedEvent(_oid, name, value, oldValue, index));
     }
-
+
     /**
      * Calls by derived instances when an oid adder method was called.
      */
@@ -348,7 +349,7 @@
         // dispatch an object added event
         postEvent(new ObjectAddedEvent(_oid, name, oid));
     }
-
+
     /**
      * Calls by derived instances when an oid remover method was called.
      */
@@ -421,6 +422,8 @@

     /** Indicates whether we want to be destroyed when our last subscriber is removed. */
     protected var _deathWish :Boolean = false;
+
+    private static const log :Log = Log.getLog(DObject);
 }
 }


Changed default mode to correspond to buttoncontrol

git-svn-id: f772d44cbf86d9968f12179c1556189f5afcea6e@634 e0ac87d7-b42b-0410-9034-8248a05cb448

--- braineditor/Drawable.as
+++ braineditor/Drawable.as
@@ -8,8 +8,8 @@
   function Drawable(parent:MovieClip,layer:Number) {
      super(parent,layer);
      mMode=DRAGMODE;
-     mMode=DRAGMODE;
-     mMode=ERASEMODE;
+     //mMode=DRAGMODE;
+     //mMode=ERASEMODE;
   }
   function _mouseFunction(boxColor:Number) {
          mSelectBox.clear();


added check for null initialize method

added check for null initialize method

--- WeaveCore/src/weave/core/LinkablePromise.as
+++ WeaveCore/src/weave/core/LinkablePromise.as
@@ -53,7 +53,8 @@

 			function asyncStart():AsyncToken
 			{
-				initialize();
+				if (initialize != null)
+					initialize();
 				WeaveAPI.StageUtils.startTask(promise, iterativeTask, priority, asyncComplete);
 				return asyncToken = new AsyncToken();
 			}


fixed bug where GeoJsonDataSource was always busy.

--- WeaveData/src/weave/data/DataSources/GeoJSONDataSource.as
+++ WeaveData/src/weave/data/DataSources/GeoJSONDataSource.as
@@ -95,9 +95,7 @@

 		override protected function get initializationComplete():Boolean
 		{
-			return super.initializationComplete
-				&& !linkableObjectIsBusy(this)
-				&& jsonData;
+			return super.initializationComplete && !linkableObjectIsBusy(url) && jsonData;
 		}

 		/**


Update Matrix4x4.as

Update Matrix4x4.as

var m:Matrix4x4 = new Matrix4x4();
trace('translationX=' + m.translationX); // 0
m.appendTranslation(1);
trace('translationX=' + m.translationX); // 0

--- src/aerys/minko/type/math/Matrix4x4.as
+++ src/aerys/minko/type/math/Matrix4x4.as
@@ -328,6 +328,7 @@
                                                 y : Number = 0.,
                                                 z : Number = 0.) : Matrix4x4
 		{
+			_invalidComponents = COMPONENT_ALL;
 			_matrix.appendTranslation(x, y, z);

 			_hasChanged = true;
@@ -371,6 +372,7 @@

         final public function prependUniformScale(scale : Number) : Matrix4x4
 		{
+			_invalidComponents = COMPONENT_ALL;
 			_matrix.prependScale(scale, scale, scale);

 			_hasChanged = true;
@@ -384,6 +386,7 @@
                                                  y : Number	= 1.,
                                                  z : Number	= 1.) : Matrix4x4
 		{
+			_invalidComponents = COMPONENT_ALL;
 			_matrix.prependTranslation(x, y, z);

 			_hasChanged = true;
@@ -431,6 +434,7 @@

         final public function identity() : Matrix4x4
 		{
+			_invalidComponents = COMPONENT_ALL;
 			_matrix.identity();

 			_hasChanged = true;
@@ -442,6 +446,7 @@

         final public function invert() : Matrix4x4
 		{
+			_invalidComponents = COMPONENT_ALL;
 			_matrix.invert();

 			_hasChanged = true;
@@ -453,6 +458,7 @@

         final public function transpose() : Matrix4x4
 		{
+			_invalidComponents = COMPONENT_ALL;
 			_matrix.transpose();

 			_hasChanged = true;


Clarify, although can this be what is meant? There does not appear to be
a way to start a new round other than by setting a nonzero delay when ending
the previous round.

git-svn-id: a3e1eb16dde062992de22c830ed8045c8013209a@239 c613c5cb-e716-0410-b11b-feb51c14d237

--- src/as/com/threerings/ezgame/EZGameControl.as
+++ src/as/com/threerings/ezgame/EZGameControl.as
@@ -502,7 +502,8 @@

     /**
      * Ends the current round. If nextRoundDelay is greater than zero, the next round will be
-     * started in the specified number of seconds.
+     * started in the specified number of seconds, otherwise no next round
+     * will be started.
      */
     public function endRound (nextRoundDelay :int = 0) :void
     {


Update frame4.as

Update frame4.as

--- as/main/frame4.as
+++ as/main/frame4.as
@@ -10,6 +10,11 @@
 this.historia_txt.wordWrap = true;
 this.historia_txt.multiline = true;

+this.onEnterFrame = function ():Void
+{
+    buttonsUI[i].oOver();
+    this.stop();
+};

 function textScroll():Void
 {
@@ -29,11 +34,11 @@
 	pressing = false;
 };

+var Private_lv = new LoadVars ();

+Private_lv.load ("/assets/tendes.txt");

-var Private_lv = new LoadVars ();
-Private_lv.load ("/assets/tendes.txt");
-Private_lv.onLoad = function ()
+Private_lv.onLoad = function ():Void
 {
 	this.historia_txt.htmlText = this.Privat;
 	this.play ();


Level : adjust getSeqNumNearestPTS() logic

this function returns a SN matching with a given PTS
current logic loop through all fragments, starting from the first one,
and return in case PTS is closer from fragment end than fragment start

now we also return if PTS is more than 10% after fragment start.
this allows to handle inter level overlapping fragments more easily

--- src/org/mangui/hls/model/Level.as
+++ src/org/mangui/hls/model/Level.as
@@ -126,8 +126,15 @@

             for (var i : int = firstIndex; i <= lastIndex; i++) {
                 var frag : Fragment = fragments[i];
+                var start : Number = frag.data.pts_start_computed;
+                var duration :Number = frag.duration;
+                var end : Number = start + 1000*duration;
                 /* check nearest fragment */
-                if ( frag.data.valid && (frag.duration >= 0) && (Math.abs(frag.data.pts_start_computed - pts) < Math.abs(frag.data.pts_start_computed + 1000 * frag.duration - pts))) {
+                if ( frag.data.valid &&
+                    (duration >= 0) &&
+                    // if PTS is closer from end OR if PTS is greater than start and more than 10% after frag start
+                    ((Math.abs(start - pts) < Math.abs(end - pts)) ||
+                    (pts - start ) > 100*duration)) {
                     return frag.seqnum;
                 }
             }


added rename handlers

added rename handlers

--- WeaveUI/src/weave/ui/VariableListController.as
+++ WeaveUI/src/weave/ui/VariableListController.as
@@ -173,6 +173,7 @@
 		private var _labelFunction:Function = null;
 		private var _filterFunction:Function = null;
 		private var _reverse:Boolean = false;
+		private var _renameHandlers:Array = [];

 		public function get hashMap():ILinkableHashMap
 		{
@@ -527,8 +528,20 @@
 				var newValue:String = grid.itemEditorInstance[field];

 				if (hashMap && newValue && hashMap.getNames().indexOf(newValue) < 0)
+				{
 					hashMap.renameObject(oldName, newValue);
-			}
+					for each (var handler:Function in _renameHandlers)
+						handler(oldName, newValue);
+				}
+			}
+		}
+
+		/**
+		 * @param handler A function that takes two parameters: oldName, newName
+		 */
+		public function addRenameHandler(handler:Function):void
+		{
+			_renameHandlers.push(handler);
 		}
 	}
 }


Renamed Grid's functions & parameters to match Tilemap's.

--- net/flashpunk/masks/Grid.as
+++ net/flashpunk/masks/Grid.as
@@ -21,21 +21,21 @@
 		 * Constructor.
 		 * @param	width			Width of the grid, in pixels.
 		 * @param	height			Height of the grid, in pixels.
-		 * @param	cellWidth		Width of a grid cell, in pixels.
-		 * @param	cellHeight		Height of a grid cell, in pixels.
+		 * @param	tileWidth		Width of a grid tile, in pixels.
+		 * @param	tileHeight		Height of a grid tile, in pixels.
 		 * @param	x				X offset of the grid.
 		 * @param	y				Y offset of the grid.
 		 */
-		public function Grid(width:uint, height:uint, cellWidth:uint, cellHeight:uint, x:int = 0, y:int = 0)
+		public function Grid(width:uint, height:uint, tileWidth:uint, tileHeight:uint, x:int = 0, y:int = 0)
 		{
 			// check for illegal grid size
-			if (!width || !height || !cellWidth || !cellHeight) throw new Error("Illegal Grid, sizes cannot be 0.");
+			if (!width || !height || !tileWidth || !tileHeight) throw new Error("Illegal Grid, sizes cannot be 0.");

 			// set grid properties
-			_columns = width / cellWidth;
-			_rows = height / cellHeight;
+			_columns = width / tileWidth;
+			_rows = height / tileHeight;
 			_data = new BitmapData(_columns, _rows, true, 0);
-			_cell = new Rectangle(0, 0, cellWidth, cellHeight);
+			_tile = new Rectangle(0, 0, tileWidth, tileHeight);
 			_x = x;
 			_y = y;
 			_width = width;
@@ -47,15 +47,163 @@
 			_check[Pixelmask] = collidePixelmask;
 		}

+		/**
+		 * Sets the value of the tile.
+		 * @param	column		Tile column.
+		 * @param	row			Tile row.
+		 * @param	solid		If the tile should be solid.
+		 */
+		public function setTile(column:uint = 0, row:uint = 0, solid:Boolean = true):void
+		{
+			if (usePositions)
+			{
+				column /= _tile.width;
+				row /= _tile.height;
+			}
+			_data.setPixel32(column, row, solid ? 0xFFFFFFFF : 0);
+		}
+
+		/**
+		 * Makes the tile non-solid.
+		 * @param	column		Tile column.
+		 * @param	row			Tile row.
+		 */
+		public function clearTile(column:uint = 0, row:uint = 0):void
+		{
+			setTile(column, row, false);
+		}
+
+		/**
+		 * Gets the value of a tile.
+		 * @param	column		Tile column.
+		 * @param	row			Tile row.
+		 * @return	tile value.
+		 */
+		public function getTile(column:uint = 0, row:uint = 0):Boolean
+		{
+			if (usePositions)
+			{
+				column /= _tile.width;
+				row /= _tile.height;
+			}
+			return _data.getPixel32(column, row) > 0;
+		}
+
+		/**
+		 * Sets the value of a rectangle region of tiles.
+		 * @param	column		First column.
+		 * @param	row			First row.
+		 * @param	width		Columns to fill.
+		 * @param	height		Rows to fill.
+		 * @param	fill		Value to fill.
+		 */
+		public function setRect(column:uint = 0, row:uint = 0, width:int = 1, height:int = 1, solid:Boolean = true):void
+		{
+			if (usePositions)
+			{
+				column /= _tile.width;
+				row /= _tile.height;
+				width /= _tile.width;
+				height /= _tile.height;
+			}
+			_rect.x = column;
+			_rect.y = row;
+			_rect.width = width;
+			_rect.height = height;
+			_data.fillRect(_rect, solid ? 0xFFFFFFFF : 0);
+		}
+
+		/**
+		 * Makes the rectangular region of tiles non-solid.
+		 * @param	column		First column.
+		 * @param	row			First row.
+		 * @param	width		Columns to fill.
+		 * @param	height		Rows to fill.
+		 */
+		public function clearRect(column:uint = 0, row:uint = 0, width:int = 1, height:int = 1):void
+		{
+			setRect(column, row, width, height, false);
+		}
+
+		/**
+		* Loads the grid data from a string.
+		* @param str			The string data, which is a set of tile values (0 or 1) separated by the columnSep and rowSep strings.
+		* @param columnSep		The string that separates each tile value on a row, default is ",".
+		* @param rowSep			The string that separates each row of tiles, default is "\n".
+		*/
+		public function loadFromString(str:String, columnSep:String = ",", rowSep:String = "\n"):void
+		{
+			var row:Array = str.split(rowSep),
+				rows:int = row.length,
+				col:Array, cols:int, x:int, y:int;
+			for (y = 0; y < rows; y ++)
+			{
+				if (row[y] == '') continue;
+				col = row[y].split(columnSep),
+				cols = col.length;
+				for (x = 0; x < cols; x ++)
+				{
+					if (col[x] == '') continue;
+					setTile(x, y, uint(col[x]) > 0);
+				}
+			}
+		}
+
+		/**
+		* Saves the grid data to a string.
+		* @param columnSep		The string that separates each tile value on a row, default is ",".
+		* @param rowSep			The string that separates each row of tiles, default is "\n".
+		*/
+		public function saveToString(columnSep:String = ",", rowSep:String = "\n"): String
+		{
+			var s:String = '',
+				x:int, y:int;
+			for (y = 0; y < _rows; y ++)
+			{
+				for (x = 0; x < _columns; x ++)
+				{
+					s += String(getTile(x, y));
+					if (x != _columns - 1) s += columnSep;
+				}
+				if (y != _rows - 1) s += rowSep;
+			}
+			return s;
+		}
+
+		/**
+		 * The tile width.
+		 */
+		public function get tileWidth():uint { return _tile.width; }
+
+		/**
+		 * The tile height.
+		 */
+		public function get tileHeight():uint { return _tile.height; }
+
+		/**
+		 * How many columns the grid has
+		 */
+		public function get columns():uint { return _columns; }
+
+		/**
+		 * How many rows the grid has.
+		 */
+		public function get rows():uint { return _rows; }
+
+		/**
+		 * The grid data.
+		 */
+		public function get data():BitmapData { return _data; }
+
 		/** @private Collides against an Entity. */
 		private function collideMask(other:Mask):Boolean
 		{
 			_rect.x = other.parent.x - other.parent.originX - parent.x + parent.originX;
 			_rect.y = other.parent.y - other.parent.originY - parent.y + parent.originY;
-			_point.x = int((_rect.x + other.parent.width - 1) / _cell.width) + 1;
-			_point.y = int((_rect.y + other.parent.height -1) / _cell.height) + 1;
-			_rect.x = int(_rect.x / _cell.width);
-			_rect.y = int(_rect.y / _cell.height);
+			_point.x = int((_rect.x + other.parent.width - 1) / _tile.width) + 1;
+			_point.y = int((_rect.y + other.parent.height -1) / _tile.height) + 1;
+			_rect.x = int(_rect.x / _tile.width);
+			_rect.y = int(_rect.y / _tile.height);
 			_rect.width = _point.x - _rect.x;
 			_rect.height = _point.y - _rect.y;
 			return _data.hitTest(FP.zero, 1, _rect);
@@ -66,10 +214,10 @@
 		{
 			_rect.x = other.parent.x + other._x - parent.x - _x;
 			_rect.y = other.parent.y + other._y - parent.y - _y;
-			_point.x = int((_rect.x + other._width - 1) / _cell.width) + 1;
-			_point.y = int((_rect.y + other._height -1) / _cell.height) + 1;
-			_rect.x = int(_rect.x / _cell.width);
-			_rect.y = int(_rect.y / _cell.height);
+			_point.x = int((_rect.x + other._width - 1) / _tile.width) + 1;
+			_point.y = int((_rect.y + other._height -1) / _tile.height) + 1;
+			_rect.x = int(_rect.x / _tile.width);
+			_rect.y = int(_rect.y / _tile.height);
 			_rect.width = _point.x - _rect.x;
 			_rect.height = _point.y - _rect.y;
 			return _data.hitTest(FP.zero, 1, _rect);
@@ -80,14 +228,14 @@
 		{
 			var x1:int = other.parent.x + other._x - parent.x - _x,
 				y1:int = other.parent.y + other._y - parent.y - _y,
-				x2:int = ((x1 + other._width - 1) / _cell.width),
-				y2:int = ((y1 + other._height - 1) / _cell.height);
+				x2:int = ((x1 + other._width - 1) / _tile.width),
+				y2:int = ((y1 + other._height - 1) / _tile.height);
 			_point.x = x1;
 			_point.y = y1;
-			x1 /= _cell.width;
-			y1 /= _cell.height;
-			_cell.x = x1 * _cell.width;
-			_cell.y = y1 * _cell.height;
+			x1 /= _tile.width;
+			y1 /= _tile.height;
+			_tile.x = x1 * _tile.width;
+			_tile.y = y1 * _tile.height;
 			var xx:int = x1;
 			while (y1 <= y2)
 			{
@@ -95,95 +243,24 @@
 				{
 					if (_data.getPixel32(x1, y1))
 					{
-						if (other._data.hitTest(_point, 1, _cell)) return true;
+						if (other._data.hitTest(_point, 1, _tile)) return true;
 					}
 					x1 ++;
-					_cell.x += _cell.width;
+					_tile.x += _tile.width;
 				}
 				x1 = xx;
 				y1 ++;
-				_cell.x = x1 * _cell.width;
-				_cell.y += _cell.height;
+				_tile.x = x1 * _tile.width;
+				_tile.y += _tile.height;
 			}
 			return false;
 		}
-
-		/**
-		 * The grid data.
-		 */
-		public function get data():BitmapData { return _data; }
-
-		/**
-		 * Sets the value of the cell.
-		 * @param	x		Cell column.
-		 * @param	y		Cell row.
-		 * @param	fill	Fill value.
-		 */
-		public function setCell(x:uint = 0, y:uint = 0, solid:Boolean = true):void
-		{
-			if (usePositions)
-			{
-				x /= _cell.width;
-				y /= _cell.height;
-			}
-			_data.setPixel32(x, y, solid ? 0xFFFFFFFF : 0);
-		}
-
-		/**
-		 * Sets the value of a rectangle region of cells.
-		 * @param	x			First column.
-		 * @param	y			First row.
-		 * @param	width		Columns to fill.
-		 * @param	height		Rows to fill.
-		 * @param	fill		Value to fill.
-		 */
-		public function setRect(x:uint = 0, y:uint = 0, width:int = 1, height:int = 1, solid:Boolean = true):void
-		{
-			if (usePositions)
-			{
-				x /= _cell.width;
-				y /= _cell.height;
-				width /= _cell.width;
-				height /= _cell.height;
-			}
-			_rect.x = x;
-			_rect.y = y;
-			_rect.width = width;
-			_rect.height = height;
-			_data.fillRect(_rect, solid ? 0xFFFFFFFF : 0);
-		}
-
-		/**
-		 * Gets the value of a cell.
-		 * @param	x		Cell column.
-		 * @param	y		Cell row.
-		 * @return	Cell value.
-		 */
-		public function getCell(x:uint = 0, y:uint = 0):Boolean
-		{
-			if (usePositions)
-			{
-				x /= _cell.width;
-				y /= _cell.height;
-			}
-			return _data.getPixel32(x, y) > 0;
-		}
-
-		/**
-		 * How many columns the grid has
-		 */
-		public function get columns():uint { return _columns; }
-
-		/**
-		 * How many rows the grid has.
-		 */
-		public function get rows():uint { return _rows; }

 		// Grid information.
 		/** @private */ private var _data:BitmapData;
 		/** @private */ private var _columns:uint;
 		/** @private */ private var _rows:uint;
-		/** @private */ private var _cell:Rectangle;
+		/** @private */ private var _tile:Rectangle;
 		/** @private */ private var _rect:Rectangle = FP.rect;
 		/** @private */ private var _point:Point = FP.point;
 		/** @private */ private var _point2:Point = FP.point2;


Transferred from the Adobe Open Source Subversion Repository

Revision: 14244
Author:   hmuller@adobe.com
Date:     2010-02-18T16:20:43.855767Z

Log Message:
-----------
Merge 4.x revision 14243 to trunk.

Ensure that menus are shown in the correct location when the layout has been mirrored.

QE notes: This change should have no effect on components that haven't been mirrored
Doc notes:
Bugs:
Reviewer: Carol
Tests run: Menu, MenuBar cyclone was checked (thanks Joan)
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/MenuBar.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/Menu.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1268290 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/controls/Menu.as
+++ frameworks/projects/mx/src/mx/controls/Menu.as
@@ -14,7 +14,7 @@

 import flash.display.DisplayObject;
 import flash.display.DisplayObjectContainer;
-import flash.events.Event;
+import flash.events.Event;
 import flash.events.FocusEvent;
 import flash.events.KeyboardEvent;
 import flash.events.MouseEvent;
@@ -24,6 +24,7 @@
 import flash.utils.clearInterval;
 import flash.utils.setTimeout;
 import flash.xml.XMLNode;
+
 import mx.collections.ArrayCollection;
 import mx.collections.CursorBookmark;
 import mx.collections.ICollectionView;
@@ -2423,13 +2424,26 @@
         if (_do.root)   //verify this is sufficient
             sandBoxRootPoint = _do.root.globalToLocal(sandBoxRootPoint);

+        // If the layout is mirrored, and isDirectionLeft then we add the
+        // menu's width to find the origin of menu, rather than subtracting.
+        // Similarly, if isDirectionLeft=false, we subtract the menu item's width.
+
+        const isLayoutMirrored:Boolean = layoutDirection == "rtl";
+        const menuWidth:Number = menu.getExplicitOrMeasuredWidth();
+        const menuItemWidth:Number = row.width;
+
         // showX, showY are in sandbox root coordinates
         var showY:Number = sandBoxRootPoint.y;
         var showX:Number;
         if (!isDirectionLeft)
-            showX = sandBoxRootPoint.x + row.width;
+            showX = sandBoxRootPoint.x + ((isLayoutMirrored) ? -menuItemWidth : +menuItemWidth);
         else
-            showX = sandBoxRootPoint.x - menu.getExplicitOrMeasuredWidth();
+            showX = sandBoxRootPoint.x + ((isLayoutMirrored) ? +menuWidth : -menuWidth);
+
+        // If the layout has been mirrored, then showX is currently menu's right
+        // edge; compensate here.
+        if (isLayoutMirrored)
+            showX -= menuWidth;

         // convert to global coordinates to compare with getVisibleApplicationRect().
         // the screen is the visible coordinates of our sandbox (written in global coordinates)
@@ -2439,7 +2453,7 @@
         var screenPoint:Point = sbRoot.localToGlobal(new Point(showX, showY));

         // do x
-        var shift:Number = screenPoint.x + menu.getExplicitOrMeasuredWidth() - screen.right;
+        var shift:Number = screenPoint.x + menuWidth - screen.right;
         if (shift > 0 || screenPoint.x < screen.x)
         {
             // if we want to ensure our parent's visible, let's
@@ -2463,7 +2477,7 @@
             showX = Math.max(showX - shift, 0);
         }

-        menu.isDirectionLeft = this.x > showX;
+        menu.isDirectionLeft = (isLayoutMirrored) ? (this.x <= showX) : (this.x > showX);

         // now do y
         shift = screenPoint.y + menu.getExplicitOrMeasuredHeight() - screen.bottom;


remove TODO

remove TODO

--- src/battlecode/common/RobotType.as
+++ src/battlecode/common/RobotType.as
@@ -85,7 +85,6 @@
             return []; // TODO air types
         }

-        // TODO fix values
         public static function maxEnergon(type:String):Number {
             switch (type) {
                 case HQ:


adjusting try/catch to match original lang() implementation

--- WeaveJS/src/Weave.as
+++ WeaveJS/src/Weave.as
@@ -499,13 +499,11 @@
 		 */
 		public static function lang(text:String, ...parameters):String
 		{
-			var newText:String = text;
+			// call localize() either way to let the LocaleManager know that we are interested in translations of this text.
+			var newText:String = WeaveAPI.Locale.getText(text);

 			try
 			{
-				// call localize() either way to let the LocaleManager know that we are interested in translations of this text.
-				newText = WeaveAPI.Locale.getText(text);
-
 				if (WeaveAPI.Locale['locale'] == 'developer')
 				{
 					parameters.unshift(text);


Small bugfix on Slider. Slider now centers thumb position within itself.

--- src/org/openPyro/controls/Slider.as
+++ src/org/openPyro/controls/Slider.as
@@ -14,7 +14,7 @@
 	import org.openPyro.skins.ISkin;

 	[Event(name="thumbDrag", type="org.openPyro.controls.events.SliderEvent")]
-
+	[Event(name="change", type="org.openPyro.controls.events.SliderEvent")]
 	public class Slider extends UIControl
 	{

@@ -334,11 +334,13 @@
 			{
 				_thumbButton.x = v*(this.width-_thumbButton.width)/(_maximum-_minimum) ;
 				thumbButtonX = _thumbButton.x;
+				thumbButtonY = (this.height-_thumbButton.height)/2;
 			}
 			else
 			{
 				_thumbButton.y = v*(this.height-_thumbButton.height)/(_maximum-_minimum) ;
 				thumbButtonY = _thumbButton.y;
+				thumbButtonX = (this.width-_thumbButton.width)/2;
 			}
 		}


New text localization functionality & GUI for editing translations.

--- WeaveAPI/src/weave/api/WeaveAPI.as
+++ WeaveAPI/src/weave/api/WeaveAPI.as
@@ -501,7 +501,8 @@
 		 */
 		public static function initializeLocale(locale:String):void
 		{
-			registerTranslation(null, locale.split(['_'])[0], null);
+			locale = locale.split('_')[0];
+			registerTranslation(null, locale, null);
 		}

 		/**
@@ -537,6 +538,7 @@
 			{
 				for each (locale in ResourceManager.getInstance().localeChain)
 				{
+					locale = locale.split('_')[0];
 					// since locale is specified, keepTrying will be false in recursive call
 					result = localize(text, locale);
 					// stop when we find a translation


added missing error message

added missing error message

--- source/ASConfigC.as
+++ source/ASConfigC.as
@@ -444,6 +444,7 @@
 			}
 			catch(error:Error)
 			{
+				console.error("Failed to execute compiler. " + error);
 				process.exit(1);
 			}
 		}


Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1267650 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/containers/GridItem.as
+++ frameworks/projects/mx/src/mx/containers/GridItem.as
@@ -0,0 +1,207 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2003-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.containers
+{
+
+//--------------------------------------
+//  Excluded APIs
+//--------------------------------------
+
+[Exclude(name="direction", kind="property")]
+[Exclude(name="focusEnabled", kind="property")]
+[Exclude(name="focusManager", kind="property")]
+[Exclude(name="focusPane", kind="property")]
+[Exclude(name="mouseFocusEnabled", kind="property")]
+
+[Exclude(name="adjustFocusRect", kind="method")]
+[Exclude(name="getFocus", kind="method")]
+[Exclude(name="isOurFocus", kind="method")]
+[Exclude(name="setFocus", kind="method")]
+
+[Exclude(name="focusIn", kind="event")]
+[Exclude(name="focusOut", kind="event")]
+[Exclude(name="move", kind="event")]
+
+[Exclude(name="focusBlendMode", kind="style")]
+[Exclude(name="focusSkin", kind="style")]
+[Exclude(name="focusThickness", kind="style")]
+[Exclude(name="horizontalGap", kind="style")]
+[Exclude(name="verticalGap", kind="style")]
+
+[Exclude(name="focusInEffect", kind="effect")]
+[Exclude(name="focusOutEffect", kind="effect")]
+[Exclude(name="moveEffect", kind="effect")]
+
+/**
+ *  The GridItem container defines a grid cell in GridRow container.
+ *  (The GridRow container, in turn, defines a row in a Grid container.)
+ *  The GridItem container can contain any number of children,
+ *  which are laid out as in an HBox container.
+ *  If you do not want HBox layout, create a container, such as a VBox
+ *  container, as a child of the GridItem control and put other
+ *  components in this child container.
+ *
+ *
GridItem containers have the following default sizing characteristics:

+ *

+ *

+ *           Characteristic
+ *           Description
+ *

+ *

+ *           Height of each row and each cell
+ *           The default or explicit height of the tallest item in the row. If a GridItem container does not
+ *               have an explicit size, its default height is the default or explicit height of the child in the cell.
+ *

+ *

+ *           Width of each column and each cell
+ *           The default or explicit width of the widest item in the column. If a GridItem container doed not have an explicit
+ *               width, its default width is the default or explicit width of the child in the cell.
+ *

+ *

+ *           Gap between rows and columns
+ *           Determined by the horizontalGap and verticalGap properties of the Grid class. The default value for both
+ *               gaps is 6 pixels.
+ *

+ *

+ *           Default padding
+ *           0 pixels for the top, bottom, left, and right values, for all three container classes.
+ *

+ *

+ *
+ *  @mxml
+ *
+ *
The <mx:GridItem> tag must be a child of the
+ *  <GridRow> tag, which defines a grid row.
+ *  The <mx:GridItem> container inherits the
+ *  tag attributes of its superclass, and adds the following tag attributes.

+ *
+ *

+ *  <mx:Grid>
+ *    <mx:GridRow>
+ *      <mx:GridItem
+ *        rowSpan="1"
+ *        colSpan="1">
+ *          child components
+ *      </mx:GridItem>
+ *      ...
+ *    </mx:GridRow>
+ *    ...
+ *  </mx:Grid>
+ *

+ *
+ *  @see mx.containers.Grid
+ *  @see mx.containers.GridRow
+ *
+ *  @includeExample examples/GridLayoutExample.mxml
+ */
+public class GridItem extends HBox
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     */
+    public function GridItem()
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     */
+    internal var colIndex:int = 0;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Public Properties
+    //
+    //--------------------------------------------------------------------------
+
+    //----------------------------------
+    //  colSpan
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the colSpan property.
+     */
+    private var _colSpan:int = 1;
+
+    [Inspectable(category="General", defaultValue="1")]
+
+    /**
+     *  Number of columns of the Grid container spanned by the cell.
+     *
+     *  @default 1
+     */
+    public function get colSpan():int
+    {
+        return _colSpan;
+    }
+
+    /**
+     *  @private
+     */
+    public function set colSpan(value:int):void
+    {
+        _colSpan = value;
+
+        invalidateSize();
+    }
+
+    //----------------------------------
+    //  rowSpan
+    //----------------------------------
+
+    /**
+     *  @private
+     *  Storage for the rowSpan property.
+     */
+    private var _rowSpan:int = 1;
+
+    [Inspectable(category="General", defaultValue="1")]
+
+    /**
+     *  Number of rows of the Grid container spanned by the cell.
+     *  You cannot extend a cell past the number of rows in the Grid.
+     *
+     *  @default 1
+     */
+    public function get rowSpan():int
+    {
+        return _rowSpan;
+    }
+
+    /**
+     *  @private
+     */
+    public function set rowSpan(value:int):void
+    {
+        _rowSpan = value;
+
+        invalidateSize();
+    }
+}
+
+}


Transferred from the Adobe Open Source Subversion Repository

Revision: 3038
Author:   jvroom@adobe.com
Date:     2008-08-29T15:27:57.348236Z

Log Message:
-----------
Fixed multiple instances of _log

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/rpc/src/mx/rpc/http/Operation.as

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1274211 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/rpc/src/mx/rpc/http/Operation.as
+++ frameworks/projects/rpc/src/mx/rpc/http/Operation.as
@@ -52,8 +52,6 @@

         _log = Log.getLogger("mx.rpc.http.HTTPMultiService");
     }
-
-    private var _log:ILogger;

     /**
      * Stores the parent service which controls this operation.


Fix some reversed logic.

Fix some reversed logic.

git-svn-id: b675b909355d5cf946977f44a8ec5a6ceb3782e4@990 ed5b42cb-e716-0410-a449-f6a68f950b19

--- src/as/com/threerings/cast/MultiFrameBitmap.as
+++ src/as/com/threerings/cast/MultiFrameBitmap.as
@@ -76,7 +76,7 @@
         if (_curFrameIndex == -1) {
             return false;
         } else {
-            if (_bitmap.hitTestPoint(stageX, stageY, true)) {
+            if (!_bitmap.hitTestPoint(stageX, stageY, true)) {
                 // Doesn't even hit the bounds...
                 return false;
             }


Улучшение Progress

Улучшение Progress

--- src/main/org/shypl/common/app/MainPreloader.as
+++ src/main/org/shypl/common/app/MainPreloader.as
@@ -24,10 +24,6 @@
 			_progresses.addNoticeHandler(ProgressCompleteNotice, onProgressesComplete, false);
 		}

-		override protected function calculatePercent():Number {
-			return _progresses.percent;
-		}
-
 		public function receiveSwf(sprite:Sprite):void {
 			var main:AbstractMain = AbstractMain(sprite);
 			var progress:Progress = main.run(_parameters, _stage);
@@ -36,11 +32,15 @@

 			_parameters = null;
 			_stage = null;
-			_progresses = null;
+		}
+
+		override protected function calculatePercent():Number {
+			return _progresses.percent;
 		}

 		private function onProgressesComplete():void {
 			complete();
+			_progresses = null;
 		}
 	}
 }


Group object is a bytearray

Group object is a bytearray

--- src/sfxworks/services/DatabaseService.as
+++ src/sfxworks/services/DatabaseService.as
@@ -136,7 +136,7 @@
 				//Write db file.
 				var fs:FileStream = new FileStream();
 				fs.open(new File(DATABASE_DIRECTORY.nativePath + File.separator + e.groupName.substr(SERVICE_NAME.length) + ".db"), FileMode.WRITE);
-					fs.writeBytes(e.groupObject.data as ByteArray, 0, e.groupObject.data.length as ByteArray);
+					fs.writeBytes(e.groupObject as ByteArray, 0, e.groupObject.length as ByteArray);
 					fs.close();


Run runLater in Spec even when asyncTime is 0

--- src/as3spec/Spec.as
+++ src/as3spec/Spec.as
@@ -53,6 +53,7 @@
 		    asyncTimer.addEventListener('timerComplete', _runLater);
 		    asyncTimer.start();
 		  } else {
+		    runLater();
 		    after();
 		  }
 		}


196 Cleaned up that comment about getters in ObjectDumper

--- raw/src/org/yellcorp/debug/debugutil/ObjectDumper.as
+++ raw/src/org/yellcorp/debug/debugutil/ObjectDumper.as
@@ -69,16 +69,17 @@
             return;
         }

-        // no good: if late property evaluation, i.e. name[prop] invokes a getter that
-        // throws an exception, try/catch won't actually catch it.  this is likely the
-        // same problem that says you shouldn't throw in flash.utils.Proxy subclasses
+        // Can't enumerate getters: if late property evaluation, i.e. name[prop] invokes
+        // a getter that throws an exception, try/catch won't actually catch it.  this is
+        // likely the same problem that says you shouldn't throw in flash.utils.Proxy
+        // subclasses
+
+        // avm doesn't set up error handling for [] operator i guess?

         /*
         if (optEvalGetters)
             evalList.appendChild(desc.accessor.(@access=="readonly" || @access=="readwrite"));
-             */
-
-        // avm doesn't set up error handling for [] operator i guess?
+        */

         for each (node in evalList.*)
         {


steage3d render update

steage3d render update

--- src/flash/display3D/Context3D.as
+++ src/flash/display3D/Context3D.as
@@ -57,6 +57,7 @@

 		public function clear(red:Number = 0, green:Number = 0, blue:Number = 0, alpha:Number = 1, depth:Number = 1, stencil:uint = 0, mask:uint = 4294967295):void
 		{
+			SpriteFlexjs.dirtyGraphics = true;
 			gl.clearColor(red, green, blue, alpha);
 			gl.clearDepth(depth);
 			gl.clearStencil(stencil);
@@ -71,6 +72,7 @@

 		public function present():void
 		{
+			SpriteFlexjs.dirtyGraphics = true;
 		}

 		public function setProgram(program:Program3D):void


On the mac, using "open" to run a swf has the disadvantage of obliterating the
current directory. The current directory is set to /.
So we can't read parameters.xml out of the current directory and we can't pass
the current directory in, because if we could do that we wouldn't need parameters.xml!
GAH! So read parameters.xml from the same directory as the SWF, because
that's the only thing we can reliably know about.

git-svn-id: a1a4b28b82a3276cc491891159dd9963a0a72fae@5133 542714f4-19e9-0310-aa3c-eee0fc999fb1

--- src/as/com/threerings/util/ParameterUtil.as
+++ src/as/com/threerings/util/ParameterUtil.as
@@ -30,6 +30,8 @@
 import flash.net.URLLoader;
 import flash.net.URLRequest;

+import flash.system.Capabilities;
+
 /**
  * A utility for loading parameters from an XML file when run from
  * the local filesystem.
@@ -59,8 +61,10 @@
      */
     public static function getInfoParameters (loaderInfo :LoaderInfo, callback :Function) :void
     {
+        var url :String = loaderInfo.url;
+
         // ensure that it's initialized...
-        if (loaderInfo.url == null) {
+        if (url == null) {
             // Create a function to wait until the loaded object is initialized
             var initWaiter :Function = function (event :Event) :void {
                 loaderInfo.removeEventListener(Event.INIT, initWaiter);
@@ -82,13 +86,24 @@

         // Simply use the parameters in the loaderInfo if we were not
         // loaded from a file.
-        if (0 != loaderInfo.url.indexOf("file:")) {
+        if (0 != url.indexOf("file:")) {
             callback(loaderInfo.parameters);
             return;
         }
+        // else, let's try loading parameters.xml

-        // If we were loaded from a file, read our parameters from the
-        // parameters.xml file.
+        // assume only windows uses the wrong slash
+        var fileSep :String = (-1 != Capabilities.os.indexOf("Windows")) ? "\\" : "/";
+        var dex :int = url.lastIndexOf(fileSep);
+        var paramUrl :String;
+        if (dex == -1) {
+            paramUrl = "file:";
+        } else {
+            paramUrl = url.substring(0, dex + 1);
+        }
+        paramUrl += "parameters.xml";
+        Log.getLog(ParameterUtil).info("Trying to load parameters from " + paramUrl);
+
         var loader :URLLoader = new URLLoader();
         loader.addEventListener(IOErrorEvent.IO_ERROR,
             function (event :Event) :void {
@@ -106,7 +121,7 @@
                 callback(params);
             }
         );
-        loader.load(new URLRequest("file:parameters.xml"));
+        loader.load(new URLRequest(paramUrl));
     }

     /**


update DrawCall.depth to do nothing if DrawCall._enabled = false

--- src/aerys/minko/render/DrawCall.as
+++ src/aerys/minko/render/DrawCall.as
@@ -131,7 +131,7 @@

 		public function get depth() : Number
 		{
-			if (_invalidDepth)
+			if (_invalidDepth && _enabled)
 			{
 				_invalidDepth = false;

@@ -337,6 +337,9 @@

 		public function setParameter(name : String, value : Object) : void
 		{
+//			if (!_enabled)
+//				return ;
+
 			var binding : IBinder = _bindings[name] as IBinder;

 			if (binding != null)


Fixed issues with FP.getColorHSV().

Fixed issues with FP.getColorHSV().

--- net/flashpunk/FP.as
+++ net/flashpunk/FP.as
@@ -473,22 +473,21 @@
 		 */
 		public static function getColorHSV(h:Number, s:Number, v:Number):uint
 		{
-			return 0xFFFFFF;
-			h *= 6;
-			var i:int = h,
-				f:Number = h - i;
-			if (!(i & 1)) f = 1 - f;
-			var m:Number = v * (1 - s),
-				n:Number = v * (1 - s * f);
-			switch (i)
-			{
-				case 6:
-				case 0: return int(v) << 16 | int(n) << 8 | int(m);
-				case 1: return int(n) << 16 | int(v) << 8 | int(m);
-				case 2: return int(m) << 16 | int(v) << 8 | int(n);
-				case 3: return int(m) << 16 | int(n) << 8 | int(v);
-				case 4: return int(n) << 16 | int(m) << 8 | int(v);
-				case 5: return int(v) << 16 | int(m) << 8 | int(n);
+			h = int(h * 360);
+			var hi:int = Math.floor(h / 60) % 6,
+				f:Number = h / 60 - Math.floor(h / 60),
+				p:Number = (v * (1 - s)),
+				q:Number = (v * (1 - f * s)),
+				t:Number = (v * (1 - (1 - f) * s));
+			switch (hi)
+			{
+				case 0: return int(v * 255) << 16 | int(t * 255) << 8 | int(p * 255);
+				case 1: return int(q * 255) << 16 | int(v * 255) << 8 | int(p * 255);
+				case 2: return int(p * 255) << 16 | int(v * 255) << 8 | int(t * 255);
+				case 3: return int(p * 255) << 16 | int(q * 255) << 8 | int(v * 255);
+				case 4: return int(t * 255) << 16 | int(p * 255) << 8 | int(v * 255);
+				case 5: return int(v * 255) << 16 | int(p * 255) << 8 | int(q * 255);
+				default: return 0;
 			}
 			return 0;
 		}


clean up

clean up

--- source/com/kemsky/Stream.as
+++ source/com/kemsky/Stream.as
@@ -93,7 +93,7 @@

         /**
-         * Creates iterator over items
+         * Creates iterator over this stream.
          * @return iterator
          * @see Iterator
          * @internal immutable


Map.createRegion() method.

Map.createRegion() method.

--- src/sentinel/gameplay/world/Map.as
+++ src/sentinel/gameplay/world/Map.as
@@ -3,6 +3,7 @@

 	import sentinel.framework.Data;
 	import sentinel.framework.Thing;
+	import sentinel.gameplay.physics.Vector2D;

 	/**
@@ -41,6 +42,18 @@
 		public function remove(being:Being, destroy:Boolean = false):Being
 		{
 			return _world.remove(being, destroy);
+		}
+
+
+		/**
+		 * Creates a Region within the World associated with this Map. This is an alias for
+		 * add(new Region(name, verticies)).
+		 * @param name The name to associate with the Region.
+		 * @param verticies The list of verticies to use to create the Region.
+		 */
+		public function createRegion(name:String, verticies:Vector.<Vector2D>):Region
+		{
+			return add(new Region(name, verticies)) as Region;
 		}


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1290599 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/advancedgrids/src/mx/olap/OLAPCell.as
+++ frameworks/projects/advancedgrids/src/mx/olap/OLAPCell.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2009 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  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
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      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.
 //
 ////////////////////////////////////////////////////////////////////////////////