package aerys.minko.render.shader.compiler
{
	import flash.utils.ByteArray;

	/**
	 * The CRC32 class provides a set of static methods to create CRC32 values.
	 * @author promethe
	 *
	 */
	public class CRC32
	{
		private static const POLYNOMIAL 		: uint			= 0x04c11db7;
		private static const CRC_TABLE			: Vector.<uint>	= new Vector.<uint>(256, true);
		private static const TMP_BYTEARRAY		: ByteArray		= new ByteArray();

		private static var CRC_TABLE_READY		: Boolean		= false;

		private static function generateCrcTable() : void
		{
			for (var i : uint = 0; i < 256; ++i)
			{
				var crcAccum : uint = (i << 24) & 0xffffffff;

				for (var j : uint = 0; j < 8; ++j)
				{
					if (crcAccum & 0x80000000)
						crcAccum = (crcAccum << 1) ^ POLYNOMIAL;
					else
						crcAccum = (crcAccum << 1);
				}

				CRC_TABLE[i] = crcAccum;
			}

			CRC_TABLE_READY = true;
		}

		public static function computeForByteArrayChunk(source : ByteArray, length : uint) : uint
		{
			if (!CRC_TABLE_READY)
				generateCrcTable();

			var crcTable	: Vector.<uint> = CRC_TABLE;
			var crcAccum 	: uint 			= uint(-1);
			var length1		: uint 			= (length >> 2) << 2;

			var j : uint = 0;
			var i : uint;

			for (; j < length1; j += 4)
			{
				var data : uint = source.readUnsignedInt();

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;
			}

			for (; j < length; ++j)
			{
				i = ((crcAccum >> 24) ^ source.readUnsignedByte()) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
			}

			crcAccum = ~crcAccum;

			return crcAccum;
		}

		public static function computeForByteArray(source : ByteArray) : uint
		{
			source.position = 0;
			return computeForByteArrayChunk(source, source.length);
		}

		public static function computeForString(s : String) : uint
		{
			TMP_BYTEARRAY.length = TMP_BYTEARRAY.position = 0;
			TMP_BYTEARRAY.writeUTFBytes(s);
			return computeForByteArray(TMP_BYTEARRAY);
		}

		public static function computeForNumberVector(v : Vector.<Number>) : uint
		{
			var length		: uint		= v.length;

			TMP_BYTEARRAY.length = TMP_BYTEARRAY.position = 0;

			for (var i : uint = 0; i < length; ++i)
				TMP_BYTEARRAY.writeDouble(v[i]);

			return computeForByteArray(TMP_BYTEARRAY);
		}
	}
}

package aerys.minko.render.shader.compiler
{
	import flash.utils.ByteArray;

	/**
	 * The CRC32 class provides a set of static methods to create CRC32 values.
	 * @author promethe
	 *
	 */
	public class CRC32
	{
		private static const POLYNOMIAL 		: uint			= 0x04c11db7;
		private static const CRC_TABLE			: Vector.<uint>	= new Vector.<uint>(256, true);
		private static const TMP_BYTEARRAY		: ByteArray		= new ByteArray();

		private static var CRC_TABLE_READY		: Boolean		= false;

		private static function generateCrcTable() : void
		{
			for (var i : uint = 0; i < 256; ++i)
			{
				var crcAccum : uint = (i << 24) & 0xffffffff;

				for (var j : uint = 0; j < 8; ++j)
				{
					if (crcAccum & 0x80000000)
						crcAccum = (crcAccum << 1) ^ POLYNOMIAL;
					else
						crcAccum = (crcAccum << 1);
				}

				CRC_TABLE[i] = crcAccum;
			}

			CRC_TABLE_READY = true;
		}

		public static function computeForByteArrayChunk(source : ByteArray, length : uint) : uint
		{
			if (!CRC_TABLE_READY)
				generateCrcTable();

			var crcTable	: Vector.<uint> = CRC_TABLE;
			var crcAccum 	: uint 			= uint(-1);
			var length1		: uint 			= (length >> 2) << 2;

			var j : uint = 0;
			var i : uint;

			for (; j < length1; j += 4)
			{
				var data : uint = source.readUnsignedInt();

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;

				i = ((crcAccum >> 24) ^ data) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
				data >>>= 8;
			}

			for (; j < length; ++j)
			{
				i = ((crcAccum >> 24) ^ source.readUnsignedByte()) & 0xFF;
				crcAccum = (crcAccum << 8) ^ crcTable[i];
			}

			crcAccum = ~crcAccum;

			return crcAccum;
		}

		public static function computeForByteArray(source : ByteArray) : uint
		{
			source.position = 0;
			return computeForByteArrayChunk(source, source.length);
		}

		public static function computeForString(s : String) : uint
		{
			TMP_BYTEARRAY.length = TMP_BYTEARRAY.position = 0;
			TMP_BYTEARRAY.writeUTFBytes(s);
			return computeForByteArray(TMP_BYTEARRAY);
		}

		public static function computeForUintVector(v : Vector.<uint>) : uint
		{
			var length		: uint		= v.length;

			TMP_BYTEARRAY.length = TMP_BYTEARRAY.position = 0;

			for (var i : uint = 0; i < length; ++i)
				TMP_BYTEARRAY.writeUnsignedInt(v[i]);

			return computeForByteArray(TMP_BYTEARRAY);
		}

		public static function computeForNumberVector(v : Vector.<Number>) : uint
		{
			var length		: uint		= v.length;

			TMP_BYTEARRAY.length = TMP_BYTEARRAY.position = 0;

			for (var i : uint = 0; i < length; ++i)
				TMP_BYTEARRAY.writeDouble(v[i]);

			return computeForByteArray(TMP_BYTEARRAY);
		}
	}
}

Add CRC32 for uint vector

Add CRC32 for uint vector


/**
 * User: MerlinDS
 * Date: 13.07.2014
 * Time: 17:11
 */
