package {
  import stdio.Sprite

  [SWF(width=0, height=0)]
  public class flash_test extends Sprite {
    public function main(): void {
      test_body()
    }
  }
}

package {
  import stdio.Sprite

  [SWF(width=100, height=100)]
  public class flash_test extends Sprite {
    public function flash_test(): void {
      graphics.beginFill(0xff0000)
      graphics.drawRect(10, 10, 80, 80)
      graphics.endFill()
    }

    public function main(): void {
      graphics.beginFill(0x0000ff)
      graphics.drawRect(30, 30, 40, 40)
      graphics.endFill()

      test_body()
    }
  }
}

Add colors to Flash test to ease debugging.


/*
#
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# This program 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 MIT License for full details.
*/

package com.rpath.raf.views
{
    import mx.core.UIComponent;
    import mx.events.ValidationResultEvent;

    import spark.components.Group;

    public class CompoundInputItem extends Group
    {
        public function CompoundInputItem()
        {
            super();

            // force height computation
            minHeight = 0;
        }

        [Bindable]
        public var inputFields:Array;

        public override function validationResultHandler(event:ValidationResultEvent):void
        {
            // let our specific input controls mark themselves appropriately
            for each (var elem:UIComponent in inputFields)
            {
                elem.validationResultHandler(event);
            }

            // propagate events beyond ourselves
            super.validationResultHandler(event);
        }

    }
}

/*
#
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the MIT License as found
# in a file called LICENSE. If it is not present, the license
# is always available at http://www.opensource.org/licenses/mit-license.php.
#
# This program 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 MIT License for full details.
*/

package com.rpath.raf.views
{
    import mx.core.UIComponent;
    import mx.events.ValidationResultEvent;

    import spark.components.Group;

    public class CompoundInputItem extends Group
    {
        public function CompoundInputItem()
        {
            super();

            // force height computation
            minHeight = 0;
        }

        [Bindable]
        public var inputFields:Array;

        public override function validationResultHandler(event:ValidationResultEvent):void
        {
            // let our specific input controls mark themselves appropriately
            for each (var elem:UIComponent in inputFields)
            {
                if (elem)
                    elem.validationResultHandler(event);
            }

            // propagate events beyond ourselves
            super.validationResultHandler(event);
        }

    }
}

Handle null in validation elem iteration


package io.github.jwhile.impetus
{
    import flash.media.Sound;
    import flash.media.SoundChannel;

    public class ImpetusSound
    {
        private var url:String;
        private var sound:Sound;

        private var channels:Vector.<SoundChannel>;

        public function ImpetusSound(url:String):void
        {
            this.url = url;
            this.sound = new Sound();

            this.channels = new Vector.<SoundChannel>;
        }
    }
}

package io.github.jwhile.impetus
{
    import flash.media.Sound;
    import flash.media.SoundChannel;
    import flash.net.URLRequest;

    public class ImpetusSound
    {
        private var sound:Sound;

        private var channels:Vector.<SoundChannel>;

        public function ImpetusSound(url:String):void
        {
            this.sound = new Sound();

            this.channels = new Vector.<SoundChannel>;

            this.sound.load(new URLRequest(url));
        }
    }
}

Load sound directly on constructor

Load sound directly on constructor


package org.flexunit.experimental.theories.internals.cases
{
	import org.flexunit.Assert;
	import org.flexunit.experimental.theories.internals.ParameterizedAssertionError;

	public class ParameterizedAssertionErrorCase
	{
		//TODO: Ensure that these tests and this test case are being implemented correctly.
		//It is currently impossible to test the stringValueOf function.

		[Test(description="Ensure that the ParameterizedAssertionError constructor is correctly assigning parameter values")]
		public function constructorTest():void {
			var targetException:Error = new Error();
			var methodName:String = "methodName";
			var params:Array = new Array("valueOne", "valueTwo");

			var parameterizedAssertionError:ParameterizedAssertionError = new ParameterizedAssertionError(targetException, methodName, "valueOne", "valueTwo");

			var message:String = methodName + " " + params.join( ", " );
			Assert.assertEquals( message, parameterizedAssertionError.message);
			Assert.assertEquals( targetException, parameterizedAssertionError.targetException );
		}

		[Test(description="Ensure that the join function is correctly joining the delimiter to the other parameters")]
		public function joinTest():void {
			var delimiter:String = ", ";
			var params:Array = new Array("valueOne", "valueTwo", "valueThree");

			var message:String = params.join( delimiter );
			Assert.assertEquals( message, ParameterizedAssertionError.join(delimiter, "valueOne", "valueTwo", "valueThree") );
		}
	}
}

package org.flexunit.experimental.theories.internals.cases
{
	import org.flexunit.Assert;
	import org.flexunit.experimental.theories.internals.ParameterizedAssertionError;

	public class ParameterizedAssertionErrorCase
	{
		//TODO: Ensure that these tests and this test case are being implemented correctly.
		//It is currently impossible to test the stringValueOf function.

		[Ignore("Currently Ignoring Test as this functionality is under investigation due to Max stack overflow issue")]
		[Test(description="Ensure that the ParameterizedAssertionError constructor is correctly assigning parameter values")]
		public function constructorTest():void {
			var targetException:Error = new Error();
			var methodName:String = "methodName";
			var params:Array = new Array("valueOne", "valueTwo");

			var parameterizedAssertionError:ParameterizedAssertionError = new ParameterizedAssertionError(targetException, methodName, "valueOne", "valueTwo");

			var message:String = methodName + " " + params.join( ", " );
			Assert.assertEquals( message, parameterizedAssertionError.message);
			Assert.assertEquals( targetException, parameterizedAssertionError.targetException );
		}

		[Test(description="Ensure that the join function is correctly joining the delimiter to the other parameters")]
		public function joinTest():void {
			var delimiter:String = ", ";
			var params:Array = new Array("valueOne", "valueTwo", "valueThree");

			var message:String = params.join( delimiter );
			Assert.assertEquals( message, ParameterizedAssertionError.join(delimiter, "valueOne", "valueTwo", "valueThree") );
		}
	}
}

Set test to ignore while stack trace is still under investigation


import Drawable;
import Lobe;
import Core;

class Brain{
    static var brain = new Array();
    var mSelectionManager:SelectionManager;
    static function makenewlobe(){
      var newmov=(new Lobe(_root,_root.getNextHighestDepth()));
      var topleft = new Point(100,40);
      var botright = new Point(200,140);
      newmov.commitBox(topleft, botright, 0);
              var keyListener = {};
        keyListener.onKeyDown = function()
        {
            var k = Key.getCode();
            if(k == Key.DELETEKEY){
                Brain.makenewlobe();
            }
        };
    }
    function Brain (root_mc:MovieClip) {
       mSelectionManager = new SelectionManager(root_mc);
    }
}

import Drawable;
import Lobe;
import Core;

class Brain{
    static var brain = new Array();
    var mSelectionManager:SelectionManager;
    static function makenewlobe(){
      var newmov=(new Lobe(_root,_root.getNextHighestDepth()));
      var topleft = new Point(100,40);
      var botright = new Point(200,140);
      newmov.commitBox(topleft, botright, 0);
    }

    function Brain (root_mc:MovieClip) {
       mSelectionManager = new SelectionManager(root_mc);
               var keyListener = {};
        keyListener.onKeyDown = function()
        {
            var k = Key.getCode();
            if(k == Key.DELETEKEY){
                Brain.makenewlobe();
            }
        };
        Key.addListener( keyListener );
    }
}

Delete is now a non-core function

Delete is now a non-core function

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


// [ ] Variable declaration
let name: type = expression;

// [ ] Basic types (arrow)
/*

byte (8-bit, unsigned)
bool (1-bit[*])

int8
int16
int32
int64
int128

uint8
uint16
uint32
uint64
uint128

intptr (size of a pointer, signed)
uintptr (size of a pointer, unsigned)

char (32-bit, unsigned)

float16
float32
float64
float128

*/

// [ ] Expressions
// [ ]    - Add
// [ ]    - Subtract
// [ ]    - Multiply
// [ ]    - Divide
// [ ]    - Modulo
// [ ]    - Logical And
// [ ]    - Logical Or
// [ ]    - Logical Not
// [ ]    - Relational GT
// [ ]    - Relational GE
// [ ]    - Relational LT
// [ ]    - Relational LE
// [ ]    - Relational And
// [ ]    - Relational Or
// [ ]    - Bitwise And
// [ ]    - Bitwise Or
// [ ]    - Bitwise Xor
// [ ]    - Bitwise Not

