• Home
  • Contact
  • Careers
  • Socialize With Us:
  • Send us Mail
  • Follow us on Twitter
  • Join our Facebook Group
  • /
  • Linkedin
  • /
  • Vimeo Videos
  • /
  • Youtube
  • /
  • RSS Feed
  • Search Site

  • About UsAwards & Bio
  • PortfolioOur Latest Work
  • TrainingTips & Tutorials
  • BlogGreat Articles

You are here: Home / News / Industry News / ActionScript 4.0 Revealed

ActionScript 4.0 Revealed

Category: Industry News     |     Tags: AS3, Flash

Over the past year I’ve been learning more HTML5 frameworks. Frequent leaders of our site here may remember I’ve done some analysis on HTML5 Game Frameworks as well as HTML5 App Frameworks. A major significant lack in the HTML5 ‘solution’ is the limitations of JavaScript. I was delighted to come across the official Adobe Roadmap (See ‘Members Resources’ below) for the FlashPlatform. An exciting inclusion in the roadmap is what’s up for “ActionScript Next” (Codename) or as I choose to call it ActionScript 4.0.

UPDATE (January 30th, 2013): ActionScript “Next” (aka 4.0 as I call it here) has been explicably removed from the Adobe Roadmap.

UPDATE (June 15th, 2012): Adobe announces the plan for concurrency in Flash Player and AIR – Workers.

ActionScript 4

The range of applications and content for ActionScript has shifted significantly in recent years, while the ActionScript 3 language remains virtually unchanged since its introduction in 2006. Adobe believes it is time to revise the language to carefully steer its further evolution towards greater expressiveness as well as productivity and performance gains.

From a language design standpoint, Adobe uses the following assumptions as a guide for next-generation ActionScript development:

  • Increasing demand for long-term productivity benefits such as robustness, modularity, and maintainability to complement shorter-term productivity benefits characteristic of scripting languages, such as speed of development
  • Demand for high performance increases
  • Demand for hardware utilization increases

First, Adobe plans to make significant performance increases in the short term with a goal of continuing performance improvements over the long term. Performance is the primary goal when we approach how to evolve ActionScript. Second, Adobe aims to increase developer productivity by simplifying the language, improving tool support, and boosting bug prevention. Finally, having reduced unnecessary complexity, we will be in a position to innovate within the Flash runtimes much more quickly.

Features Currently In Discussion;

  • Stringent static typing as default, with optional dynamic typing: Most stretches of most programs are expected to benefit from static typing. However, ActionScript 3 tends to lapse into dynamic typing all too easily in places where absolutely stringent static typing would be preferable. This will be corrected. Dynamic typing will still be available when needed, but it will no longer be the default for ActionScript, and it will need to be enabled explicitly.
  • Type inference: Type declarations will only be necessary in certain strategic places. Everywhere else the compiler will automatically infer suitable type declarations and treat the whole program as statically typed, even though the programmer does not have to state any types. Thus the convenience of untyped programming can be approximated quite well, while providing the performance advantages of typed programming.
  • Hardware-oriented numeric types: For example, int , uint , float , float4 , byte , short , long , etc. (the exact set of types is still under discussion). Currently in ActionScript 3 integer values can overflow into floating point values. This will be changed so that numeric operations will never change the underlying representation of the numeric. We foresee this addition greatly reducing implementation complexity and improving runtime performance.

These are just a couple of areas that we are focusing on. We will update this document as our thinking evolves and solidifies around how the language and virtual machine will change.

Compatibility