package com.merlinds.miracle_tool.services {
	import com.merlinds.debug.log;
	import com.merlinds.miracle.utils.serializers.MTFSerializer;
	import com.merlinds.miracle_tool.events.EditorEvent;
	import com.merlinds.miracle_tool.models.AppModel;
	import com.merlinds.unitls.structures.QueueFIFO;

	import flash.events.Event;
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;
	import flash.net.FileFilter;
	import flash.utils.ByteArray;

	import org.robotlegs.mvcs.Actor;

	public class FileSystemService extends Actor {

		public static const PROJECT_EXTENSION:String = ".mtp"; /** Miracle tools project **/
		public static const TEXTURE_EXTENSION:String = ".mtf"; /** Miracle texture format **/
		public static const ANIMATION_EXTENSION:String = ".maf"; /** Miracle animation format **/
		public static const ATF_EXTENSION:String = ".atf"; /** Miracle animation format **/
		public static const PNG_EXTENSION:String = ".png"; /** Miracle animation format **/
		[Inject]
		public var appModel:AppModel;
		[Inject]
		public var actionService:ActionService;

		private var _target:File;
		private var _output:ByteArray;
		private var _publishBuilder:PublishBuilder;
		private var _queue:QueueFIFO;
		private var _projectLoader:ProjectLoader;
		//==============================================================================
		//{region							PUBLIC METHODS
		public function FileSystemService() {
			super();
			_queue = new QueueFIFO();
			_publishBuilder = new PublishBuilder();
		}

		public function readSource():void{
			log(this, "readSource");
			var filters:Array = [
				new FileFilter("SWF file", "*.swf"),
				new FileFilter("PNG Image file", "*.png"),
				new FileFilter("JPG Image file", "*.jpg")
			];
			this.selectSource("Attach source file to project", filters);
		}

		public function readAnimation():void{
			log(this, "readAnimation");
			var filters:Array = [
				new FileFilter("FLA file", "*.fla"),
				new FileFilter("XML file with animation description", "*.xml")
			];
			this.selectSource("Attach animation file to project", filters);
		}

		public function readProject():void{
			log(this, "readAnimation");
			var filters:Array = [
				new FileFilter("FLA file", "*" + PROJECT_EXTENSION)
			];
			this.selectSource("Open project", filters);
		}

		public function readProjectSources(sources:Array):void{
			if(_projectLoader == null){
				_projectLoader = new ProjectLoader(this.projectLoadedCallback);
			}
			if(sources != null){
				_projectLoader.read(sources);
			}
		}

		public function writeProject(name:String, data:Object):void{
			log(this, "writeProject", name);
			_output = new ByteArray();
			//add signature
			_output.position = 0;
			_output.writeUTFBytes(PROJECT_EXTENSION.substr(1).toUpperCase());
			_output.position = 4;
			_output.writeObject(data);
			name = name + PROJECT_EXTENSION;

			_target = this.appModel.lastFileDirection.resolvePath(name);
			_target.addEventListener(Event.SELECT, this.selectProjectForSaveHandler);
			_target.browseForSave("Save project");

		}

		public function writeTexture(name:String, png:ByteArray, mesh:ByteArray):void{
			log(this, "writeTexture", name);
			_queue.push(new SaveHelper(png, PNG_EXTENSION));
			name = name + ATF_EXTENSION;
			/*//create file
			var output:ByteArray = new ByteArray();
			//add signature
			output.position = 0;
			output.writeUTFBytes(TEXTURE_EXTENSION.substr(1).toUpperCase());
			output.position = 4;
			var meshHeaderBlocks:int = Math.ceil( mesh.length / 512 );
			output.writeUnsignedInt( meshHeaderBlocks );
			output.position = 8;
			output.writeBytes(mesh);
			output.position = 8 + meshHeaderBlocks * 512;*/

			_queue.push(new SaveHelper(mesh, TEXTURE_EXTENSION));
			_target = this.appModel.lastFileDirection.resolvePath(name);
			_publishBuilder.createATFFile(png, 0, this.publishBuilderATFHandler);
		}

		public function writeAnimation(animation:ByteArray):void{
			var output:ByteArray = new ByteArray();
			//add signature
			output.position = 0;
			output.writeUTFBytes(ANIMATION_EXTENSION.substr(1).toUpperCase());
			output.position = 4;
			output.writeBytes(animation);
			_queue.push(new SaveHelper(output, ANIMATION_EXTENSION));
		}

		public function clear():void {
			_target = null;
			_output.clear();
			_output = null;
		}
		//} endregion PUBLIC METHODS ===================================================

		//==============================================================================
		//{region						PRIVATE\PROTECTED METHODS
		private function selectSource(title:String, filters:Array = null):void {
			_target = this.appModel.lastFileDirection;
			_target.addEventListener(Event.SELECT, this.selectSourceHandler);
			_target.browseForOpen(title, filters);
		}
		//} endregion PRIVATE\PROTECTED METHODS ========================================

		//==============================================================================
		//{region							EVENTS HANDLERS
		private function projectLoadedCallback(event:EditorEvent = null):void {
			this.eventDispatcher.removeEventListener(EditorEvent.SOURCE_ATTACHED, this.projectLoadedCallback);
			this.eventDispatcher.removeEventListener(EditorEvent.ANIMATION_ATTACHED, this.projectLoadedCallback);
			if(_projectLoader.fileHelpers.length > 0){
				log(this, "projectLoadedCallback");
				var fileHelper:Object = _projectLoader.fileHelpers.shift();
				_target = fileHelper.file;
				_output = fileHelper.bytes;
				this.eventDispatcher.addEventListener(EditorEvent.SOURCE_ATTACHED, this.projectLoadedCallback);
				this.eventDispatcher.addEventListener(EditorEvent.ANIMATION_ATTACHED, this.projectLoadedCallback);
				this.dispatch(new EditorEvent(EditorEvent.FILE_READ));
			}
		}

		private function selectSourceHandler(event:Event):void {
			_target.removeEventListener(event.type, this.selectSourceHandler);
			this.appModel.lastFileDirection = _target.parent;
			log(this, "selectSourceHandler", _target.name);
			//start to download
			var fileStream:FileStream = new FileStream();
			fileStream.addEventListener(Event.COMPLETE, this.completeReadHandler);
			fileStream.openAsync(_target, FileMode.READ);
		}

		private function completeReadHandler(event:Event):void {
			var fileStream:FileStream = event.target as FileStream;
			fileStream.removeEventListener(event.type, this.completeReadHandler);
			log(this, "completeReadHandler");
			_output = new ByteArray();
			fileStream.readBytes(_output);
			fileStream.close();
			this.dispatch(new EditorEvent(EditorEvent.FILE_READ));
		}

		private function selectProjectForSaveHandler(event:Event):void {
			_target.removeEventListener(event.type, this.selectSourceHandler);
			this.appModel.lastFileDirection = _target.parent;
			log(this, "selectProjectForSaveHandler", _target.name);
			var fileStream:FileStream = new FileStream();
			fileStream.open(_target, FileMode.WRITE);
			fileStream.writeBytes(_output);
			fileStream.close();
			_output.clear();
			_output = null;
			if(!_queue.empty){
				var saveHelper:SaveHelper = _queue.pop();
				_output = saveHelper.bytes;
				var name:String = _target.name.substr(0, -4) + saveHelper.ext;
				_target = this.appModel.lastFileDirection.resolvePath(name);
				_target.addEventListener(Event.SELECT, this.selectProjectForSaveHandler);
				_target.browseForSave("Publish animation");
			}
			log(this, "selectProjectForSaveHandler", "Project Saved");
			this.actionService.done();
		}

		private function publishBuilderATFHandler():void {
			_output = new ByteArray();
			_output.writeBytes(_publishBuilder.output);
			_target.addEventListener(Event.SELECT, this.selectProjectForSaveHandler);
			_target.browseForSave("Publish texture");
		}
		//} endregion EVENTS HANDLERS ==================================================

		//==============================================================================
		//{region							GETTERS/SETTERS

		public function get target():File {
			return _target;
		}

		public function get output():ByteArray {
			return _output;
		}

//} endregion GETTERS/SETTERS ==================================================
	}
}

import flash.utils.ByteArray;

class SaveHelper{
	public var bytes:ByteArray;
	public var ext:String;

	public function SaveHelper(bytes:ByteArray, ext:String)
	{
		this.bytes = bytes;
		this.ext = ext;
	}
}

/**
 * User: MerlinDS
 * Date: 13.07.2014
 * Time: 17:11
 */
package com.merlinds.miracle_tool.services {
	import com.merlinds.debug.log;
	import com.merlinds.miracle.utils.serializers.MTFSerializer;
	import com.merlinds.miracle_tool.events.EditorEvent;
	import com.merlinds.miracle_tool.models.AppModel;
	import com.merlinds.unitls.structures.QueueFIFO;

	import flash.events.Event;
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;
	import flash.net.FileFilter;
	import flash.utils.ByteArray;

	import org.robotlegs.mvcs.Actor;

	public class FileSystemService extends Actor {

		public static const PROJECT_EXTENSION:String = ".mtp"; /** Miracle tools project **/
		public static const TEXTURE_EXTENSION:String = ".mtf"; /** Miracle texture format **/
		public static const ANIMATION_EXTENSION:String = ".maf"; /** Miracle animation format **/
		public static const ATF_EXTENSION:String = ".atf"; /** Miracle animation format **/
		public static const PNG_EXTENSION:String = ".png"; /** Miracle animation format **/
		[Inject]
		public var appModel:AppModel;
		[Inject]
		public var actionService:ActionService;

		private var _target:File;
		private var _output:ByteArray;
		private var _publishBuilder:PublishBuilder;
		private var _queue:QueueFIFO;
		private var _projectLoader:ProjectLoader;
		//==============================================================================
		//{region							PUBLIC METHODS
		public function FileSystemService() {
			super();
			_queue = new QueueFIFO();
			_publishBuilder = new PublishBuilder();
		}

		public function readSource():void{
			log(this, "readSource");
			var filters:Array = [
				new FileFilter("SWF file", "*.swf"),
				new FileFilter("PNG Image file", "*.png"),
				new FileFilter("JPG Image file", "*.jpg")
			];
			this.selectSource("Attach source file to project", filters);
		}

		public function readAnimation():void{
			log(this, "readAnimation");
			var filters:Array = [
				new FileFilter("FLA file", "*.fla"),
				new FileFilter("XML file with animation description", "*.xml")
			];
			this.selectSource("Attach animation file to project", filters);
		}

		public function readProject():void{
			log(this, "readAnimation");
			var filters:Array = [
				new FileFilter("FLA file", "*" + PROJECT_EXTENSION)
			];
			this.selectSource("Open project", filters);
		}

		public function readProjectSources(sources:Array):void{
			if(_projectLoader == null){
				_projectLoader = new ProjectLoader(this.projectLoadedCallback);
			}
			if(sources != null){
				_projectLoader.read(sources);
			}
		}

		public function writeProject(name:String, data:Object):void{
			log(this, "writeProject", name);
			_output = new ByteArray();
			//add signature
			_output.position = 0;
			_output.writeUTFBytes(PROJECT_EXTENSION.substr(1).toUpperCase());
			_output.position = 4;
			_output.writeObject(data);
			name = name + PROJECT_EXTENSION;

			_target = this.appModel.lastFileDirection.resolvePath(name);
			_target.addEventListener(Event.SELECT, this.selectProjectForSaveHandler);
			_target.browseForSave("Save project");

		}

		public function writeTexture(name:String, png:ByteArray, mesh:ByteArray):void{
			log(this, "writeTexture", name);
			_queue.push(new SaveHelper(png, PNG_EXTENSION));
			_queue.push(new SaveHelper(mesh, TEXTURE_EXTENSION));
			_target = this.appModel.lastFileDirection.resolvePath(name + ATF_EXTENSION);
			_publishBuilder.createATFFile(png, 0, this.publishBuilderATFHandler);
		}

		public function writeAnimation(animation:ByteArray):void{
			var output:ByteArray = new ByteArray();
			//add signature
			output.position = 0;
			output.writeUTFBytes(ANIMATION_EXTENSION.substr(1).toUpperCase());
			output.position = 4;
			output.writeBytes(animation);
			_queue.push(new SaveHelper(output, ANIMATION_EXTENSION));
		}

		public function clear():void {
			_target = null;
			_output.clear();
			_output = null;
		}
		//} endregion PUBLIC METHODS ===================================================

		//==============================================================================
		//{region						PRIVATE\PROTECTED METHODS
		private function selectSource(title:String, filters:Array = null):void {
			_target = this.appModel.lastFileDirection;
			_target.addEventListener(Event.SELECT, this.selectSourceHandler);
			_target.browseForOpen(title, filters);
		}
		//} endregion PRIVATE\PROTECTED METHODS ========================================

		//==============================================================================
		//{region							EVENTS HANDLERS
		private function projectLoadedCallback(event:EditorEvent = null):void {
			this.eventDispatcher.removeEventListener(EditorEvent.SOURCE_ATTACHED, this.projectLoadedCallback);
			this.eventDispatcher.removeEventListener(EditorEvent.ANIMATION_ATTACHED, this.projectLoadedCallback);
			if(_projectLoader.fileHelpers.length > 0){
				log(this, "projectLoadedCallback");
				var fileHelper:Object = _projectLoader.fileHelpers.shift();
				_target = fileHelper.file;
				_output = fileHelper.bytes;
				this.eventDispatcher.addEventListener(EditorEvent.SOURCE_ATTACHED, this.projectLoadedCallback);
				this.eventDispatcher.addEventListener(EditorEvent.ANIMATION_ATTACHED, this.projectLoadedCallback);
				this.dispatch(new EditorEvent(EditorEvent.FILE_READ));
			}
		}

		private function selectSourceHandler(event:Event):void {
			_target.removeEventListener(event.type, this.selectSourceHandler);
			this.appModel.lastFileDirection = _target.parent;
			log(this, "selectSourceHandler", _target.name);
			//start to download
			var fileStream:FileStream = new FileStream();
			fileStream.addEventListener(Event.COMPLETE, this.completeReadHandler);
			fileStream.openAsync(_target, FileMode.READ);
		}

		private function completeReadHandler(event:Event):void {
			var fileStream:FileStream = event.target as FileStream;
			fileStream.removeEventListener(event.type, this.completeReadHandler);
			log(this, "completeReadHandler");
			_output = new ByteArray();
			fileStream.readBytes(_output);
			fileStream.close();
			this.dispatch(new EditorEvent(EditorEvent.FILE_READ));
		}

		private function selectProjectForSaveHandler(event:Event):void {
			_target.removeEventListener(event.type, this.selectSourceHandler);
			this.appModel.lastFileDirection = _target.parent;
			log(this, "selectProjectForSaveHandler", _target.name);
			var fileStream:FileStream = new FileStream();
			fileStream.open(_target, FileMode.WRITE);
			fileStream.writeBytes(_output);
			fileStream.close();
			_output.clear();
			_output = null;
			if(!_queue.empty){
				var saveHelper:SaveHelper = _queue.pop();
				_output = saveHelper.bytes;
				var name:String = _target.name.substr(0, -4) + saveHelper.ext;
				_target = this.appModel.lastFileDirection.resolvePath(name);
				_target.addEventListener(Event.SELECT, this.selectProjectForSaveHandler);
				_target.browseForSave("Publish animation");
			}
			log(this, "selectProjectForSaveHandler", "Project Saved");
			this.actionService.done();
		}

		private function publishBuilderATFHandler():void {
			_output = new ByteArray();
			_output.writeBytes(_publishBuilder.output);
			_target.addEventListener(Event.SELECT, this.selectProjectForSaveHandler);
			_target.browseForSave("Publish texture");
		}
		//} endregion EVENTS HANDLERS ==================================================

		//==============================================================================
		//{region							GETTERS/SETTERS

		public function get target():File {
			return _target;
		}

		public function get output():ByteArray {
			return _output;
		}

//} endregion GETTERS/SETTERS ==================================================
	}
}