// [ ] Pointers
// [ ]    - Type
// [ ]    - Address Of
// [ ]    - Dereference

// [ ] Cast

// [ ] Function declaration
def main() {
}

// [ ] Extern function declaration
extern def puts(s: *byte);

// [ ] Extern function declaration w/ABI
extern "stdcall" def CreateWindowExA();

// [ ] Function call (extern AND local)
main();
puts("Hello");

// [ ] Extern import
extern import "stdint.h";

// [ ] Module (namespace)
module cstdint { extern import "stdint.h"; }

// [ ] c module (built-in)
import "c";

/*

// [ ] Basic types (in C)
c.char
c.uchar
c.schar
c.int
c.uint
c.short
c.ushort
c.long
c.ulong
c.float
c.double
c.ldouble

*/

// [ ] BigInt
int  // (∞-bit, signed)

Add a roadmap (of sorts)

Add a roadmap (of sorts)


//
// $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


package com.threerings.flex {

import mx.containers.HBox;

import mx.controls.Label;

import mx.controls.sliderClasses.Slider;

import mx.events.SliderEvent;

/**
 * A simple component that displays a label to the left of a slider.
 */
public class LabeledSlider extends HBox
{
    /** The slider, all public and accessable. Don't fuck it up! */
    public var slider :Slider;

    /**
     * Create a LabeledSlider holding the specified slider.
     */
    public function LabeledSlider (slider :Slider)
    {
        _label = new Label();
        _label.text = String(slider.value);

        addChild(_label);
        this.slider = slider;
        slider.showDataTip = false; // because we do it...
        addChild(slider);

        slider.addEventListener(SliderEvent.CHANGE, handleSliderChange, false, 0, true);
    }

    protected function handleSliderChange (event :SliderEvent) :void
    {
        _label.text = String(event.value);
    }

    protected var _label :Label;
}
}

package com.threerings.flex {

import mx.containers.HBox;

import mx.controls.Label;

import mx.controls.sliderClasses.Slider;

import mx.events.SliderEvent;

/**
 * A simple component that displays a label to the left of a slider.
 */
public class LabeledSlider extends HBox
{
    /** The actual slider. */
    public var slider :Slider;

    /**
     * Create a LabeledSlider holding the specified slider.
     */
    public function LabeledSlider (slider :Slider)
    {
        _label = new Label();
        _label.text = String(slider.value);

        addChild(_label);
        this.slider = slider;
        slider.showDataTip = false; // because we do it...
        addChild(slider);

        slider.addEventListener(SliderEvent.CHANGE, handleSliderChange, false, 0, true);
    }

    protected function handleSliderChange (event :SliderEvent) :void
    {
        _label.text = String(event.value);
    }

    protected var _label :Label;
}
}