Its is stated that AS4 will not be completely compatible with AS3. So maybe there will be a compiler option and one must choose EITHER one or the other (similar to the mutual exclusive option between AS3 and AS2. Depending on the amount of changes in AS4 we may see a new virtual machine inside the player designed to run only the AS4. Currently there are two VM’s – one for AS3 and one for older ActionScript.

Wishlist

Many developers have been dreaming (ex. here & here) of features for ActionScript for ages. Some features I would love to see;

  • Abstract Classes with Abstract Methods (ASL-18) – Well, do I have to have to say something about that wish? Basically abstract classes are such an essential thing, I am still wondering how Action Script made it to 3.0 without them. Just documenting which Methods must be overridden is not enough. And the known workarounds are really… well… hm… forget it – this is a compiler thing, which cannot be checked at runtime.
  • Generics (FP-811) – The Vector class is a good start – but it’s not well supported in Flex 3 (keyword: data binding) and it’s not a generic concept. There should be something like Generics in Java that provide type checking at compile time, but can also be used for any custom class, just like in Java.
  • Enums – While I have a (almost) perfect workaround for Enums in AS3, it would be great to see native language support.
  • Singletons – I have a fantastic workaround for Singletons in AS3
  • Improved ‘Event Listener’ syntax and performance. I like the features offered by the AS3-Signals project.
  • Operator Overloading (ASL-10) – Still missing it in Java and this is, where Action Script could actually beat Java. I don’t want to have another equals method for comparing arbitrary classes for equality – I want to be able to simply override the == operator to be able to compare any two objects for equality. Or the + operator for concatenating two data structures. Just like in C++ or smalltalk.
  • Method Overloading (ASL-9) – While ActionScript provides an easy way to simplify methods with long parameter lists using default values for parameters it’s not enough to justify not having method overloading. I do not want to have to write methods like doSomethingWithString(value:String), doSomethingWithInt(value:int), doSomethingWithObjectA(value:ObjectA),…

ActionScript 4.0 Code Samples (A Proposal)

AbstractClassDemo

package
{
	//class must be subclassed before instantiation
	abstract public class AbstractClassDemo
	{
		public function AbstractClassDemo()
		{
		}
	}
}

AbstractMethodDemo

package
{
	public class AbstractMethodDemo
	{
		public function AbstractMethodDemo()
		{
		}

		//Method must be overridden before usage
		abstract public function sampleMethod () : void
		{
		}
	}
}

DestructorDemo

package
{
	public class DestructorDemo
	{
		//constructor
		public function DestructorDemo()
		{
		}
		//destructor, called upon instance deletion
		public function ~DestructorDemo()
		{
		}
	}
}

Enums

package
{
	public enum EnumSample
	{
		ENUM_SAMPLE_A;
		ENUM_SAMPLE_B;
	}
}

 

package
{
	public class EnumDemo
	{
		public function EnumDemo()
		{
			trace (ENUM_SAMPLE_A); //[EnumSample ENUM_SAMPLE_A]
			trace (ENUM_SAMPLE_B); //[EnumSample ENUM_SAMPLE_B]
			trace (ENUM_SAMPLE_A is EnumSample); //true
                        trace (ENUM_SAMPLE_A is EnumSample); //true
                        trace (ENUM_SAMPLE_A == ENUM_SAMPLE_B); //false
		}
	}
}

GenericsDemo

package
{
	public class GenericsDemo <AGE_TYPE, NAME_TYPE>
	{
		private var _age  : AGE_TYPE;
		private var _name : NAME_TYPE;

		public function GenericsDemo(AGE_TYPE : aAge, NAME_TYPE, aName)
		{
			_age 	= aAge;
			_name 	= aName;

			//Later, in use, declare types at runtime for the generic
			//var genericsDemo : GenericsDemo<Float,String> = new GenericsDemo<Float,String> (10.0, "Flash");
		}
	}
}

MethodOverloadingDemo

package
{
	public class MethodOverloadingDemo
	{
		public function MethodOverloadingDemo()
		{

			//The implementation of this AS3 Syntax
			//	can now be overloaded in AS34
			_sampleMethod();
			_sampleMethod(10.0);
			_sampleMethod("10.0");
		}

		/**
		 *
		 * @return void
		 *
		 */
		override public function _sampleMethod () : void
		{
			trace ("Parameters - None");
		}

		/**
		 *
		 * @return void
		 *
		 */
		override public function _sampleMethod (aValue_float : Float) : void
		{
			trace ("Parameters - Float: " + aValue_float);
		}

		/**
		 *
		 * @return void
		 *
		 */
		override public function _sampleMethod (aValue_str : String) : void
		{
			trace ("Parameters - string: " + aValue_string);
		}

	}
}

NumericTypesDemo

package
{
	public class NumericTypesDemo
	{
		public function NumericTypesDemo()
		{
			//specificity helps ram usage
			var sample_int 		: int 	= 10;
			var sample_uint 	: uint 	= 10;
			var sample_float 	: Float = 10.0;
			var sample_float4 	: Float4= 10.0;
			var sample_byte 	: Byte 	= 1;
			var sample_short 	: Short = 10;
			var sample_long		: Long 	= 10;
		}
	}
}

OperatorOverloadingDemo

package
{
	public class OperatorOverloadingDemo
	{
		public function OperatorOverloadingDemo()
		{
			//The implementation of this valid AS3 Syntax
			//	can now be overloaded in AS34
			this +  10.0;
			this -  10.0;
			this * 	10.0;
			this /  10.0;
			this == 10.0;
			this += 10.0;
			this -= 10.0;
			this *= 10.0;
			this /= 10.0;

			//Etc...

		}

		/**
		 * Add
		 *
		 * @return Float
		 *
		 */
		override public function operator== (aValue_float : Float) : Float
		{
			//	Mimic default implementation
			if (super.operator==(aValue_float) ) {
				return true;
			} else {
				return false;
			}
		}

		/**
		 * Add
		 *
		 * @return Float
		 *
		 */
		override public function operator+ (aValue_float : Float) : Float
		{
			//	Mimic default implementation
			this = super.operator+(aValue_float);
			return this.toFloat();
		}

		/**
		 * Etc...
		 *
		 *
		 */

	}
}

SingletonDemo

package
{
	public class SingletonDemo
	{
		//private constructor mean 'Singleton'
		private function SingletonDemo()
		{
		}
	}
}

StaticTypingDemo

package
{
	public class StaticTypingDemo
	{
		public function StaticTypingDemo()
		{
			//compiler determines type by default
			var sample1 = 10;
			trace ("sample1: " + sample1); 	//10
			trace (sample1 is uint); //true

			var sample2 = -10;
			trace ("sample2: " + sample2); 	//-10
			trace (sample2 is int); //true

			var sample3 = 10.0;
			trace ("sample3: " + sample3); 	//10.0
			trace (sample3 is Float); 		//true

			//dynamic type in strategic places
			var sample4 : int = 10.0 as int;
			trace ("sample4: " + sample4); 	//10
			trace (sample4 is int); 		//true

		}
	}
}

Next Steps

  • What would you like to see in AS4? Comment below!
  • Download the Official Adobe Roadmap for Flash / ActionScript 4.0 (See ‘Member Resources’ below)

Member Resources

'Free Member'-Only Content

You must be a 'Free Member' to see this content. With your access you will enjoy members-only content like this, HD video tutorials, and access to complete source code.

Ready To Join?
  • Sign up for 'Free Member' level now. Its free!
  • Sign up for 'Paid Member' level to enjoy much, much more! (Invite Only)
Already A Free Member?
  • Log in and enjoy!

17 Responses to ActionScript 4.0 Revealed

  1. jloa says:
    February 23, 2012 at 8:02 pm

    I would like to add to your wishlist: destructors and float (data type)

    Reply
  2. Andre Staltz says:
    February 24, 2012 at 10:07 pm

    I think another item in the wishlist should be multithreading. Come on, this is basic, and such a simple thing has cost me a lot of sweat when I absolutely needed it. I _HAD_ to mimic threading using some pseudothreading tricks that were not trivial.

    Reply
    • Matthew Fabb says:
      May 9, 2012 at 3:17 pm

      Adobe has already been demoing multithreading examples coming in a future version of the Flash Player and long before they do a revamp of ActionScript. ActionScript worker threads will be part of ActionScript 3.0.

      Reply
  3. Satyarth says:
    February 25, 2012 at 5:45 pm

    Well Couple of things extremely important to me:

    – Must be backward compatible. So libraries written in AS3 should work without problem with AS4 code. I have noticed that Adobe products ( Flash in particular ) fails to be backward compatible.

    – Multithreading support

    – More power for developer for memory management and garbage collection. Developer friendly garbage collection.. no magic tricks please

    I have been working on Flash Platform using Actionscript 3 for 5 yrs and I do have a long wishlist . But above are most critical for my needs.

    Reply
  4. Matthew Fabb says:
    May 9, 2012 at 3:26 pm

    “…or as I choose to call it ActionScript 4.0″

    Note this might be ActionScript 4.0, however some at Adobe MAX it was suggested that while these changes are far reaching to the language, that the update might be branded ActionScript 3.x (3.1? 3.5?). It sounded like it will be more up to marketing what they end up calling it.

    Beyond that great article.

    Reply
  5. xlifes says:
    May 9, 2012 at 3:28 pm

    http://www.adobe.com/devnet/flashplatform/whitepapers/roadmap.html

    Reply
  6. Mike Chambers says:
    May 9, 2012 at 9:32 pm

    Just an FYI, but nowhere have we called the next version of ActionScript “ActionScript 4″. We are referring to it right now as ActionScript “Next” and in general, it is going to be an evolution of AS3, and not a jump like there was between AS1 to 2 and to 3.

    Reply
  7. hayesmaker says:
    May 10, 2012 at 12:09 am

    Which is why the author of the article said he choose to call it AS4

    Reply
  8. Elliot Geno says:
    May 11, 2012 at 2:58 pm

    I would love to see a liquid layout API inherent to the DisplayList. (So that it could be used within the IDE and programmatically)

    Think of the following properties (top, left, right, and bottom) that could be assigned a “Guide” object.

    A Guide is a dimension. It defines left or right or up and down relationships within a container and what units they use.

    Each container will have an object similar to scale9Grid but for defining bounds. “liquidRect” or “liquidBounds” property could be set to any rectangle relative to inside the container. It would default to the getBounds of the object.

    Guides could also have SubGuides. Which are relative to Guides instead of LiquidRect.

    This would allow you to have a guide at 30% of the stage with a sub guide offset -10 pixels.

    A button’s left property could be anchored to the sub guide. Resizing the stage would automatically realign that object to 10 pixels less than 30% of the width of the stage!

    Best of all, designers can do most of the work for you! They can set up the rules fairly easily in the IDE and publish a SWC for you!

    Reply
  9. Victor Lehman says:
    May 30, 2012 at 10:59 am

    - scopes other than public in interface definitions
    - compile time safe “annotations”
    - C# style delegates (that is functions signatures as types)
    - Generics

    Reply
  10. Lejdi Koci says:
    June 25, 2012 at 4:28 pm

    Multithreading please !!! It would be so nice to have its power at hands :)

    Reply
  11. Nshen says:
    August 9, 2012 at 2:08 pm

    ~Destructor will be called when gc works?

    Reply
  12. Jeff Spicer says:
    November 2, 2012 at 10:32 am

    If theyre going to redo a markup language based on as4, picking consistent nomenclature across all components’ attributes would be helpful for rapid development and maintenance. stuff like using -ing for persistant events, -able for booleans that ascribe potential states and is- for booleans which are actual states, -ed for state change events, start() for sequences instead of sometimes start() sometimes play(), using more getters and setters instead of functions with odd parameters. Initialized instead of initialize, created instead of creationcomplete, displayed instead of show; clicked; frameentered; isPlaying instead of playing();

    Id like to see a trickleEvent so we dont have to use third party frameworks

    integration with stage 3d

    Indexedarraycollection

    A datagrid that works for practical application

    More utilities and easy to find documentation so you know the utilities exist

    Reply
  13. Eugene says:
    December 27, 2012 at 6:07 pm

    Typed associative arrays must have!!! Vector is typed but has only integer indexes. Standard AS3 array has String indexes but not typed. I need normal static typed language like Haxe or Java. AS3 good but has dynamic typing in some places. One of this cases is Array. I would like this in AS4:

    var a:Array.<MyClass> = new Array.<MyClass>();

    Reply
    • Ramod says:
      February 25, 2013 at 9:36 pm

      I thought they had that already with the VECTOR CLASS

      Reply
  14. Tahir Alvi says:
    January 19, 2013 at 10:35 am

    Good news, So when this version is available approximately in Flex.

    Reply
  15. Vasiliy says:
    March 29, 2013 at 6:21 am

    //request 1;==============================
    //function parameters by reference;

    function f( i *int )
    {
    i++;
    }

    var a:int = 10;
    f(a);
    trace (a); //result 11;

    //request 2 ======================
    //remove method for Array, workable in for each block;

    var a:Array;
    for each (var e:Element in a)
    {
    if(e.needRemove)
    {
    a.remove(element);
    }
    }

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Free Member Login