import flash.utils.ByteArray;

class SaveHelper{
	public var bytes:ByteArray;
	public var ext:String;

	public function SaveHelper(bytes:ByteArray, ext:String)
	{
		this.bytes = bytes;
		this.ext = ext;
	}
}

Remove old code

Remove old code


/*
 * Copyright (c) 2014 castLabs GmbH
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package com.castlabs.dash.descriptors.index {
import com.castlabs.dash.DashContext;
import com.castlabs.dash.descriptors.segments.Segment;

public class SegmentTimeline extends SegmentTemplate implements SegmentIndex {
    private var _segments:Vector.<Object> = new Vector.<Object>();

    public function SegmentTimeline(context:DashContext, representation:XML) {
        super(context, representation);
        update(representation);
    }

    public override function getSegment(timestamp:Number, representationId:String, bandwidth:Number, baseUrl:String,
                                        duration:Number, internalRepresentationId:Number):Segment {
        if (_segments.length == 0) {
            return null;
        }

        if (_live && isLast(timestamp)) {
            return _context.buildWaitSegment(internalRepresentationId);
        }

        var segment:Object = null;

        //TODO simplify this condition
        if (timestamp == 0) {
            if (_live) {
                var last:Object = _segments[_segments.length - 1];
                timestamp = seconds(last.time + last.duration) - _minBufferTime;
                segment = findSegment(timestamp);
            } else {
                segment = _segments[0];
            }
        } else {
            segment = findSegment(timestamp);
        }

        if (segment == null) {
            return null;
        }

        var url:String = String(_segmentFilename);

        url = url.replace("$Time$", segment.time);
        url = url.replace("$RepresentationID$", representationId);

        var startTimestamp:Number = seconds(segment.time);
        var endTimestamp:Number = startTimestamp + seconds(segment.duration);

        return _context.buildMediaDataSegment(internalRepresentationId, baseUrl + url, "0-", startTimestamp,
                endTimestamp);
    }

    private function findSegment(timestamp:Number):Object {
        for (var i:uint = 0; i < _segments.length; i++) {
            var end:Number = seconds(_segments[i].time) + seconds(_segments[i].duration);
            if (timestamp < end) {
                return _segments[i];
            }
        }

        return null;
    }

    public override function update(representation:XML):void {
        super.update(representation);

        if (_live) {
            removeOutdatedSegments();
        }

        appendNewSegments(representation);
    }

    private function appendNewSegments(xml:XML):void {
        var items:XMLList = traverseAndBuildTimeline(xml);

        var time:Number = 0;
        for (var i:uint = 0; i < items.length(); i++) {

            // read time if present
            if (items[i].hasOwnProperty("@t")) {
                time = Number(items[i].@t.toString());
            }

            // read duration
            var duration:Number = Number(items[i].@d.toString());

            // read repeats if present
            var repeats:Number = 0;
            if (items[i].hasOwnProperty("@r")) {
                repeats = Number(items[i].@r.toString());
            }

            // add duplicates if repeats > 0
            for (var j:uint = 0; j <= repeats; j++) {
                if (!isTimeExists(time)) { // unique
                    _segments.push({ time: time, duration: duration});
                }

                time += duration;
            }
        }
    }

    private function isTimeExists(time:Number):Object {
        for (var i:uint = 0; i < _segments.length; i++) {
            if (time == _segments[i].time) {
                return true;
            }
        }

        return false;
    }

    private function removeOutdatedSegments():void {
        while (seconds(calculateBufferDepth()) > _timeShiftBuffer) {
            _segments.shift();
        }
    }

    private function calculateBufferDepth():Number {
        var sum:uint = 0;

        for each (var segment:Object in _segments) {
            sum += segment.duration;
        }

        return sum;
    }

    private function seconds(value:Number):Number {
        return value / _timescale;
    }

    private function isLast(timestmap:Number):Boolean {
        if (_segments.length == 0) {
            return false;
        }

        var last:uint = _segments.length - 1;
        // #31 workaround for rounding issue; TODO solve this issue more elegant
        return (seconds(_segments[last].time) - timestmap) < 0.1;
    }

    private function traverseAndBuildTimeline(node:XML):XMLList {
        if (node == null) {
            throw _context.console.logAndBuildError("Couldn't find any S tag");
        }

        if (node.SegmentTemplate.length() == 1
                && node.SegmentTemplate.SegmentTimeline.length() == 1
                && node.SegmentTemplate.SegmentTimeline.S.length() > 0) {
            return node.SegmentTemplate.SegmentTimeline.S;
        }

        // go up one level in hierarchy, e.g. adaptionSet and period
        return traverseAndBuildTimeline(node.parent());
    }

    protected override function traverseAndBuildDuration(node:XML):Number {
        return NaN;
    }

    protected override function traverseAndBuildStartNumber(node:XML):Number {
        return NaN;
    }

    override public function toString():String {
        var a:String = "isLive='" + _live;
        var b:String = "";
        var c:String = "', segmentsCount='" + _segments.length + "'";

        if (_live) {
            b = ", minBufferTime[s]='" + _minBufferTime + ", timeShiftBuffer[s]='" + _timeShiftBuffer;
        }

        return a + b + c;
    }
}
}

/*
 * Copyright (c) 2014 castLabs GmbH
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

package com.castlabs.dash.descriptors.index {
import com.castlabs.dash.DashContext;
import com.castlabs.dash.descriptors.segments.Segment;

public class SegmentTimeline extends SegmentTemplate implements SegmentIndex {
    private var _segments:Vector.<Object> = new Vector.<Object>();

    public function SegmentTimeline(context:DashContext, representation:XML) {
        super(context, representation);
        update(representation);
    }

    public override function getSegment(timestamp:Number, representationId:String, bandwidth:Number, baseUrl:String,
                                        duration:Number, internalRepresentationId:Number):Segment {
        if (_segments.length == 0) {
            return null;
        }

        if (_live && isLast(timestamp)) {
            return _context.buildWaitSegment(internalRepresentationId);
        }

        var segment:Object = null;

        //TODO simplify this condition
        if (timestamp == 0) {
            if (_live) {
                var last:Object = _segments[_segments.length - 1];
                timestamp = seconds(last.time + last.duration) - _minBufferTime;
                segment = findSegment(timestamp);
            } else {
                segment = _segments[0];
            }
        } else {
            segment = findSegment(timestamp);
        }

        if (segment == null) {
            return null;
        }

        var url:String = String(_segmentFilename);

        url = url.replace("$Time$", segment.time);
        url = url.replace("$Number$", segment.num);
        url = url.replace("$RepresentationID$", representationId);

        var startTimestamp:Number = seconds(segment.time);
        var endTimestamp:Number = startTimestamp + seconds(segment.duration);

        return _context.buildMediaDataSegment(internalRepresentationId, baseUrl + url, "0-", startTimestamp,
                endTimestamp);
    }

    private function findSegment(timestamp:Number):Object {
        for (var i:uint = 0; i < _segments.length; i++) {
            var end:Number = seconds(_segments[i].time) + seconds(_segments[i].duration);
            if (timestamp < end) {
                return _segments[i];
            }
        }

        return null;
    }

    public override function update(representation:XML):void {
        super.update(representation);

        if (_live) {
            removeOutdatedSegments();
        }

        appendNewSegments(representation);
    }

    private function appendNewSegments(xml:XML):void {
        var items:XMLList = traverseAndBuildTimeline(xml);

        var time:Number = 0;
        var num:Number = _startNumber;
        for (var i:uint = 0; i < items.length(); i++) {

            // read time if present
            if (items[i].hasOwnProperty("@t")) {
                time = Number(items[i].@t.toString());
            }

            // read duration
            var duration:Number = Number(items[i].@d.toString());

            // read repeats if present
            var repeats:Number = 0;
            if (items[i].hasOwnProperty("@r")) {
                repeats = Number(items[i].@r.toString());
            }

            // add duplicates if repeats > 0
            for (var j:uint = 0; j <= repeats; j++) {
                if (!isTimeExists(time)) { // unique
                    _segments.push({ time: time, duration: duration, num: num});
                }

                time += duration;
                num++;
            }
        }
    }

    private function isTimeExists(time:Number):Object {
        for (var i:uint = 0; i < _segments.length; i++) {
            if (time == _segments[i].time) {
                return true;
            }
        }

        return false;
    }

    private function removeOutdatedSegments():void {
        while (seconds(calculateBufferDepth()) > _timeShiftBuffer) {
            _segments.shift();
        }
    }

    private function calculateBufferDepth():Number {
        var sum:uint = 0;

        for each (var segment:Object in _segments) {
            sum += segment.duration;
        }

        return sum;
    }

    private function seconds(value:Number):Number {
        return value / _timescale;
    }

    private function isLast(timestmap:Number):Boolean {
        if (_segments.length == 0) {
            return false;
        }

        var last:uint = _segments.length - 1;
        // #31 workaround for rounding issue; TODO solve this issue more elegant
        return (seconds(_segments[last].time) - timestmap) < 0.1;
    }

    private function traverseAndBuildTimeline(node:XML):XMLList {
        if (node == null) {
            throw _context.console.logAndBuildError("Couldn't find any S tag");
        }

        if (node.SegmentTemplate.length() == 1
                && node.SegmentTemplate.SegmentTimeline.length() == 1
                && node.SegmentTemplate.SegmentTimeline.S.length() > 0) {
            return node.SegmentTemplate.SegmentTimeline.S;
        }

        // go up one level in hierarchy, e.g. adaptionSet and period
        return traverseAndBuildTimeline(node.parent());
    }

    protected override function traverseAndBuildDuration(node:XML):Number {
        return NaN;
    }

    override public function toString():String {
        var a:String = "isLive='" + _live;
        var b:String = "";
        var c:String = "', segmentsCount='" + _segments.length + "'";

        if (_live) {
            b = ", minBufferTime[s]='" + _minBufferTime + ", timeShiftBuffer[s]='" + _timeShiftBuffer;
        }

        return a + b + c;
    }
}
}

Allow to use $Number$ with SegmentTimeline


//
// $Id$

package com.threerings.presents.net {

import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.TypedArray;

import com.threerings.util.StringUtil;

public class AuthRequest extends UpstreamMessage
{
    public function AuthRequest (creds :Credentials, version :String, bootGroups :Array)
    {
        _creds = creds;
        _version = version;
        _bootGroups = new TypedArray("[Ljava.lang.String;");
        _bootGroups.addAll(bootGroups);

        // magic up a timezone in the format "GMT+XX:XX"
        // Of course, the sign returned from getTimezoneOffset() is wrong
        var minsOffset :int = -1 * new Date().getTimezoneOffset();
        var hoursFromUTC :int = Math.abs(minsOffset) / 60;
        var minsFromUTC :int = Math.abs(minsOffset) % 60;
        _zone = "GMT" + ((minsOffset < 0) ? "-" : "+") +
            StringUtil.prepad(String(hoursFromUTC), 2, "0") + ":" +
            StringUtil.prepad(String(minsFromUTC), 2, "0");
    }

    // documentation inherited
    override public function writeObject (out :ObjectOutputStream) :void
    {
        super.writeObject(out);

        out.writeObject(_creds);
        out.writeField(_version);
        out.writeField(_zone);
        out.writeObject(_bootGroups);
    }

    protected var _creds :Credentials;
    protected var _version :String;
    protected var _zone :String;
    protected var _bootGroups :TypedArray;
}
}

//
// $Id$

package com.threerings.presents.net {

import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.io.TypedArray;

import com.threerings.util.StringUtil;

public class AuthRequest extends UpstreamMessage
{
    public function AuthRequest (creds :Credentials, version :String, bootGroups :Array)
    {
        _creds = creds;
        _version = version;
        _bootGroups = TypedArray.create(String);
        _bootGroups.addAll(bootGroups);

        // magic up a timezone in the format "GMT+XX:XX"
        // Of course, the sign returned from getTimezoneOffset() is wrong
        var minsOffset :int = -1 * new Date().getTimezoneOffset();
        var hoursFromUTC :int = Math.abs(minsOffset) / 60;
        var minsFromUTC :int = Math.abs(minsOffset) % 60;
        _zone = "GMT" + ((minsOffset < 0) ? "-" : "+") +
            StringUtil.prepad(String(hoursFromUTC), 2, "0") + ":" +
            StringUtil.prepad(String(minsFromUTC), 2, "0");
    }

    // documentation inherited
    override public function writeObject (out :ObjectOutputStream) :void
    {
        super.writeObject(out);

        out.writeObject(_creds);
        out.writeField(_version);
        out.writeField(_zone);
        out.writeObject(_bootGroups);
    }

    protected var _creds :Credentials;
    protected var _version :String;
    protected var _zone :String;
    protected var _bootGroups :TypedArray;
}
}

Use cleaner TypedArray factory method.

Use cleaner TypedArray factory method.

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


/*
 * Copyright 2011 Ryan Berdeen. All rights reserved.
 * Distributed under the terms of the MIT License.
 * See accompanying file LICENSE.txt
 */