Clean up my comment, this is in a public API (and my comment wasn't helpful).

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


package org.denivip.osmf.utils
{
	import org.osmf.utils.URL;

	public class Utils
	{
		public static function createFullUrl(rootUrl:String, url:String):String{

			if(url.search(/(ftp|file|https?):\/\/\/?/) == 0)
				return url;

			// other manipulations :)
			if(url.charAt(0) == '/'){
				return URL.getRootUrl(rootUrl) + url;
			}

			if(rootUrl.lastIndexOf('/') != rootUrl.length)
				rootUrl += '/';

			return rootUrl + url;
		}
	}
}

package org.denivip.osmf.utils
{
	import org.osmf.utils.URL;

	public class Utils
	{
		public static function createFullUrl(rootUrl:String, url:String):String {
			if(url.search(/(ftp|file|https?):\/\/\/?/) == 0)
				return url;

			// other manipulations :)
			if(url.charAt(0) == '/'){
				return URL.getRootUrl(rootUrl) + url;
			}

			if(rootUrl.lastIndexOf('/') != rootUrl.length - 1)
				rootUrl += '/';

			return rootUrl + url;
		}
	}
}

Fix issue where check for final slash was comparing zero-based index with length


package com.threerings.util {

import flash.net.URLRequest;
//import flash.net.navigateToURL; // function import

public class NetUtil
{
    /**
     * Convenience method to load a web page in the browser window without
     * having to worry about SecurityErrors in various conditions.
     */
    public static function navigateToURL (
            url :String, preferSameWindowOrTab :Boolean = true) :void
    {
        var ureq :URLRequest = new URLRequest(url);
        if (preferSameWindowOrTab) {
            try {
                flash.net.navigateToURL(ureq, "_self");
                return;
            } catch (err :SecurityError) {
                // ignore; fall back to using a blank window, below...
            }
        }

        // open in a blank window
        try {
            flash.net.navigateToURL(ureq);
        } catch (err :SecurityError) {
            Log.getLog(NetUtil).warning(
                "Unable to navigate to URL [e=" + err + "].");
        }
    }

}
}

package com.threerings.util {

import flash.net.URLRequest;
//import flash.net.navigateToURL; // function import

public class NetUtil
{
    /**
     * Convenience method to load a web page in the browser window without
     * having to worry about SecurityErrors in various conditions.
     *
     * @return true if the url was unable to be loaded.
     */
    public static function navigateToURL (
            url :String, preferSameWindowOrTab :Boolean = true) :Boolean
    {
        var ureq :URLRequest = new URLRequest(url);
        if (preferSameWindowOrTab) {
            try {
                flash.net.navigateToURL(ureq, "_self");
                return true;
            } catch (err :SecurityError) {
                // ignore; fall back to using a blank window, below...
            }
        }

        // open in a blank window
        try {
            flash.net.navigateToURL(ureq);
            return true;
        } catch (err :SecurityError) {
            Log.getLog(NetUtil).warning(
                "Unable to navigate to URL [e=" + err + "].");
        }

        return false; // failure!
    }
}
}

Return true if we succeeded.

Return true if we succeeded.

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


package laml.display {
	import flash.display.DisplayObject;
	import flash.display.Sprite;

	public class Skin extends Sprite implements ISkin {

		public function getBitmapByName(alias:String):DisplayObject {
			if(hasOwnProperty(alias)) {
				return new this[alias]() as DisplayObject;
			}

			return null;
		}
	}
}

package laml.display {
	import flash.display.DisplayObject;
	import flash.display.Sprite;

	import mx.core.BitmapAsset;
	import mx.core.FontAsset;
	import mx.core.IFlexAsset;
	import mx.core.IFlexDisplayObject;
	import mx.core.SpriteAsset;

	public class Skin extends Sprite implements ISkin {
 		private var bitmapAsset:BitmapAsset;
		private var fontAsset:FontAsset;
		private var iFlexAsset:IFlexAsset;
		private var iFlexDisplayObject:IFlexDisplayObject;
		private var spriteAsset:SpriteAsset;

		public function getBitmapByName(alias:String):DisplayObject {
			if(hasOwnProperty(alias)) {
				return new this[alias]() as DisplayObject;
			}

			return null;
		}
	}
}

Put MX dependencies in skin

Put MX dependencies in skin

git-svn-id: 02605e11d3a461bc7e12f3f3880edf4b0c8dcfd0@4281 3e7533ad-8678-4d30-8e38-00a379d3f0d0


package Components
{
	[Bindable]
	public class Association
	{
		public var associatedNode:String;
		public var associatedLink:String;
		public var operatorIndex:int;

		public function Association(associatedNode:String,associatedLink:String,operatorIndex:int)
		{
			this.associatedLink = associatedLink;
			this.associatedNode = associatedNode;
			this.operatorIndex  = operatorIndex;
		}

	}
}

package Components
{
	[Bindable]
	public class Association
	{
		public var associatedNode:String;
		public var associatedLink:String;
		public var operatorIndex:int;
		public var order:int=0;

		public function Association(associatedNode:String,associatedLink:String,operatorIndex:int,order:int)
		{
			this.associatedLink = associatedLink;
			this.associatedNode = associatedNode;
			this.operatorIndex  = operatorIndex;
			this.order=order;
		}

	}
}

Order vairable added todecide order of association

SVN-Revision: 9306


package org.osflash.signals {
	import asunit4.ui.MinimalRunnerUI;
	import org.osflash.signals.AllTests;

	public class AllTestsRunner extends MinimalRunnerUI
	{
		public function AllTestsRunner()
		{
			run(org.osflash.signals.AllTests);
		}
	}
}

package org.osflash.signals {
	import asunit4.ui.MinimalRunnerUI;
	import org.osflash.signals.AllTests;

	[SWF(width='1000', height='800', backgroundColor='#333333', frameRate='31')]
	public class AllTestsRunner extends MinimalRunnerUI
	{
		public function AllTestsRunner()
		{
			run(org.osflash.signals.AllTests);
		}
	}
}

Put [SWF] tag in test runner app.

Put [SWF] tag in test runner app.


package com.axis.rtspclient {
  import flash.events.Event;
  import flash.external.ExternalInterface;
  import flash.utils.ByteArray;

  public class NALU extends Event {
    public static const NEW_NALU:String = "NEW_NALU";

    private var data:ByteArray;
    public var ntype:uint;
    public var nri:uint;
    public var timestamp:uint;
    public var bodySize:uint;

    public function NALU(ntype:uint, nri:uint, data:ByteArray, timestamp:uint) {
      super(NEW_NALU);

      this.data      = data;
      this.ntype     = ntype;
      this.nri       = nri;
      this.timestamp = timestamp;
      this.bodySize  = data.bytesAvailable;
    }

    public function appendData(idata:ByteArray):void {
      ByteArrayUtils.appendByteArray(data, idata);
      this.bodySize = data.bytesAvailable;
    }

    public function isIDR():Boolean {
      return (5 === ntype);
    }

    public function writeSize():uint {
      return 2 + 2 + 1 + data.bytesAvailable;
    }

    public function writeStream(output:ByteArray):void {
      output.writeUnsignedInt(data.bytesAvailable + 1); // NALU length + header
      output.writeByte((0x0 & 0x80) | (nri & 0x60) | (ntype & 0x1F)); // NAL header
      output.writeBytes(data, data.position);
    }
  }
}

package com.axis.rtspclient {
  import flash.events.Event;
  import flash.external.ExternalInterface;
  import flash.utils.ByteArray;

  public class NALU extends Event {
    public static const NEW_NALU:String = "NEW_NALU";

    private var data:ByteArray;
    public var ntype:uint;
    public var nri:uint;
    public var timestamp:uint;
    public var bodySize:uint;

    public function NALU(ntype:uint, nri:uint, data:ByteArray, timestamp:uint) {
      super(NEW_NALU);

      this.data      = data;
      this.ntype     = ntype;
      this.nri       = nri;
      this.timestamp = timestamp;
      this.bodySize  = data.bytesAvailable;
    }

    public function appendData(idata:ByteArray):void {
      ByteArrayUtils.appendByteArray(data, idata);
      this.bodySize = data.bytesAvailable;
    }

    public function isIDR():Boolean {
      return (5 === ntype);
    }

    public function writeSize():uint {
      return 2 + 2 + 1 + data.bytesAvailable;
    }

    public function writeStream(output:ByteArray):void {
      output.writeUnsignedInt(data.bytesAvailable + 1); // NALU length + header
      output.writeByte((0x0 & 0x80) | (nri & 0x60) | (ntype & 0x1F)); // NAL header
      output.writeBytes(data, data.position);
    }

    public function getPayload():ByteArray {
      var payload:ByteArray = new ByteArray();
      data.position -= 1;
      data.readBytes(payload, 0, data.bytesAvailable);
      return payload;
    }
  }
}

Implement getPayload() method to extract SPS/PPS bytes


package {
  import stdio.flash.Sprite
  import stdio.process
  import stdio.Interactive

  [SWF(width=0, height=0)]
  public class test_readline_flash extends Sprite implements Interactive {
    public function main(): void {
      process.prompt = "What’s your name? "
      process.gets(function (name: String): void {
        process.puts("Hello, " + name + "!")
        process.prompt = "Favorite color? "
        process.gets(function (color: String): void {
          process.puts("I like " + color + " too!")
          process.exit()
        })
      })
    }
  }
}

package {
  import stdio.colorize
  import stdio.flash.Sprite
  import stdio.process
  import stdio.Interactive

  [SWF(width=0, height=0)]
  public class test_readline_flash extends Sprite implements Interactive {
    public function main(): void {
      process.prompt = "What’s your name? "
      process.gets(function (name: String): void {
        process.puts("Hello, " + name + "!")
        process.prompt = "What’s your favorite color? "
        process.gets(function (color: String): void {
          color = color.toLowerCase()
          process.puts(
            "I like " + colorize(
              "%{bold}%{" + color + "}" + color + "%{none}"
            ) + " too!"
          )
          process.exit()
        })
      })
    }
  }
}

Use `colorize` in readline test.

Use `colorize` in readline test.


package org.openforis.collect.i18n {
	import mx.resources.ResourceManager;

	/**
	 * @author Mino Togna
	 * */
	public class Message {

		public function Message() {
		}

		public static function get(resource:String, parameters:Array=null, bundle:String="messages"):String {
			return ResourceManager.getInstance().getString(bundle, resource, parameters);
		}
	}
}

package org.openforis.collect.i18n {
	import mx.resources.ResourceManager;

	/**
	 * @author Mino Togna
	 * @author S. Ricci
	 * */
	public class Message {

		public function Message() {
		}

		public static function get(resource:String, parameters:Array=null, bundle:String="messages"):String {
			var message:String = ResourceManager.getInstance().getString(bundle, resource, parameters);
			if(message != null) {
				return message;
			} else {
				return resource;
			}
		}
	}
}

Return resource name instead of null if not found


package dolly.data {

public class PropertyLevelCopyableClass {

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

	public static var staticProperty2:String = "Value of first-level static property 2.";

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

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

	public var property2:String = "Value of first-level public property 2.";

	public function PropertyLevelCopyableClass() {
	}

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

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

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

package dolly.data {

public class PropertyLevelCopyableClass {

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

	public static var staticProperty2:String = "Value of first-level static property 2.";

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

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

	public var property2:String = "Value of first-level public property 2.";

	public function PropertyLevelCopyableClass() {
	}

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

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

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

Fix stupid mistake with metadata names.

Fix stupid mistake with metadata names.


package {
  import asunit.framework.TestSuite;

  public class Suite extends TestSuite {
    public function Suite() {
      super();
      addTest(new PlayerTest("testPass"));
    }
  }
}

package {
  import asunit.framework.TestSuite;

  public class Suite extends TestSuite {
    public function Suite() {
      super();
      addTest(new PlayerTest("testPass"));
      addTest(new UriTest("test_isSafe"));
    }
  }
}

Add URI tests to the asunit test suite

Add URI tests to the asunit test suite


package
{
    import flash.media.Sound;
    import flash.net.URLRequest;

    public class ImpetusSound
    {
        private var sound:Sound;

        private var channels:Vector.<ImpetusChannel>;

        public function ImpetusSound(url:String):void
        {
            this.sound = new Sound();

            this.channels = new Vector.<ImpetusChannel>;

            this.sound.load(new URLRequest(url));
        }

        public function playNew():ImpetusChannel
        {
            var c:ImpetusChannel = new ImpetusChannel(this.sound.play(0));

            channels.push(c);

            return c;
        }

        public function stopAll():void
        {
            var len:int = this.channels.length;

            for(var i:int; i < len; i++)
            {
                this.channels[i].stop();
            }
        }
    }
}

package
{
    import flash.media.Sound;
    import flash.net.URLRequest;

    public class ImpetusSound
    {
        private var url:String;
        private var sound:Sound;

        private var channels:Vector.<ImpetusChannel>;

        public function ImpetusSound(url:String):void
        {
            this.url = url;
            this.sound = new Sound();

            this.channels = new Vector.<ImpetusChannel>;

            this.sound.load(new URLRequest(url));
        }

        public function get getUrl():String
        {
            return this.url
        }

        public function playNew():ImpetusChannel
        {
            var c:ImpetusChannel = new ImpetusChannel(this.sound.play(0));

            channels.push(c);

            return c;
        }

        public function stopAll():void
        {
            var len:int = this.channels.length;

            for(var i:int; i < len; i++)
            {
                this.channels[i].stop();
            }
        }
    }
}

Store url & add getUrl() getter

Store url & add getUrl() getter


package {

  class ClassA
  {
    public function ClassA()
    {
      trace('A');
    }
    protected function foo() : void
    {
      trace('a');
    }
    protected function bar() : void
    {
      trace('b');
    }
  }

  class ClassC extends ClassA
  {
    public function ClassC()
    {
      trace('> C');
      super();

      foo();
      bar();
      trace('< C');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b');
    }
  }

  class ClassE extends ClassC
  {
    public function ClassE()
    {
      trace('> E');
      super();
      foo();
      bar();
      trace('< E');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b again');
    }
  }

  // var c = new ClassC();
  // var e = new ClassE();

  class X {
    protected var
  }
  trace("--");
}

package {

  class ClassA
  {
    public function ClassA()
    {
      trace('A');
    }
    protected function foo() : void
    {
      trace('a');
    }
    protected function bar() : void
    {
      trace('b');
    }
  }

  class ClassC extends ClassA
  {
    public function ClassC()
    {
      trace('> C');
      super();

      foo();
      bar();
      trace('< C');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b');
    }
  }

  class ClassE extends ClassC
  {
    public function ClassE()
    {
      trace('> E');
      super();
      foo();
      bar();
      trace('< E');
    }

    override protected function bar() : void {
      super.bar();
      trace('override b again');
    }
  }

  trace("--");
}

Fix call super test case.

Fix call super test case.


package flails.mxml {
  import com.asfusion.mate.actions.AbstractServiceInvoker;
  import com.asfusion.mate.actionLists.IScope;
  import com.asfusion.mate.actions.IAction;

  import mx.rpc.events.ResultEvent;
  import mx.rpc.events.FaultEvent;

  import flails.request.RequestPipe;
  import flails.resource.Resources;
  import flails.resource.Resource;

  public class ResourcefulServiceInvoker extends AbstractServiceInvoker implements IAction {
    public var resource:Resource;
    public var data:Array;
    public var type:String;
    public var id:String;
    public var parent:Object;

    [Bindable] public var result:Object;

    public function ResourcefulServiceInvoker() {
      currentInstance = this;
    }

    override protected function prepare(scope:IScope):void {
      super.prepare(scope);
    }

    override protected function run(scope:IScope):void {
      trace ("Using resource " + resource);

      var rp:RequestPipe = resource.newRequestPipe();

      innerHandlersDispatcher = rp;

      if (resultHandlers && resultHandlers.length > 0) {
        createInnerHandlers(scope, ResultEvent.RESULT, resultHandlers);
      }

      if (faultHandlers && faultHandlers.length > 0) {
        createInnerHandlers(scope, FaultEvent.FAULT, faultHandlers);
      }

      trace("calling " + type + "()");

      rp[type].apply(rp, data);
    }
  }
}

package flails.mxml {
  import com.asfusion.mate.actions.AbstractServiceInvoker;
  import com.asfusion.mate.actionLists.IScope;
  import com.asfusion.mate.actions.IAction;

  import mx.rpc.events.ResultEvent;
  import mx.rpc.events.FaultEvent;

  import flails.request.RequestPipe;
  import flails.resource.Resources;
  import flails.resource.Resource;

  public class ResourcefulServiceInvoker extends AbstractServiceInvoker implements IAction {
    private var _data:Array;

    public var resource:Resource;
    public var type:String;
    public var id:String;
    public var parent:Object;

    [Bindable] public var result:Object;

    public function set data(args:Object):void {
      trace("setting data");

      if (args is Array)
        _data = args as Array;
      else
        _data = [args];
    }

    override protected function prepare(scope:IScope):void {
      currentInstance = this;

      super.prepare(scope);
    }

    override protected function run(scope:IScope):void {
      trace ("Using resource " + resource);

      var rp:RequestPipe = resource.newRequestPipe();

      innerHandlersDispatcher = rp;

      if (resultHandlers && resultHandlers.length > 0) {
        createInnerHandlers(scope, ResultEvent.RESULT, resultHandlers);
      }

      if (faultHandlers && faultHandlers.length > 0) {
        createInnerHandlers(scope, FaultEvent.FAULT, faultHandlers);
      }

      trace("calling " + type + "() with " + _data);

      rp[type].apply(rp, _data);
    }
  }
}

Set currentInstance on prepare, not on instantiation time.


/**
 * Generated by Gas3 v2.3.0 (Granite Data Services).
 *
 * NOTE: this file is only generated if it does not exist. You may safely put
 * your custom code here.
 */

package org.openforis.collect.metamodel.proxy {
	import mx.collections.IList;

	import org.openforis.collect.util.CollectionUtil;

    [Bindable]
    [RemoteClass(alias="org.openforis.collect.metamodel.proxy.UITabSetProxy")]
    public class UITabSetProxy extends UITabSetProxyBase {

		public function getTab(name:String):UITabProxy {
			var stack:Array = new Array();
			stack.push(tabs);
			while (stack.length > 0) {
				var tabs:IList = stack.pop();
				for each(var tab:UITabProxy in tabs) {
					if(tab.name == name) {
						return tab;
					}
					if ( CollectionUtil.isNotEmpty(tab.tabs) ) {
						stack.push(tab.tabs);
					}
				}
			}
			return null;
		}
    }
}

/**
 * Generated by Gas3 v2.3.0 (Granite Data Services).
 *
 * NOTE: this file is only generated if it does not exist. You may safely put
 * your custom code here.
 */

package org.openforis.collect.metamodel.proxy {
	import mx.collections.IList;

	import org.openforis.collect.util.CollectionUtil;

    [Bindable]
    [RemoteClass(alias="org.openforis.collect.metamodel.proxy.UITabSetProxy")]
    public class UITabSetProxy extends UITabSetProxyBase {

		public function getTab(name:String):UITabProxy {
			var stack:Array = new Array();
			stack.push(this.tabs);
			while (stack.length > 0) {
				var currentTabs:IList = stack.pop();
				for each(var tab:UITabProxy in currentTabs) {
					if(tab.name == name) {
						return tab;
					}
					if ( CollectionUtil.isNotEmpty(tab.tabs) ) {
						stack.push(tab.tabs);
					}
				}
			}
			return null;
		}
    }
}

Fix unexpected behavior with nested tabs


Put MX dependencies in skin


/**
 * Copyright (c) 2009 Lance Carlson
 * See LICENSE for full license information.
 */

package flails.resource {
  import flails.request.RequestPipe;
  import flails.request.HTTPClient;
  import flails.request.ResourcePathBuilder;
  import flails.request.JSONFilter;

  import flash.utils.getQualifiedClassName;

  import mx.core.IMXMLObject;

  public class Resource {
    public var name:String;
    public var instanceClass:Class;

    public function Resource() {}

    public function initialized(parent:Object, id:String):void {
    }

    public function index(resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).index();
    }

    public function show(id:Number, resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).show(id);
    }

    public function requestPipe(resultHandler:Function, errorHandler:Function):RequestPipe {
      // TODO: The pluralization obviously needs to be taken care of
      var pipe:RequestPipe = new HTTPClient(new ResourcePathBuilder(name), new JSONFilter(instanceClass));

      pipe.addEventListener("result", resultHandler);

      return pipe;
    }
  }
}

/**
 * Copyright (c) 2009 Lance Carlson
 * See LICENSE for full license information.
 */

package flails.resource {
  import flails.request.RequestPipe;
  import flails.request.HTTPClient;
  import flails.request.ResourcePathBuilder;
  import flails.request.JSONFilter;

  import mx.core.IMXMLObject;

  public class Resource implements IMXMLObject {
    public var name:String;
    public var instanceClass:Class;

    public function Resource() {}

    public function initialized(parent:Object, id:String):void {
      if (name == null) throw new Error("Name not set for resource.");
      if (instanceClass == null) instanceClass = Record;
    }

    public function index(resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).index();
    }

    public function show(id:Number, resultHandler:Function, errorHandler:Function = null):void {
      requestPipe(resultHandler, errorHandler).show(id);
    }

    public function requestPipe(resultHandler:Function, errorHandler:Function):RequestPipe {
      // TODO: The pluralization obviously needs to be taken care of
      var pipe:RequestPipe = new HTTPClient(new ResourcePathBuilder(name), new JSONFilter(instanceClass));

      pipe.addEventListener("result", resultHandler);

      return pipe;
    }
  }
}

Implement IMXMLObject. Some defaults and checks.


package dolly {

import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Type;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}
}
}