You are not currently logged in.






» Register
» Lost your Password?

Support Our Sponsors

Category

  • Industry News
  • Standards & Best Practices
  • Full Tutorials
  • RMC News
  • Events

Tag

3D AIR API AS3 AS3.5 Business Debugging Experimental Flash Flex Games HTML5 Java Loom Mobile Optimization Project Planning PushButtonEngine Robotlegs Smash Unity3D WordPress WordPress Plugin

Brazilean Developers

  • Abendita.com
  • dclick.com.br
  • dm9.com.br
  • Fellyph Cintra
  • IgorCosta.org
  • MonadaSolucoes.com.br
  • PossibleWorldwide.com.br
  • Unit9.com

Developers

  • Adobe Blogs
  • Ben Forta
  • Colin Moock
  • Enrique Duvos
  • Flash Mobile Blog
  • Jess Freeman
  • Kevin Hoyt
  • Lee Brimelow
  • Paul Trani
  • Quasimondo
  • Renaun Erickson
  • Ryan Stewart

Free Assets

  • Free Sounds
  • HasGrafics

HTML5 Games

  • Closure JS Library
  • Eloquent JS Manual
  • Game Framework – CraftyJS
  • Game Framework – EaselJS

Italian Developers

  • alchimedia.com
  • corlan.org/
  • creativesource.it
  • dimix.it
  • fabiobiondi.com
  • gnstudio.com
  • Interpreting-tech.com/bemobile/
  • leonardorisuleo.info
  • lucamascaro.info
  • mart3.org
  • mxml.it
  • nxn.it
  • pirosoft.it
  • Preload.it
  • sonnati.wordpress.com/
  • webgriffe.com