package com.ryanberdeen.echonest.api.v4 {
  import flash.events.Event;
  import flash.events.EventDispatcher;
  import flash.events.HTTPStatusEvent;
  import flash.events.IOErrorEvent;
  import flash.events.ProgressEvent;
  import flash.events.SecurityErrorEvent;
  import flash.net.URLLoader;
  import flash.net.URLRequest;
  import flash.net.URLRequestHeader;
  import flash.net.URLVariables;

  import com.adobe.serialization.json.JSON;

  /**
  * Base class for Echo Nest API classes.
  */
  public class ApiSupport {
    public static const API_VERSION:int = 3;
    /**
    * @private
    */
    protected var _baseUrl:String = 'http://developer.echonest.com/api/v4/';

    public var apiKey:String;

    /**
    * Creates a request for an Echo Nest API method call with a set of
    * parameters.
    *
    * @param method The method to call.
    * @param parameters The parameters to include in the request.
    *
    * @return The request to use to call the method.
    */
    public function createRequest(method:String, parameters:Object):URLRequest {
      var variables:URLVariables = new URLVariables;
      variables.api_key = apiKey;
      for (var name:String in parameters) {
        variables[name] = parameters[name];
      }

      var request:URLRequest = new URLRequest();
      request.url = _baseUrl + method;
      request.data = variables;

      return request;
    }

    /**
    * Creates a loader with event listeners.
    *
    *
The following options are supported:

    *
    *

Option	Event

    *

    *     onComplete
    *     Event.COMPLETE
    *

    *

    *     onResponse
    *     Called with the processed response.
    *

    *

    *     onEchoNestError
    *     Called with an EchoNestError if the status code is nonzero
    *

    *

    *     onProgress
    *     ProgressEvent.PROGRESS
    *

    *

    *     onSecurityError
    *     SecurityErrorEvent.SECURITY_ERROR
    *

    *

    *     onIoError
    *     IOErrorEvent.IO_ERROR
    *

    *

    *     onError
    *     IOErrorEvent.IO_ERROR
 SecurityErrorEvent.SECURITY_ERROR
    *

    *

    *     onHttpStatus
    *     HTTPStatusEvent.HTTP_STATUS
    *

    *

    *
    * @param options The event listener options for the loader.
    * @param responseProcessor The function that processes the XML response.
    * @param responseProcessorArgs The arguments to pass to the response
    *        processor function.
    */
    public function createLoader(options:Object, responseProcessor:Function, ...responseProcessorArgs):URLLoader {
      var loader:URLLoader = new URLLoader();

      if (options.onComplete) {
        loader.addEventListener(Event.COMPLETE, options.onComplete);
      }

      if (options.onResponse) {
        loader.addEventListener(Event.COMPLETE, function(e:Event):void {
          try {
            var parsedResponse:Object = parseRawResponse(loader.data);
            responseProcessorArgs.push(parsedResponse);
            var response:Object = responseProcessor.apply(responseProcessor, responseProcessorArgs);
            if (options.onResponseArgument) {
              options.onResponse(options.onResponseArgument, response);
            }
            else {
              options.onResponse(response);
            }
          }
          catch (e:EchoNestError) {
            if (options.onEchoNestError) {
              options.onEchoNestError(e);
            }
          }
        });
      }

      addEventListeners(options, loader);

      return loader;
    }

    protected function parseRawResponse(data:String):Object {
      var responseObject:* = JSON.decode(data).response;
      checkStatus(responseObject);
      return responseObject;
    }

    /**
    * Adds the standard Echo Nest Flash API event listeners to the event
    * dispatcher.
    *
    *
The event dispatcher should be either a URLLoader or a
    * FileReference.

    *
    *
This method does not add the onComplete or
    * onResponse event listeners. They are added by
    * createLoader().

    *
    * @private
    *
    * @param options The event listener options. See
    *        createLoader() for the list of available options.
    * @param dispatcher The event dispatcher to add the event listeners to.
    */
    protected function addEventListeners(options:Object, dispatcher:EventDispatcher):void {
      if (options.onProgress) {
        dispatcher.addEventListener(ProgressEvent.PROGRESS, options.onProgress);
      }

      if (options.onSecurityError) {
        dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, options.onSecurityError);
      }

      if (options.onIoError) {
        dispatcher.addEventListener(IOErrorEvent.IO_ERROR, options.onIoError);
      }

      if (options.onError) {
        dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, options.onError);
        dispatcher.addEventListener(IOErrorEvent.IO_ERROR, options.onError);
      }

      if (options.onHttpStatus) {
        dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, options.onHttpStatus);
      }
    }

    /**
    * Throws an EchoNestError if the status indicates an error.
    *
    * @param The XML result of an Echo Nest API call.
    *
    * @throws EchoNestError When the status code is nonzero.
    */
    public function checkStatus(response:Object):void {
      if (response.status.code != 0) {
        throw new EchoNestError(response.status.code, response.status.message);
      }
    }
  }
}