package dolly {
import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Field;
import org.as3commons.reflect.Type;
import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertNotNull;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}

	[Test]
	public function findingAllWritableFieldsForType():void {
		const writableFields:Vector.<Field> = Cloner.findAllWritableFieldsForType(compositeCloneableClassType);
		assertNotNull(writableFields);
		assertEquals(4, writableFields.length);
	}
}
}

Test for calculation of cloneable fields in CompositeCloneableClass.


package dolly {
import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Field;
import org.as3commons.reflect.Type;
import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertNotNull;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}

	[Test]
	public function findingAllWritableFieldsForType():void {
		const writableFields:Vector.<Field> = Cloner.findAllWritableFieldsForType(compositeCloneableClassType);
		assertNotNull(writableFields);
		assertEquals(4, writableFields.length);
	}
}
}

package dolly {
import dolly.core.dolly_internal;
import dolly.data.CompositeCloneableClass;

import org.as3commons.reflect.Field;
import org.as3commons.reflect.Type;
import org.flexunit.asserts.assertEquals;
import org.flexunit.asserts.assertFalse;
import org.flexunit.asserts.assertNotNull;
import org.hamcrest.assertThat;
import org.hamcrest.collection.array;
import org.hamcrest.collection.arrayWithSize;
import org.hamcrest.collection.everyItem;
import org.hamcrest.core.isA;
import org.hamcrest.object.equalTo;

use namespace dolly_internal;

public class CloningOfCompositeCloneableClassTest {

	private var compositeCloneableClass:CompositeCloneableClass;
	private var compositeCloneableClassType:Type;

	[Before]
	public function before():void {
		compositeCloneableClass = new CompositeCloneableClass();

		compositeCloneableClassType = Type.forInstance(compositeCloneableClass);
	}

	[After]
	public function after():void {
		compositeCloneableClass = null;
		compositeCloneableClassType = null;
	}

	[Test]
	public function findingAllWritableFieldsForType():void {
		const writableFields:Vector.<Field> = Cloner.findAllWritableFieldsForType(compositeCloneableClassType);
		assertNotNull(writableFields);
		assertEquals(4, writableFields.length);
	}

	[Test]
	public function cloningOfArray():void {
		const clone:CompositeCloneableClass = Cloner.clone(compositeCloneableClass);

		assertNotNull(clone.array);
		assertThat(clone.array, arrayWithSize(5));
		assertThat(clone.array, compositeCloneableClass.array);
		assertFalse(clone.array == compositeCloneableClass.array);
		assertThat(clone.array, everyItem(isA(Number)));
		assertThat(clone.array, array(equalTo(0), equalTo(1), equalTo(2), equalTo(3), equalTo(4)));
	}
}
}