Products

  • Adobe.com
  • Amazon Kindle E-Reader
  • ElectroServer
  • F*CSS
  • Flash Development Toolkit (FDT)
  • O'Reilly PureMVC Book
  • Samsung Galaxy Tablet
  • Unity3D

RMC

  • RMC Consulting

Spanish Developers

  • Flash Adictos
  • HTML Cinqo
  • Tutoriales Flash

Tutorial

  • Active Tuts
  • AS3-to-Unity3D Training Videos
  • Doing 2D in Unity3D
  • Learning C#
  • Unity3D Tutorials

Unity3D Games

  • AS3-to-Unity3D Training Videos
  • Doing 2D in Unity3D
  • Learning C#
  • Matt Eley's Blog
  • Unity3D
  • Unity3D Tools
  • Unity3D Tutorials

I Am Great!

   

Latest Portfolio

  • Live Media Steaming ApplicationMay 20, 2013, 5:06 am
  • Museum Kiosk Touch ScreenNovember 15, 2012, 9:00 pm
  • Happy Birthday Mobile AppMarch 14, 2012, 5:55 pm
  • Official Robotlegs MVCS DiagramFebruary 24, 2012, 1:36 am

Latest News

  • Intro to Loom Game EngineMay 19, 2013, 6:48 am
  • Cross Platform Mobile: Free TalkDecember 21, 2012, 7:14 am
  • Cross Platform Mobile: Premium TrainingDecember 20, 2012, 7:41 am
  • Must-Have Non-Functional RequirementsDecember 14, 2012, 4:05 am

Latest Tweets (@srivello)

  • The internet in Kuala Lumpur at 6Mbps is a totally different product than at the typical 1Mbps of archipelagic Asia. http://t.co/EV010rXILx
  • Very inspired by the #XBoxOne. The presentation's focus on non-game features is both bold and a bit scary as a gamer.
  • 3 hours into my Centipede clone using #2DToolkit for #Unity3D http://t.co/5yWsMQvHEU
  • @pixelplacement I've seen 'iTween Parameter Code Hinting' but anyone done a completely strong-typed (no hash) version of iTween?

© Copyright 2006 - 2013 - Rivello Multimedia Consulting - Flash / HTML5 / Unity3D Game And App Development With Tutorials