/*
 * Copyright 2011 Ryan Berdeen. All rights reserved.
 * Distributed under the terms of the MIT License.
 * See accompanying file LICENSE.txt
 */

package com.ryanberdeen.echonest.api.v4 {
  import flash.events.Event;
  import flash.events.EventDispatcher;
  import flash.events.HTTPStatusEvent;
  import flash.events.IOErrorEvent;
  import flash.events.ProgressEvent;
  import flash.events.SecurityErrorEvent;
  import flash.net.URLLoader;
  import flash.net.URLRequest;
  import flash.net.URLRequestHeader;
  import flash.net.URLVariables;

  import com.adobe.serialization.json.JSON;

  /**
  * Base class for Echo Nest API classes.
  */
  public class ApiSupport {
    /**
    * @private
    */
    protected var _baseUrl:String = 'http://developer.echonest.com/api/v4/';

    public var apiKey:String;

    /**
    * Creates a request for an Echo Nest API method call with a set of
    * parameters.
    *
    * @param method The method to call.
    * @param parameters The parameters to include in the request.
    *
    * @return The request to use to call the method.
    */
    public function createRequest(method:String, parameters:Object):URLRequest {
      var variables:URLVariables = new URLVariables;
      variables.api_key = apiKey;
      for (var name:String in parameters) {
        variables[name] = parameters[name];
      }

      var request:URLRequest = new URLRequest();
      request.url = _baseUrl + method;
      request.data = variables;

      return request;
    }

    /**
    * Creates a loader with event listeners.
    *
    *
The following options are supported:

    *
    *

Option	Event

    *

    *     onComplete
    *     Event.COMPLETE
    *

    *

    *     onResponse
    *     Called with the processed response.
    *

    *

    *     onEchoNestError
    *     Called with an EchoNestError if the status code is nonzero
    *

    *

    *     onProgress
    *     ProgressEvent.PROGRESS
    *

    *

    *     onSecurityError
    *     SecurityErrorEvent.SECURITY_ERROR
    *

    *

    *     onIoError
    *     IOErrorEvent.IO_ERROR
    *

    *

    *     onError
    *     IOErrorEvent.IO_ERROR
 SecurityErrorEvent.SECURITY_ERROR
    *

    *

    *     onHttpStatus
    *     HTTPStatusEvent.HTTP_STATUS
    *

    *

    *
    * @param options The event listener options for the loader.
    * @param responseProcessor The function that processes the XML response.
    * @param responseProcessorArgs The arguments to pass to the response
    *        processor function.
    */
    public function createLoader(options:Object, responseProcessor:Function, ...responseProcessorArgs):URLLoader {
      var loader:URLLoader = new URLLoader();

      if (options.onComplete) {
        loader.addEventListener(Event.COMPLETE, options.onComplete);
      }

      if (options.onResponse) {
        loader.addEventListener(Event.COMPLETE, function(e:Event):void {
          try {
            var parsedResponse:Object = parseRawResponse(loader.data);
            responseProcessorArgs.push(parsedResponse);
            var response:Object = responseProcessor.apply(responseProcessor, responseProcessorArgs);
            if (options.onResponseArgument) {
              options.onResponse(options.onResponseArgument, response);
            }
            else {
              options.onResponse(response);
            }
          }
          catch (e:EchoNestError) {
            if (options.onEchoNestError) {
              options.onEchoNestError(e);
            }
          }
        });
      }

      addEventListeners(options, loader);

      return loader;
    }

    protected function parseRawResponse(data:String):Object {
      var responseObject:* = JSON.decode(data).response;
      checkStatus(responseObject);
      return responseObject;
    }

    /**
    * Adds the standard Echo Nest Flash API event listeners to the event
    * dispatcher.
    *
    *
The event dispatcher should be either a URLLoader or a
    * FileReference.

    *
    *
This method does not add the onComplete or
    * onResponse event listeners. They are added by
    * createLoader().

    *
    * @private
    *
    * @param options The event listener options. See
    *        createLoader() for the list of available options.
    * @param dispatcher The event dispatcher to add the event listeners to.
    */
    protected function addEventListeners(options:Object, dispatcher:EventDispatcher):void {
      if (options.onProgress) {
        dispatcher.addEventListener(ProgressEvent.PROGRESS, options.onProgress);
      }

      if (options.onSecurityError) {
        dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, options.onSecurityError);
      }

      if (options.onIoError) {
        dispatcher.addEventListener(IOErrorEvent.IO_ERROR, options.onIoError);
      }

      if (options.onError) {
        dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, options.onError);
        dispatcher.addEventListener(IOErrorEvent.IO_ERROR, options.onError);
      }

      if (options.onHttpStatus) {
        dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, options.onHttpStatus);
      }
    }

    /**
    * Throws an EchoNestError if the status indicates an error.
    *
    * @param The XML result of an Echo Nest API call.
    *
    * @throws EchoNestError When the status code is nonzero.
    */
    public function checkStatus(response:Object):void {
      if (response.status.code != 0) {
        throw new EchoNestError(response.status.code, response.status.message);
      }
    }
  }
}

remove outdated version constant

remove outdated version constant