Test for cloning array in CompositeCloneableClass.


package org.flexunit.events
{
	import flash.events.ErrorEvent;
	import flash.events.Event;

	public class UnknownError extends Error
	{
		public function UnknownError( event:Event )
		{
			var error:Error;
			if ( event.hasOwnProperty( "error" ) ) {
				var errorGeneric:* = event[ "error" ];

				if ( errorGeneric is Error ) {
					error = errorGeneric as Error;
				} else if ( errorGeneric is ErrorEvent ) {
					var errorEvent:ErrorEvent = errorGeneric as ErrorEvent;
					error = new Error( "Top Level Error", errorEvent.errorID );
				}
			}

			super( error.message, error.errorID );
		}
	}
}

package org.flexunit.events
{
	import flash.events.ErrorEvent;
	import flash.events.Event;

	public class UnknownError extends Error
	{
		public function UnknownError( event:Event )
		{
			var error:Error;
			if ( event.hasOwnProperty( "error" ) ) {
				var errorGeneric:* = event[ "error" ];

				if ( errorGeneric is Error ) {
					error = errorGeneric as Error;
				} else if ( errorGeneric is ErrorEvent ) {
					var errorEvent:ErrorEvent = errorGeneric as ErrorEvent;
					error = new Error( "Top Level Error", Object(errorEvent).errorID );
				}
			}

			super( error.message, error.errorID );
		}
	}
}

Fix for build issue around unknown error


package com.kaltura.kdpfl.plugin
{
	import org.osmf.traits.LoaderBase;

	public class WVLoader extends LoaderBase
	{
		public function WVLoader()
		{
			super();
		}
	}
}

package com.kaltura.kdpfl.plugin
{
	import flash.external.ExternalInterface;

	import org.osmf.media.MediaResourceBase;
	import org.osmf.traits.LoaderBase;

	public class WVLoader extends LoaderBase
	{
		public function WVLoader()
		{
			super();
		}

		override public function canHandleResource(resource:MediaResourceBase):Boolean
		{
			if (resource.hasOwnProperty("url") && resource["url"].toString().indexOf(".wvm") > -1 )
			{
				try
				{
					ExternalInterface.call("mediaURL" , resource["url"].toString());
				}
				catch(error:Error)
				{
					trace("Failed to call external interface");
				}
				return true;
			}
			return false;
		}
	}
}

Fix a bug that caused "ChangeMedia" to fail


package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    { debug("Failed to load <" + url + ">: " + event.text) }
  }
}

package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    {
      const code : String = event.text.match(/^Error #(\d+)/)[1]
      const message : String = code == "2035" ? "Not found" : event.text

      debug("Error: Failed to load <" + url + ">: " + message)
    }
  }
}

Improve error handling of external content loading.


package aerys.minko.render.effect.vertex
{
	import aerys.minko.render.RenderTarget;
	import aerys.minko.render.effect.basic.BasicProperties;
	import aerys.minko.render.effect.basic.BasicShader;
	import aerys.minko.render.shader.SFloat;
	import aerys.minko.type.stream.format.VertexComponent;

	public class VertexUVShader extends BasicShader
	{

		public function VertexUVShader(target 	: RenderTarget 	= null,
									   priority	: Number		= 0)
		{
			super(target, priority);
		}

		override protected function getPixelColor() : SFloat
		{
			var uv 				: SFloat = getVertexAttribute(VertexComponent.UV);

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_SCALE))
				uv.scaleBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_SCALE, 2));

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_OFFSET))
				uv.incrementBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_OFFSET, 2));

			var interpolatedUv 	: SFloat = fractional(interpolate(uv));

			return float4(interpolatedUv.x, interpolatedUv.y, 0, 1);
		}

	}
}

package aerys.minko.render.effect.vertex
{
	import aerys.minko.render.RenderTarget;
	import aerys.minko.render.effect.basic.BasicProperties;
	import aerys.minko.render.effect.basic.BasicShader;
	import aerys.minko.render.shader.SFloat;
	import aerys.minko.type.stream.format.VertexComponent;

	public class VertexUVShader extends BasicShader
	{
		public function VertexUVShader(target 	: RenderTarget 	= null,
									   priority	: Number		= 0)
		{
			super(target, priority);
		}

		override protected function getPixelColor() : SFloat
		{
			var uv 	: SFloat = getVertexAttribute(VertexComponent.UV);

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_SCALE))
				uv.scaleBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_SCALE, 2));

			if (meshBindings.propertyExists(BasicProperties.DIFFUSE_UV_OFFSET))
				uv.incrementBy(meshBindings.getParameter(BasicProperties.DIFFUSE_UV_OFFSET, 2));

			uv = interpolate(uv);

			var fractional : SFloat = fractional(uv);
			var fractionalIsZero : SFloat = equal(fractional, float2(0, 0));
			var interpolatedUv 	: SFloat = add(
				multiply(not(fractionalIsZero), fractional),
				multiply(fractionalIsZero, saturate(uv))
			);

			return float4(interpolatedUv.x, interpolatedUv.y, 0, 1);
		}

	}
}

Optimize uv shader for limit values

Optimize uv shader for limit values


package dolly {
public class ClassWithSomeCopyableFields {

	public static var staticProperty1:String;

	[Cloneable]
	public static var staticProperty2:String;

	[Cloneable]
	public static var staticProperty3:String;

	private var _writableField:String;
	private var _readOnlyField:String = "read-only field value";

	public var property1:String;

	[Cloneable]
	public var property2:String;

	[Cloneable]
	public var property3:String;

	public function ClassWithSomeCopyableFields() {
	}

	[Cloneable]
	public function get writableField():String {
		return _writableField;
	}

	public function set writableField(value:String):void {
		_writableField = value;
	}

	[Cloneable]
	public function get readOnlyField():String {
		return _readOnlyField;
	}
}
}