package com.google.analytics.components
{
    import com.google.analytics.API;
    import com.google.analytics.AnalyticsTracker;
    import com.google.analytics.core.Buffer;
    import com.google.analytics.core.EventTracker;
    import com.google.analytics.core.GIFRequest;
    import com.google.analytics.core.ServerOperationMode;
    import com.google.analytics.core.TrackerMode;
    import com.google.analytics.core.ga_internal;
    import com.google.analytics.debug.DebugConfiguration;
    import com.google.analytics.debug.Layout;
    import com.google.analytics.external.AdSenseGlobals;
    import com.google.analytics.external.HTMLDOM;
    import com.google.analytics.external.JavascriptProxy;
    import com.google.analytics.utils.Environment;
    import com.google.analytics.utils.Version;
    import com.google.analytics.v4.Bridge;
    import com.google.analytics.v4.Configuration;
    import com.google.analytics.v4.GoogleAnalyticsAPI;
    import com.google.analytics.v4.Tracker;

    import flash.display.DisplayObject;
    import flash.display.Graphics;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.utils.getQualifiedClassName;
    EventTracker;
    ServerOperationMode;

    /**
    * The Flash visual component.
    */
    [IconFile("analytics.png")]
    public class FlashTracker extends Sprite implements AnalyticsTracker
    {

    	private var _display:DisplayObject;
        private var _tracker:GoogleAnalyticsAPI;

        //factory
        private var _config:Configuration;
        private var _debug:DebugConfiguration;
        private var _env:Environment;
        private var _buffer:Buffer;
        private var _gifRequest:GIFRequest;
        private var _jsproxy:JavascriptProxy;
        private var _dom:HTMLDOM;
        private var _adSense:AdSenseGlobals;

        //component properties
        private var _account:String      = "";
        private var _mode:String         = "AS3";
        private var _visualDebug:Boolean = false;

        //component

        private var _componentInspectorSetting:Boolean;

        private var isLivePreview:Boolean;
        private var livePreviewWidth:Number;
        private var livePreviewHeight:Number;

        private var preview:MovieClip;

        private var _width:Number = 0;
        private var _height:Number = 0;

        public var boundingBox_mc:DisplayObject;

        public static var version:Version = API.version;

        [IconFile("analytics.png")]
        public function FlashTracker()
        {
            super();

            isLivePreview = (parent != null && getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent");
            _componentInspectorSetting = false;

            boundingBox_mc.visible = false;
            removeChild( boundingBox_mc );
            boundingBox_mc = null;

            if( isLivePreview )
            {
                _createLivePreview();
            }

            /* note:
               we have to use the ENTER_FRAME event
               to wait 1 frame so we can add to the display list
               and get the values declared in the component inspector.
            */
            addEventListener( Event.ENTER_FRAME, _factory );
        }

        private function _createLivePreview():void
        {
            preview = new MovieClip();

            var g:Graphics = preview.graphics;
            g.beginFill(0x000000);
            g.moveTo(0, 0);
            g.lineTo(0, 100);
            g.lineTo(100, 100);
            g.lineTo(100, 0);
            g.lineTo(0, 0);
            g.endFill();

            //decalred in the FLA
//            preview.icon_mc = new Icon();
//            preview.icon_mc.name = "icon_mc";
//            preview.addChild(preview.icon_mc);

            addChild( preview );
        }

        public function set componentInspectorSetting( value:Boolean ):void
        {
            _componentInspectorSetting = value;
        }

        public function setSize( w:Number, h:Number ):void
        {

        }

        /**
        * @private
        * Factory to build the different trackers
        */
        private function _factory( event:Event ):void
        {
            if( isLivePreview )
            {
                return;
            }

            removeEventListener( Event.ENTER_FRAME, _factory );

            _display = this;

            if( !debug )
            {
                this.debug = new DebugConfiguration();
            }

            if( !config )
            {
                this.config = new Configuration( debug );
            }

            if( visualDebug )
            {
                debug.layout = new Layout( debug, _display );
                debug.active = visualDebug;
            }

            _jsproxy = new JavascriptProxy( debug );

            switch( mode )
            {
                case TrackerMode.BRIDGE :
                {
                    _tracker = _bridgeFactory();
                    break;
                }

                case TrackerMode.AS3 :
                default:
                {
                    _tracker = _trackerFactory();
                }
            }

        }

        /**
        * @private
        * Factory method for returning a Tracker object.
        *
        * @return {GoogleAnalyticsAPI}
        */
        private function _trackerFactory():GoogleAnalyticsAPI
        {
            debug.info( "GATracker (AS3) v" + version +"\naccount: " + account );

            _adSense   = new AdSenseGlobals( debug );

            _dom        = new HTMLDOM( debug );
            _dom.cacheProperties();

            _env        = new Environment( "", "", "", debug, _dom );

            _buffer     = new Buffer( config, debug, false );

            _gifRequest = new GIFRequest( config, debug, _buffer, _env );

            use namespace ga_internal;
            _env.url = _display.stage.loaderInfo.url;

            return new Tracker( account, config, debug, _env, _buffer, _gifRequest, _adSense );
        }

        /**
        * @private
        * Factory method for returning a Bridge object.
        *
        * @return {GoogleAnalyticsAPI}
        */
        private function _bridgeFactory():GoogleAnalyticsAPI
        {
            debug.info( "GATracker (Bridge) v" + version +"\naccount: " + account );

            return new Bridge( account, _debug, _jsproxy );
        }

        /**
         * Indicates the account value of the tracking.
         */
        [Inspectable]
        public function get account():String
        {
            return _account ;
        }

        /**
         * @private
         */
        public function set account(value:String):void
        {
            _account = value;
        }

        public function get config():Configuration
        {
            return _config;
        }

        public function set config(value:Configuration):void
        {
            _config = value;
        }

        public function get debug():DebugConfiguration
        {
            return _debug;
        }

        public function set debug(value:DebugConfiguration):void
        {
            _debug = value;
        }

        [Inspectable(defaultValue="AS3", enumeration="AS3,Bridge", type="String")]
        public function get mode():String
        {
            return _mode;
        }

        /**
         * @private
         */
        public function set mode( value:String ):void
        {
            _mode = value;
        }

        /**
         * Indicates if the tracker use a visual debug.
         */
        [Inspectable(defaultValue="false", type="Boolean")]
        public function get visualDebug():Boolean
        {
            return _visualDebug;
        }

        /**
         * @private
         */
        public function set visualDebug( value:Boolean ):void
        {
            _visualDebug = value;
        }

        include "../common.txt"

    }
}

package com.google.analytics.components
{
    import com.google.analytics.API;
    import com.google.analytics.AnalyticsTracker;
    import com.google.analytics.core.Buffer;
    import com.google.analytics.core.EventTracker;
    import com.google.analytics.core.GIFRequest;
    import com.google.analytics.core.ServerOperationMode;
    import com.google.analytics.core.TrackerMode;
    import com.google.analytics.core.ga_internal;
    import com.google.analytics.debug.DebugConfiguration;
    import com.google.analytics.debug.Layout;
    import com.google.analytics.external.AdSenseGlobals;
    import com.google.analytics.external.HTMLDOM;
    import com.google.analytics.external.JavascriptProxy;
    import com.google.analytics.utils.Environment;
    import com.google.analytics.utils.Version;
    import com.google.analytics.v4.Bridge;
    import com.google.analytics.v4.Configuration;
    import com.google.analytics.v4.GoogleAnalyticsAPI;
    import com.google.analytics.v4.Tracker;

    import flash.display.DisplayObject;
    import flash.display.Graphics;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.utils.getQualifiedClassName;
    import flash.utils.getDefinitionByName;

    /* force import for type in the includes */
    EventTracker;
    ServerOperationMode;

    /**
    * The Flash visual component.
    */
    [IconFile("analytics.png")]
    public class FlashTracker extends Sprite implements AnalyticsTracker
    {

        private var _display:DisplayObject;
        private var _tracker:GoogleAnalyticsAPI;

        //factory
        private var _config:Configuration;
        private var _debug:DebugConfiguration;
        private var _env:Environment;
        private var _buffer:Buffer;
        private var _gifRequest:GIFRequest;
        private var _jsproxy:JavascriptProxy;
        private var _dom:HTMLDOM;
        private var _adSense:AdSenseGlobals;

        //component properties
        private var _account:String      = "";
        private var _mode:String         = "AS3";
        private var _visualDebug:Boolean = false;

        //component
        protected var preview:MovieClip;
        protected var isLivePreview:Boolean;
        protected var livePreviewWidth:Number;
        protected var livePreviewHeight:Number;

        protected var _width:Number = 100;
        protected var _height:Number = 122;
        protected var _componentInspectorSetting:Boolean;

        public var boundingBox_mc:DisplayObject;

        public static var version:Version = API.version;

        [IconFile("analytics.png")]
        public function FlashTracker()
        {
            super();

            isLivePreview = _checkLivePreview();
            _componentInspectorSetting = false;

            boundingBox_mc.visible = false;
            removeChild( boundingBox_mc );
            boundingBox_mc = null;

            if( isLivePreview )
            {
                _createLivePreview();
            }

            /* note:
               we have to use the ENTER_FRAME event
               to wait 1 frame so we can add to the display list
               and get the values declared in the component inspector.
            */
            addEventListener( Event.ENTER_FRAME, _factory );
        }

        private function _checkLivePreview():Boolean
        {
            if( parent != null && (getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent"))
            {
                return true;
            }

            return false;
        }

        private function _createLivePreview():void
        {
            preview = new MovieClip();

            var g:Graphics = preview.graphics;
                g.beginFill(0xffffff);
                g.moveTo(0, 0);
                g.lineTo(0, _width);
                g.lineTo(_width, _height);
                g.lineTo(_height, 0);
                g.lineTo(0, 0);
                g.endFill();

            /* note:
               because the Icon class is declared in the FLA
               and the FLA generate it automatically
               we need to use reflection to instanciate it
               so compc/asdoc does not generate errors
            */
            var iconClass:Class = getDefinitionByName( "com.google.analytics.components::Icon" ) as Class;
            preview.icon_mc = new iconClass();
            preview.icon_mc.name = "icon_mc";
            preview.addChild( preview.icon_mc );

            addChild( preview );
        }

        public function set componentInspectorSetting( value:Boolean ):void
        {
            _componentInspectorSetting = value;
        }

        public function setSize( w:Number, h:Number ):void
        {
            /* note:
               we don't resize the live preview
               we want to keep or default component size
               defined in the FLA
            */
        }

        /**
        * @private
        * Factory to build the different trackers
        */
        private function _factory( event:Event ):void
        {
            removeEventListener( Event.ENTER_FRAME, _factory );

            if( isLivePreview )
            {
                /* note:
                   we don't want to init the factory
                   when we are in live preview
                */
                return;
            }

            _display = this;

            if( !debug )
            {
                this.debug = new DebugConfiguration();
            }

            if( !config )
            {
                this.config = new Configuration( debug );
            }

            if( visualDebug )
            {
                debug.layout = new Layout( debug, _display );
                debug.active = visualDebug;
            }

            _jsproxy = new JavascriptProxy( debug );

            switch( mode )
            {
                case TrackerMode.BRIDGE :
                {
                    _tracker = _bridgeFactory();
                    break;
                }

                case TrackerMode.AS3 :
                default:
                {
                    _tracker = _trackerFactory();
                }
            }

        }

        /**
        * @private
        * Factory method for returning a Tracker object.
        *
        * @return {GoogleAnalyticsAPI}
        */
        private function _trackerFactory():GoogleAnalyticsAPI
        {
            debug.info( "GATracker (AS3) v" + version +"\naccount: " + account );

            _adSense   = new AdSenseGlobals( debug );

            _dom        = new HTMLDOM( debug );
            _dom.cacheProperties();

            _env        = new Environment( "", "", "", debug, _dom );

            _buffer     = new Buffer( config, debug, false );

            _gifRequest = new GIFRequest( config, debug, _buffer, _env );

            use namespace ga_internal;
            _env.url = _display.stage.loaderInfo.url;

            return new Tracker( account, config, debug, _env, _buffer, _gifRequest, _adSense );
        }

        /**
        * @private
        * Factory method for returning a Bridge object.
        *
        * @return {GoogleAnalyticsAPI}
        */
        private function _bridgeFactory():GoogleAnalyticsAPI
        {
            debug.info( "GATracker (Bridge) v" + version +"\naccount: " + account );

            return new Bridge( account, _debug, _jsproxy );
        }

        /**
         * The Urchin Account.
         * You have to define this parameter to initialize the tracking.
         */
        [Inspectable]
        public function get account():String
        {
            return _account ;
        }

        /**
         * @private
         */
        public function set account(value:String):void
        {
            _account = value;
        }

        /**
        * The Tracker configuration.
        */
        public function get config():Configuration
        {
            return _config;
        }

        /**
         * @private
         */
        public function set config(value:Configuration):void
        {
            _config = value;
        }

        /**
        * The Tracker debug configuration.
        */
        public function get debug():DebugConfiguration
        {
            return _debug;
        }

        /**
         * @private
         */
        public function set debug(value:DebugConfiguration):void
        {
            _debug = value;
        }

        /**
        * The Traker mode.
        * You can select two modes:
        * - AS3: use AS3 only, no dependency on HTML/JS
        * - Bridge: use AS3 bridged to HTML/JS which define ga.js
        */
        [Inspectable(defaultValue="AS3", enumeration="AS3,Bridge", type="String")]
        public function get mode():String
        {
            return _mode;
        }

        /**
         * @private
         */
        public function set mode( value:String ):void
        {
            _mode = value;
        }

        /**
         * Indicates if the tracker use a visual debug.
         * If set to true, at compile time you will
         * see a visual debug window with different
         * informations about the tracking requests and parameters.
         */
        [Inspectable(defaultValue="false", type="Boolean")]
        public function get visualDebug():Boolean
        {
            return _visualDebug;
        }

        /**
         * @private
         */
        public function set visualDebug( value:Boolean ):void
        {
            _visualDebug = value;
        }

        include "../common.txt"

    }
}

update to the flash tracker

update to the flash tracker


package {
	import com.kaltura.kdpfl.model.type.NotificationType;
	import com.kaltura.kdpfl.plugin.IPlugin;
	import com.kaltura.kdpfl.plugin.IPluginFactory;
	import com.kaltura.kdpfl.plugin.component.AssetsRefferencer;
	import com.kaltura.kdpfl.plugin.component.ModerationMediator;
	import com.kaltura.kdpfl.plugin.view.Message;
	import com.kaltura.kdpfl.plugin.view.ModerationScreen;
	import com.kaltura.kdpfl.view.containers.KHBox;
	import com.kaltura.types.KalturaModerationFlagType;
	import com.yahoo.astra.fl.containers.HBoxPane;
	import com.yahoo.astra.fl.containers.layoutClasses.AdvancedLayoutPane;
	import com.yahoo.astra.fl.containers.layoutClasses.BaseLayoutPane;

	import fl.containers.BaseScrollPane;
	import fl.core.UIComponent;

	import flash.events.Event;
	import flash.system.Security;

	import org.puremvc.as3.interfaces.IFacade;

	public class ModerationPlugin extends KHBox implements IPluginFactory, IPlugin {

		/**
		 * defines the value for the type property of the submit event
		 * dispatched by the screen
		 */
		public static const SUBMIT:String = "submit";

		/**
		 * defines the value for the type property of the cancel event
		 * dispatched by the screen
		 */
		public static const CANCEL:String = "cancel";

		/**
		 * defines the value of the notification which triggers this plugin
		 */
		public static const FLAG_FOR_REVIEW:String = "flagForReview";

		/**
		 * flagging form header
		 */
		public var header:String;

		/**
		 * flagging form text (explanation)
		 */
		public var text:String;

		/**
		 * text to show in combobox for sexual content
		 */
		public var reasonSex:String = "Sexual content";

		/**
		 * text to show in combobox for violent content
		 */
		public var reasonViolence:String = "Violent or Repulsive";

		/**
		 * text to show in combobox for harmful content
		 */
		public var reasonHarmful:String = "Harmful or Dangerous act";

		/**
		 * text to show in combobox for spam content
		 */
		public var reasonSpam:String = "Spam/Commercials";

		/**
		 * message to show when flagging submition succeeded
		 */
		public var successMessage:String = "Thank you for sharing your concerns";

		/**
		 * message to show when flagging submition failed
		 * */
		public var failedMessage:String = "submission failed";

		/**
		 * time (in seconds) to wait before hiding end message
		 */
		public var hideTimeout:int = 3;

		/**
		 * position of close and cancel buttons on flagging form
		 */
		public var buttonsPosition:String = "right";
		/**
		 * If this is set to flase, the "select report reason" combo-box will be hidden
		 */
		public var showCombo:Boolean = true;
		/**
		 * This attribute will set the initial selected value of the combobox:
		 * 0: Sexual content
		 * 1: Violent or Repulsive
		 * 2: Harmful or Dangerous act
		 * 3: Spam/Commercials
		 */
		public var comboSelectedIndex:Number = 0;
		/**
		 * include the assets class in the app
		 * */
		private var _ar:AssetsRefferencer;

		/**
		 * flagging form
		 */
		private var _ui:ModerationScreen;

		/**
		 * success / failure message
		 */
		private var _endMsg:Message;

		/**
		 * plugin mediator
		 */
		private var _mediator:ModerationMediator;

		public function ModerationPlugin() {
			Security.allowDomain("*");
			this.horizontalAlign = "center";
			this.verticalAlign = "middle";
		}

		/**
		 * @inheritDoc
		 * */
		public function create(pluginName:String = null):IPlugin {
			return this;
		}

		/**
		 * @inheritDoc
		 * */
		public function initializePlugin(facade:IFacade):void {
			_mediator = new ModerationMediator(this);
			facade.registerMediator(_mediator);

		}

		/**
		 * set the given style to all visual parts
		 * */
		override public function setSkin(styleName:String, setSkinSize:Boolean = false):void {
			if (_ui) {
				_ui.setSkin(styleName);
			}
			if (_endMsg) {
				_endMsg.setSkin(styleName);
			}
		}

		/**
		 * shows the moderation ui over the player
		 * */
		public function showScreen():void {
			// disable KDP gui, stop entry from playing, exit fullscreen
			_mediator.sendNotification(NotificationType.CLOSE_FULL_SCREEN);
			_mediator.sendNotification(NotificationType.ENABLE_GUI, {guiEnabled : false, enableType : "full"});
			_mediator.sendNotification(NotificationType.DO_PAUSE);

			// show flagging form
			if (_ui == null) {
				_ui = new ModerationScreen();
				_ui.buttonsPosition = buttonsPosition;
				if (header) {
					_ui.headerText = header;
				}
				if (text) {
					_ui.windowText = text;
				}

				_ui.reasonsDataProvider = [{label:reasonSex, type:KalturaModerationFlagType.SEXUAL_CONTENT},
									{label:reasonViolence, type:KalturaModerationFlagType.VIOLENT_REPULSIVE},
									{label:reasonHarmful, type:KalturaModerationFlagType.HARMFUL_DANGEROUS},
									{label:reasonSpam, type:KalturaModerationFlagType.SPAM_COMMERCIALS}]
				//set custom behaviour for reasons combo
				_ui.comboSelectedIndex = comboSelectedIndex;

				_ui.showCombo = showCombo;

				_ui.addEventListener(ModerationPlugin.CANCEL, clearForm);
				_ui.addEventListener(ModerationPlugin.SUBMIT, onSubmitClicked);
			}
			addChild(_ui);
		}

		/**
		 * send data to server
		 */
		private function onSubmitClicked(e:Event):void {
			var o:Object = _ui.data;
			var comments:String = o.comments;
			var type:int = o.reason;
			_mediator.postModeration(comments, type);
		}

		/**
		 * close the form panel
		 */
		private function clearForm(e:Event = null):void {
			_ui.clearData();
			removeChild(_ui);
			end();
		}

		/**
		 * remove the end message
		 * @param e
		 */
		private function onMessageHide(e:Event):void {
			removeChild(_endMsg);
			end();
		}

		/**
		 * does everything that needs to be done before the plugin is closed
		 */
		private function end():void {
			_mediator.sendNotification(NotificationType.ENABLE_GUI, {guiEnabled : true, enableType : "full"});
		}

		/**
		 * notify the user and close panel
		 * */
		public function flagComplete(success:Boolean):void {
			clearForm();
			if (_endMsg == null) {
				_endMsg = new Message();
				_endMsg.addEventListener(Message.HIDE, onMessageHide);
			}
			if (success) {
				_endMsg.windowText = successMessage;
			}
			else {
				_endMsg.windowText = failedMessage;
			}
			addChild(_endMsg);
			_endMsg.close(hideTimeout);
		}
	}
}

package {
	import com.kaltura.kdpfl.model.type.NotificationType;
	import com.kaltura.kdpfl.plugin.IPlugin;
	import com.kaltura.kdpfl.plugin.IPluginFactory;
	import com.kaltura.kdpfl.plugin.component.AssetsRefferencer;
	import com.kaltura.kdpfl.plugin.component.ModerationMediator;
	import com.kaltura.kdpfl.plugin.view.Message;
	import com.kaltura.kdpfl.plugin.view.ModerationScreen;
	import com.kaltura.kdpfl.view.containers.KHBox;
	import com.kaltura.types.KalturaModerationFlagType;
	import com.yahoo.astra.fl.containers.HBoxPane;
	import com.yahoo.astra.fl.containers.layoutClasses.AdvancedLayoutPane;
	import com.yahoo.astra.fl.containers.layoutClasses.BaseLayoutPane;

	import fl.containers.BaseScrollPane;
	import fl.core.UIComponent;

	import flash.events.Event;
	import flash.system.Security;

	import org.puremvc.as3.interfaces.IFacade;

	public class ModerationPlugin extends KHBox implements IPluginFactory, IPlugin {

		/**
		 * defines the value for the type property of the submit event
		 * dispatched by the screen
		 */
		public static const SUBMIT:String = "submit";

		/**
		 * defines the value for the type property of the cancel event
		 * dispatched by the screen
		 */
		public static const CANCEL:String = "cancel";

		/**
		 * defines the value of the notification which triggers this plugin
		 */
		public static const FLAG_FOR_REVIEW:String = "flagForReview";

		/**
		 * defines the value of the notification which turns off the shortcut 508 plugin
		 */
		public static const DISABLE_SHORTCUT_PLUGIN:String = "disableShortcutPlugin";
		/**
		 * defines the value of the notification which turns on the shortcut 508 plugin
		 */
		public static const ENABLE_SHORTCUT_PLUGIN:String = "enableShortcutPlugin";

		/**
		 * flagging form header
		 */
		public var header:String;

		/**
		 * flagging form text (explanation)
		 */
		public var text:String;

		/**
		 * text to show in combobox for sexual content
		 */
		public var reasonSex:String = "Sexual content";

		/**
		 * text to show in combobox for violent content
		 */
		public var reasonViolence:String = "Violent or Repulsive";

		/**
		 * text to show in combobox for harmful content
		 */
		public var reasonHarmful:String = "Harmful or Dangerous act";

		/**
		 * text to show in combobox for spam content
		 */
		public var reasonSpam:String = "Spam/Commercials";

		/**
		 * message to show when flagging submition succeeded
		 */
		public var successMessage:String = "Thank you for sharing your concerns";

		/**
		 * message to show when flagging submition failed
		 * */
		public var failedMessage:String = "submission failed";

		/**
		 * time (in seconds) to wait before hiding end message
		 */
		public var hideTimeout:int = 3;

		/**
		 * position of close and cancel buttons on flagging form
		 */
		public var buttonsPosition:String = "right";
		/**
		 * If this is set to flase, the "select report reason" combo-box will be hidden
		 */
		public var showCombo:Boolean = true;
		/**
		 * This attribute will set the initial selected value of the combobox:
		 * 0: Sexual content
		 * 1: Violent or Repulsive
		 * 2: Harmful or Dangerous act
		 * 3: Spam/Commercials
		 */
		public var comboSelectedIndex:Number = 0;
		/**
		 * include the assets class in the app
		 * */
		private var _ar:AssetsRefferencer;

		/**
		 * flagging form
		 */
		private var _ui:ModerationScreen;

		/**
		 * success / failure message
		 */
		private var _endMsg:Message;

		/**
		 * plugin mediator
		 */
		private var _mediator:ModerationMediator;

		public function ModerationPlugin() {
			Security.allowDomain("*");
			this.horizontalAlign = "center";
			this.verticalAlign = "middle";
		}

		/**
		 * @inheritDoc
		 * */
		public function create(pluginName:String = null):IPlugin {
			return this;
		}

		/**
		 * @inheritDoc
		 * */
		public function initializePlugin(facade:IFacade):void {
			_mediator = new ModerationMediator(this);
			facade.registerMediator(_mediator);

		}

		/**
		 * set the given style to all visual parts
		 * */
		override public function setSkin(styleName:String, setSkinSize:Boolean = false):void {
			if (_ui) {
				_ui.setSkin(styleName);
			}
			if (_endMsg) {
				_endMsg.setSkin(styleName);
			}
		}

		/**
		 * shows the moderation ui over the player
		 * */
		public function showScreen():void {
			// disable KDP gui, stop entry from playing, exit fullscreen
			_mediator.sendNotification(NotificationType.CLOSE_FULL_SCREEN);
			_mediator.sendNotification(NotificationType.ENABLE_GUI, {guiEnabled : false, enableType : "full"});
			_mediator.sendNotification(NotificationType.DO_PAUSE);
			_mediator.sendNotification(DISABLE_SHORTCUT_PLUGIN);
			// show flagging form
			if (_ui == null) {
				_ui = new ModerationScreen();
				_ui.buttonsPosition = buttonsPosition;
				if (header) {
					_ui.headerText = header;
				}
				if (text) {
					_ui.windowText = text;
				}

				_ui.reasonsDataProvider = [{label:reasonSex, type:KalturaModerationFlagType.SEXUAL_CONTENT},
									{label:reasonViolence, type:KalturaModerationFlagType.VIOLENT_REPULSIVE},
									{label:reasonHarmful, type:KalturaModerationFlagType.HARMFUL_DANGEROUS},
									{label:reasonSpam, type:KalturaModerationFlagType.SPAM_COMMERCIALS}]
				//set custom behaviour for reasons combo
				_ui.comboSelectedIndex = comboSelectedIndex;

				_ui.showCombo = showCombo;

				_ui.addEventListener(ModerationPlugin.CANCEL, clearForm);
				_ui.addEventListener(ModerationPlugin.SUBMIT, onSubmitClicked);
			}
			addChild(_ui);
		}

		/**
		 * send data to server
		 */
		private function onSubmitClicked(e:Event):void {
			var o:Object = _ui.data;
			var comments:String = o.comments;
			var type:int = o.reason;
			_mediator.postModeration(comments, type);
		}

		/**
		 * close the form panel
		 */
		private function clearForm(e:Event = null):void {
			_ui.clearData();
			removeChild(_ui);
			end();
			_mediator.sendNotification(ENABLE_SHORTCUT_PLUGIN);
		}

		/**
		 * remove the end message
		 * @param e
		 */
		private function onMessageHide(e:Event):void {
			removeChild(_endMsg);
			end();
		}

		/**
		 * does everything that needs to be done before the plugin is closed
		 */
		private function end():void {
			_mediator.sendNotification(NotificationType.ENABLE_GUI, {guiEnabled : true, enableType : "full"});
		}

		/**
		 * notify the user and close panel
		 * */
		public function flagComplete(success:Boolean):void {
			clearForm();
			if (_endMsg == null) {
				_endMsg = new Message();
				_endMsg.addEventListener(Message.HIDE, onMessageHide);
			}
			if (success) {
				_endMsg.windowText = successMessage;
			}
			else {
				_endMsg.windowText = failedMessage;
			}
			addChild(_endMsg);
			_endMsg.close(hideTimeout);
		}
	}
}

fix shortcut and moderation collision--

fix shortcut and moderation collision--


//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.threerings.crowd.data {

public class ManagerCaller
{
    public function ManagerCaller (plobj :PlaceObject)
    {
        _plobj = plobj;
    }

    /**
     * Called to call a method on the manager.
     */
    public function invoke (method :String, args :Array = null) :void
    {
        _plobj.postMessage(method, args);
    }

    /** The place object we're thingy-ing for. */
    protected var _plobj :PlaceObject;
}
}

//
// $Id$
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

package com.threerings.crowd.data {

public class ManagerCaller
{
    public function ManagerCaller (plobj :PlaceObject)
    {
        _plobj = plobj;
    }

    /**
     * Called to call a method on the manager.
     */
    public function invoke (method :String, ... args) :void
    {
        _plobj.postMessage(method, args);
    }

    /** The place object we're thingy-ing for. */
    protected var _plobj :PlaceObject;
}
}

Change this instance back. Varargs are still a nightmare and should
generally be avoided, but nobody's going to override this method and
we're always calling a regular method on the server, not a varargs method.

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