package dolly {
public class ClassWithSomeCopyableFields {

	public static var staticProperty1:String;

	[Copyable]
	public static var staticProperty2:String;

	[Copyable]
	public static var staticProperty3:String;

	private var _writableField:String;
	private var _readOnlyField:String = "read-only field value";

	public var property1:String;

	[Copyable]
	public var property2:String;

	[Copyable]
	public var property3:String;

	public function ClassWithSomeCopyableFields() {
	}

	[Copyable]
	public function get writableField():String {
		return _writableField;
	}

	public function set writableField(value:String):void {
		_writableField = value;
	}

	[Copyable]
	public function get readOnlyField():String {
		return _readOnlyField;
	}
}
}

Change metadata tags to Copyable in test data class.


package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function get loaderContext() : LoaderContext
    {
      const result : LoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain))

      result.securityDomain = SecurityDomain.currentDomain

      return result
    }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    { debug("Failed to load <" + url + ">: " + event.text) }
  }
}

package goplayer
{
  import flash.display.Loader
  import flash.events.Event
  import flash.events.IOErrorEvent
  import flash.net.URLRequest
  import flash.system.ApplicationDomain
  import flash.system.LoaderContext
  import flash.system.SecurityDomain

  public class FlashContentLoadAttempt
  {
    private const loader : Loader = new Loader

    private var url : String
    private var listener : FlashContentLoaderListener

    public function FlashContentLoadAttempt
      (url : String, listener : FlashContentLoaderListener)
    {
      this.url = url, this.listener = listener

      loader.contentLoaderInfo.addEventListener
        (Event.COMPLETE, handleContentLoaded)
      loader.contentLoaderInfo.addEventListener
        (IOErrorEvent.IO_ERROR, handleIOError)
    }

    public function execute() : void
    { loader.load(new URLRequest(url)) }

    private function handleContentLoaded(event : Event) : void
    { listener.handleContentLoaded(loader.contentLoaderInfo) }

    private function handleIOError(event : IOErrorEvent) : void
    { debug("Failed to load <" + url + ">: " + event.text) }
  }
}

Remove custom LoaderContext creation code.


//
// Flump - Copyright 2012 Three Rings Design

package flump.export {

import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;

import flump.xfl.XflTexture;

public class PackedTexture
{
    public const holder :Sprite = new Sprite();
    public var tex :XflTexture;
    public var offset :Point;
    public var w :int, h :int, a :int;
    public var atlasX :int, atlasY :int;
    public var atlasRotated :Boolean;

    public function PackedTexture (tex :XflTexture, image :DisplayObject) {
        this.tex = tex;
        holder.addChild(image);
        const bounds :Rectangle = image.getBounds(holder);
        offset = new Point(bounds.x, bounds.y);
        w = Math.ceil(bounds.width);
        h = Math.ceil(bounds.height);
        a = w * h;
    }

    public function toString () :String {
        return "a " + a + " w " + w + " h " + h + " atlas " + atlasX + ", " + atlasY;
    }
}
}

//
// Flump - Copyright 2012 Three Rings Design

package flump.export {

import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.geom.Point;
import flash.geom.Rectangle;

import flump.xfl.XflTexture;

public class PackedTexture
{
    public const holder :Sprite = new Sprite();
    public var tex :XflTexture;
    public var offset :Point;
    public var w :int, h :int, a :int;
    public var atlasX :int, atlasY :int;
    public var atlasRotated :Boolean;

    public function PackedTexture (tex :XflTexture, image :DisplayObject) {
        this.tex = tex;
        holder.addChild(image);
        const bounds :Rectangle = image.getBounds(holder);
        image.x = -bounds.x;
        image.y = -bounds.y;
        offset = new Point(bounds.x, bounds.y);
        w = Math.ceil(bounds.width);
        h = Math.ceil(bounds.height);
        a = w * h;
    }

    public function toString () :String {
        return "a " + a + " w " + w + " h " + h + " atlas " + atlasX + ", " + atlasY;
    }
}
}

Move the images by their offset

Move the images by their offset


//
// $Id$
//
// Nenya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/nenya/
//
// 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.flex {

import flash.display.DisplayObject;

import mx.core.UIComponent;

/**
 * Wraps a non-Flex component for use in Flex.
 */
public class FlexWrapper extends UIComponent
{
    public function FlexWrapper (object :DisplayObject)
    {
        // don't capture mouse events in this wrapper
        mouseEnabled = false;
        addChild(object);
        width = object.width;
        height = object.height;
    }
}
}

//
// $Id$
//
// Nenya library - tools for developing networked games
// Copyright (C) 2002-2007 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/nenya/
//
// 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.flex {

import flash.display.DisplayObject;

import mx.core.UIComponent;

/**
 * Wraps a non-Flex component for use in Flex.
 */
public class FlexWrapper extends UIComponent
{
    public function FlexWrapper (object :DisplayObject, inheritSize :Boolean = false)
    {
        // don't capture mouse events in this wrapper
        mouseEnabled = false;
        addChild(object);
        if (inheritSize) {
            width = object.width;
            height = object.height;
        }
    }
}
}

Make this optional, and not the default.
Turns out a bunch of shit makes the wrapper size a little bigger,
and some things seem to freak out when the wrapper has a size,
even when includeInLayout=false.
Flex you very much.

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


package stdio {
  import flash.display.*
  import flash.utils.getQualifiedClassName
  import flash.utils.setTimeout

  public class Sprite extends flash.display.Sprite {
    public function Sprite() {
      stage.scaleMode = StageScaleMode.NO_SCALE
      stage.align = StageAlign.TOP_LEFT

      // Let the subclass constructor run first.
      setTimeout(initialize, 0)
    }

    private function initialize(): void {
      setup(loaderInfo, this, start)
    }

    private function start(): void {
      if ("main" in this && this["main"].length === 0) {
        this["main"]()
      } else {
        warn("Please write your main method like this:")
        warn("public function main(): void {}")
        process.exit(1)
      }
    }

    private function warn(message: String): void {
      process.warn(getQualifiedClassName(this) + ": " + message)
    }
  }
}

package stdio {
  import flash.display.*
  import flash.utils.getQualifiedClassName
  import flash.utils.setTimeout

  public class Sprite extends flash.display.Sprite {
    public function Sprite() {
      if (stage) {
        stage.scaleMode = StageScaleMode.NO_SCALE
        stage.align = StageAlign.TOP_LEFT
      }

      // Let the subclass constructor run first.
      setTimeout(initialize, 0)
    }

    private function initialize(): void {
      setup(loaderInfo, this, start)
    }

    private function start(): void {
      if ("main" in this && this["main"].length === 0) {
        this["main"]()
      } else {
        warn("Please write your main method like this:")
        warn("public function main(): void {}")
        process.exit(1)
      }
    }

    private function warn(message: String): void {
      process.warn(getQualifiedClassName(this) + ": " + message)
    }
  }
}

Fix bug preventing running processes recursively.


Scene@ newScene_;
Scene@ scene_;
Camera@ camera_;

void Start()
{
	StartScene("Scenes/Level1.xml");
	SubscribeToEvent("LevelComplete", "HandleLevelComplete");
}

void Stop()
{
}

void HandleLevelComplete(StringHash type, VariantMap& data)
{
	log.Debug("Level Complete. I should be loading "+data["NextLevel"].GetString());
	StartScene(data["NextLevel"].GetString());
}

void StartScene(String scene)
{
	newScene_ = Scene();
	newScene_.LoadAsyncXML(cache.GetFile(scene));

	SubscribeToEvent("AsyncLoadFinished", "HandleAsyncLoadFinished");
}

void HandleAsyncLoadFinished(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("AsyncLoadFinished");

	newScene_ = data["Scene"].GetPtr();

	SubscribeToEvent("Update", "HandleDelayedStart");
}

void HandleDelayedStart(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("Update");

	Node@ cameraNode = newScene_.GetChild("Camera", true);
	Camera@ newCamera = cameraNode.CreateComponent("Camera");

	Viewport@ viewport = Viewport(newScene_, cameraNode.GetComponent("Camera"));
	renderer.viewports[0] = viewport;

	scene_ = newScene_;
	camera_ = newCamera;
	newScene_ = null;
}

Scene@ newScene_;
Scene@ scene_;
Camera@ camera_;
Timer timer_;

void Start()
{
	StartScene("Scenes/Level1.xml");
	SubscribeToEvent("LevelComplete", "HandleLevelComplete");
}

void Stop()
{
}

void HandleLevelComplete(StringHash type, VariantMap& data)
{
	log.Debug("Level Complete. I should be loading "+data["NextLevel"].GetString());
	float timeTaken = timer_.GetMSec(false);
	log.Debug("You took " + timeTaken / 1000.f + " seconds to solve the level");

	StartScene(data["NextLevel"].GetString());
}

void StartScene(String scene)
{
	newScene_ = Scene();
	newScene_.LoadAsyncXML(cache.GetFile(scene));

	SubscribeToEvent("AsyncLoadFinished", "HandleAsyncLoadFinished");
}

void HandleAsyncLoadFinished(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("AsyncLoadFinished");

	newScene_ = data["Scene"].GetPtr();

	SubscribeToEvent("Update", "HandleDelayedStart");
}

void HandleDelayedStart(StringHash type, VariantMap& data)
{
	UnsubscribeFromEvent("Update");

	Node@ cameraNode = newScene_.GetChild("Camera", true);
	Camera@ newCamera = cameraNode.CreateComponent("Camera");

	Viewport@ viewport = Viewport(newScene_, cameraNode.GetComponent("Camera"));
	renderer.viewports[0] = viewport;

	scene_ = newScene_;
	camera_ = newCamera;
	newScene_ = null;

	timer_.Reset();
}

Add a level timer to the main procedure

Add a level timer to the main procedure


//
// $Id$

package com.threerings.flash {

import flash.display.Sprite;

import flash.events.Event;

/**
 * Convenience superclass to use for sprites that need to update every frame.
 * (One must be very careful to remove all ENTER_FRAME listeners when not needed, as they
 * will prevent an object from being garbage collected!)
 */
public class FrameSprite extends Sprite
{
    public function FrameSprite ()
    {
        addEventListener(Event.ADDED_TO_STAGE, handleAdded);
        addEventListener(Event.REMOVED_FROM_STAGE, handleRemoved);
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleAdded (... ignored) :void
    {
        addEventListener(Event.ENTER_FRAME, handleFrame);
        handleFrame(); // update immediately
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleRemoved (... ignored) :void
    {
        removeEventListener(Event.ENTER_FRAME, handleFrame);
    }

    /**
     * Called to update our visual appearance prior to each frame.
     */
    protected function handleFrame (... ignored) :void
    {
        // nothing here. Override in yor subclass.
    }
}

}

//
// $Id$

package com.threerings.flash {

import flash.display.Sprite;

import flash.events.Event;

/**
 * Convenience superclass to use for sprites that need to update every frame.
 * (One must be very careful to remove all ENTER_FRAME listeners when not needed, as they
 * will prevent an object from being garbage collected!)
 */
public class FrameSprite extends Sprite
{
    /**
     * @param renderFrameUponAdding if true, the handleFrame() method
     *        is called whenever an ADDED_TO_STAGE event is received.
     */
    public function FrameSprite (renderFrameUponAdding :Boolean = true)
    {
        _renderOnAdd = renderFrameUponAdding;

        addEventListener(Event.ADDED_TO_STAGE, handleAdded);
        addEventListener(Event.REMOVED_FROM_STAGE, handleRemoved);
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleAdded (... ignored) :void
    {
        addEventListener(Event.ENTER_FRAME, handleFrame);
        if (_renderOnAdd) {
            handleFrame(); // update immediately
        }
    }

    /**
     * Called when we're added to the stage.
     */
    protected function handleRemoved (... ignored) :void
    {
        removeEventListener(Event.ENTER_FRAME, handleFrame);
    }

    /**
     * Called to update our visual appearance prior to each frame.
     */
    protected function handleFrame (... ignored) :void
    {
        // nothing here. Override in yor subclass.
    }

    /** Should we call handleFrame() when we get ADDED_TO_STAGE? */
    protected var _renderOnAdd :Boolean;
}

}

Allow subclasses to choose not to call handleFrame() when
ADDED_TO_STAGE is received.

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


package org.servebox.cafe.core.application
{
	import org.servebox.cafe.core.spring.ApplicationContext;

	import spark.components.Application;

	public class Application extends spark.components.Application implements CafeApplication
	{
		private var _context : ApplicationContext;

		public function Application()
		{
			super();
			ApplicationInitializer.prepare( this );
			_context = ApplicationInitializer.getDefaultContext();
		}

		public function getContext():ApplicationContext
		{
			return null;
		}
	}
}

package org.servebox.cafe.core.application
{
	import org.servebox.cafe.core.spring.ApplicationContext;

	import spark.components.Application;

	public class Application extends spark.components.Application implements CafeApplication
	{
		private var _context : ApplicationContext;

		public function Application()
		{
			super();
			ApplicationInitializer.prepare( this );
			_context = ApplicationInitializer.getDefaultContext();
		}

		public function getContext():ApplicationContext
		{
			return _context;
		}
	}
}

Fix bug on getContext() null

Fix bug on getContext() null


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

	import org.apache.flex.core.IBead;
	import org.apache.flex.core.IStrand;
	import org.apache.flex.core.UIBase;

	public class SolidBackgroundBead implements IBead
	{
		public function SolidBackgroundBead()
		{
		}

		private var _strand:IStrand;

		public function get strand():IStrand
		{
			return _strand;
		}
		public function set strand(value:IStrand):void
		{
			_strand = value;
            IEventDispatcher(value).addEventListener("heightChanged", changeHandler);
            IEventDispatcher(value).addEventListener("widthChanged", changeHandler);
		}

		private var _backgroundColor:uint;

		public function get backgroundColor():uint
		{
			return _backgroundColor;
		}
		public function set backgroundColor(value:uint):void
		{
			_backgroundColor = value;
			if (_strand)
				changeHandler(null);
		}

		private function changeHandler(event:Event):void
		{
            var host:UIBase = UIBase(_strand);
            var g:Graphics = host.graphics;
            var w:Number = host.width;
            var h:Number = host.height;
            g.clear();
            g.beginFill(backgroundColor);
            g.drawRect(0, 0, w, h);
            g.endFill();
		}
	}
}

Add bead to draw solid background

Add bead to draw solid background


/* -*- Mode: java; indent-tabs-mode: nil -*- */
/*
   Compiled with:
   java -jar utils/asc.jar -import playerglobal.abc -swf Template,100,100,10 test/swfs/test_TemplateTest.as

   This template is for writing test SWFs using pure AS3. It allows for testing
   UI events, screen and program state using the Shumway test harness.
*/

package {

    import flash.display.Sprite;
    import flash.events.Event;

    public class TemplateTest extends Sprite {
        public var loader;
        public function TemplateTest() {
            var child = new TestObject();
            addChild(child);
            addEventListener(Event.ENTER_FRAME, child.enterFrameHandler);
        }
    }
}

import flash.display.*;
import flash.events.*;
import flash.net.*;

class TestObject extends Sprite {
    private var color: uint = 0xFFCC00;
    private var pos: uint   = 10;
    private var size: uint  = 80;

    /*
      In the constructor, install event listeners for testing events, and
      construct and add child objects.
    */
    public function TestObject() {
    }

    private var frameCount = 0;

    /*
      In the enterFrameHandler, make API calls per frame to test both
      screen and program side-effects.
    */
    function enterFrameHandler(event:Event):void {
        frameCount++;
        var target = event.target;
        var loader = target.loader;
        switch (frameCount) {
        case 1:
            (function () {
                /*
                  Log test results in the standard format shown here to allow
                  for easy linking with monitor programs.
                */
                var result = true ? "PASS" : "FAIL";
                trace(result + ": test::Template/method ()");
                trace(result + ": test::Template/get name ()");
                trace(result + ": test::Template/set name ()");
            })();
            break;
        default:
            /*
              Remove enterFrameHandler when done.
            */
            parent.removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
            break;
        }
    }
}

Add template for writing SWF unit tests

Add template for writing SWF unit tests


package Classes
{
	public class Textbox
	{
		public var contents:String;

		public function Textbox()
		{
			contents="";
		}
		public function Textbox(text)
		{
			contents=text;
		}
		public setContents(text)
		{
			contents=text;
		}
	}
}

Create a dummy textbox class for the sole purpose of writing the XML loader


// Http request example.
// This example demonstrates:
//     - How to use Http request API

#include "Scripts/Utilities/Sample.as"

String message;
Text@ text;
HttpRequest@ httpRequest;

void Start()
{
    // Execute the common startup for samples
    SampleStart();

    // Create the user interface
    CreateUI();

    // Set the mouse mode to use in the sample
    SampleInitMouseMode(MM_FREE);

    // Subscribe to basic events such as update
    SubscribeToEvents();
}

void CreateUI()
{
    // Construct new Text object
    text = Text();

    // Set font and text color
    text.SetFont(cache.GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15);
    text.color = Color(1.0f, 1.0f, 0.0f);

    // Align Text center-screen
    text.horizontalAlignment = HA_CENTER;
    text.verticalAlignment = VA_CENTER;

    // Add Text instance to the UI root element
    ui.root.AddChild(text);
}

void SubscribeToEvents()
{
    // Subscribe HandleUpdate() function for processing HTTP request
    SubscribeToEvent("Update", "HandleUpdate");
}

void HandleUpdate(StringHash eventType, VariantMap& eventData)
{
    // Create HTTP request
    if (httpRequest is null)
        httpRequest = network.MakeHttpRequest("http://httpbin.org/ip", "GET");
    else
    {
        // Initializing HTTP request
        if (httpRequest.state == HTTP_INITIALIZING)
            return;
        // An error has occured
        else if (httpRequest.state == HTTP_ERROR)
        {
            text.text = "An error has occured.";
            UnsubscribeFromEvent("Update");
        }
        // Get message data
        else
        {
            if (httpRequest.availableSize > 0)
                message += httpRequest.ReadLine();
            else
            {
                text.text = "Processing...";

                JSONFile@ json = JSONFile();
                json.FromString(message);

                JSONValue val = json.GetRoot().Get("origin");

                if (val.isNull)
                    text.text = "Invalid string.";
                else
                    text.text =  "Your IP is: " + val.GetString();

                UnsubscribeFromEvent("Update");
            }
        }
    }
}

// Create XML patch instructions for screen joystick layout specific to this sample app
String patchInstructions =
        "<patch>" +
        "    <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">" +
        "        <attribute name=\"Is Visible\" value=\"false\" />" +
        "    </add>" +
        "</patch>";

Add AngelScript Http Request demo sample.


package
{
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.net.XMLSocket;

    public class swfcat extends Sprite
    {
        private var output_text:TextField;

        private function puts(s:String):void
        {
            output_text.appendText(s + "\n");
        }

        public function swfcat()
        {
            output_text = new TextField();
            output_text.width = 400;
            output_text.height = 300;
            output_text.background = true;
            output_text.backgroundColor = 0x001f0f;
            output_text.textColor = 0x44CC44;
            addChild(output_text);
        }
    }
}

Add a simple terminal-like output.

Add a simple terminal-like output.


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

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

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

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

package org.windmill {
  import flash.display.Sprite;
  import flash.display.Stage;
  import org.windmill.WMAssert;
  public class TestCase extends Sprite {
    public var asserts:* = WMAssert;
    // Get a reference to the Stage in the base class
    // before the tests actually load so tests can all
    // reference it
    private var fakeStage:Stage = Windmill.getStage();
    override public function get stage():Stage {
      return fakeStage;
    }
  }
}

Test case base class -- all AS test classes extend this.


package unittests
{
	public class TestEquivalence
	{
		[Before]
		public function setUp():void
		{
		}

		[After]
		public function tearDown():void
		{
		}

		[BeforeClass]
		public static function setUpBeforeClass():void
		{
		}

		[AfterClass]
		public static function tearDownAfterClass():void
		{
		}

	}
}

Add stub class for Equivalence class testing


package aerys.minko.render.effect.vertex
{
	import aerys.minko.render.RenderTarget;
	import aerys.minko.render.effect.basic.BasicShader;
	import aerys.minko.render.shader.SFloat;
	import aerys.minko.type.stream.format.VertexComponent;

	public class VertexUVShader extends BasicShader
	{

		public function VertexUVShader(target 	: RenderTarget 	= null,
									   priority	: Number		= 0)
		{
			super(target, priority);
		}

		override protected function getPixelColor() : SFloat
		{
			var uv 				: SFloat = getVertexAttribute(VertexComponent.UV);
			var interpolatedUv 	: SFloat = normalize(interpolate(uv));

			return float4(interpolatedUv.x, interpolatedUv.y, 0, 1);
		}

	}
}

Add VertexUvShader (vertex streams must have an uv component)


package dolly.utils {
import dolly.core.dolly_internal;

import mx.collections.ArrayCollection;
import mx.collections.ArrayList;

use namespace dolly_internal;

public class PropertyUtilTests {

	private var sourceObj:Object;
	private var targetObj:Object;

	[Before]
	public function before():void {
		sourceObj = {};
		sourceObj.array = [0, 1, 2, 3, 4];
		sourceObj.arrayList = new ArrayList([0, 1, 2, 3, 4]);
		sourceObj.arrayCollection = new ArrayCollection([0, 1, 2, 3, 4]);

		targetObj = {};
	}

	[After]
	public function after():void {
		sourceObj = targetObj = null;
	}
}
}

Add empty test for PropertyUtil class.

Add empty test for PropertyUtil class.


/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (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.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is [Open Source Virtual Machine.].
 *
 * The Initial Developer of the Original Code is
 * Adobe System Incorporated.
 * Portions created by the Initial Developer are Copyright (C) 2007-2008
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Adobe AS3 Team
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */
/**
   Description:
   Runtime specialization
   Specialization of the Vector type can be done at runtime
   instead of at compile time.
*/

function getVector() { return Vector; }

var CODE = 1007; //  Instantiation attempted on a non-constructor.

startTest();
var TITLE="Runtime specialization";
writeHeaderToLog(TITLE);

var x = getVector().<int>;
y = new x();

y.push(1);
y.push(2);
y.push(3);

AddTestCase(    "Vector constructed via runtime specialization",
                3,
                y.length);

AddTestCase(    "Vector constructed via runtime specialization",
                2,
                y[1]);

var neg_result = "Failed to catch invalid construct";

try {
   unspecialized = getVector();
   var z = new unspecialized();
} catch ( ex )
{
    neg_result = String(ex);
}

AddTestCase ( "Invalid use of unspecialized type in constructor", TYPEERROR + CODE,  typeError(neg_result));

test();

Fix 525654 - added test for runtime Vector specialization


package dolly {

import dolly.core.dolly_internal;
import dolly.data.PropertyLevelCopyableCloneableClass;

import org.as3commons.reflect.Type;

use namespace dolly_internal;

public class CloningOfPropertyLevelCopyableCloneableClassTest {

	private var propertyLevelCopyableCloneable:PropertyLevelCopyableCloneableClass;
	private var propertyLevelCopyableCloneableType:Type;

	[Before]
	public function before():void {
		propertyLevelCopyableCloneable = new PropertyLevelCopyableCloneableClass();
		propertyLevelCopyableCloneable.property1 = "property1 value";
		propertyLevelCopyableCloneable.writableField1 = "writableField1 value";
		propertyLevelCopyableCloneableType = Type.forInstance(propertyLevelCopyableCloneable);
	}

	[After]
	public function after():void {
		propertyLevelCopyableCloneable = null;
		propertyLevelCopyableCloneableType = null;
	}

	/**
	 * Cloner.findingAllWritableFieldsForType() method will throw CloningError in this case
	 * because PropertyLevelCopyableCloneableClass class is not cloneable indeed.
	 */
	[Test(expects="dolly.core.errors.CloningError")]
	public function findingAllWritableFieldsForType():void {
		Cloner.findAllWritableFieldsForType(propertyLevelCopyableCloneableType);
	}

	/**
	 * Cloner.clone() method will throw CloningError in this case
	 * because PropertyLevelCopyableCloneableClass class is not cloneable indeed.
	 */
	[Test(expects="dolly.core.errors.CloningError")]
	public function cloningByCloner():void {
		Cloner.clone(propertyLevelCopyableCloneable);
	}

	/**
	 * Method clone() will throw CloningError in this case
	 * because PropertyLevelCopyableCloneableClass class is not cloneable indeed.
	 */
	[Test(expects="dolly.core.errors.CloningError")]
	public function cloningByCloneFunction():void {
		clone(propertyLevelCopyableCloneable);
	}
}
}

Test class for cloning of PropertyLevelCopyableCloneableClass.