Austin Kottke's Code Site

Thoughts about Architecture – Java, C/C++, JS, Objective-C, Swift, Groovy, Grails, (RIP Flash)
Archive for the ‘actionscript’ Category

I would like to get feedback from developers from using Adobe’s Mobile Development toolset, particularly in flex sdk 4.5. Can some developers provide some pros and cons in using it? Speed of performance, android phones, tablets. Also, Ive tried some apps on an Iphone 3GS and found them really slow. How is the speed now? What can and cant be done?

So, Im always digging into new frameworks and trying to understand the philosophies behind why developers chose to make new frameworks to help others. After falling in love with the new [Inject] metatag and thinking it’s the coolest thing since Java has been doing this for years anyway with Annotations, I thought this framework must be rad =) So after hours of looking at the documentation, the one thing I found out and is the bane of all robot legs development is CLASS NAMING. Lord have mercy, there is a base class called “Actor” – THATS THE NAME OF THE CLASS. Ok, so after reading GoF and all these development books over the years the one thing that java/flex/flash developers have a huge problem is is correctly conveying the names of classes. Conceptually representing something. With that said “ACTOR” is the worst name for a class ever – I mean, it communicates absolutely nothing! The concept is so ambiguous and it hurts just thinking about it. And it’s used EVERYWHERE. PureMVC atleast names the classes by common design patterns so it’s clear to everyone using it if you’ve studied these patterns. Lord have mercy – can we just get a pure mvc framework with an [Inject] meta tag? Ill be happy then =)

Something that I think should be done for the flash player, now that HTML 5 is gaining ground, is an inline HTML renderer that should be packaged as part of the download. Potentially it could be an optional download. I mean the core code base is already a part of the AIR packager. How hard would it be to make an external RSL that gets cached or make it part of the flash player 11 installation with a checkbox to download this in addition. If there is an update to the web kit renderer, it then flags this in the flashplayer download manager… Just a thought to make flash player 11 completely blow away. We’ve got 3d support, but how about a little HTML 5 renderer as part of the flash player?

Well, Ive used this logger a million times and thought it would be useful to let others take a look. The main thing this class supports is FILTERING, which is something that a lot of log classes do not have which I find problematic when dealing with a very large project or want to debug on a live server. Check it out: package com.adk.util { import; import; import; import; import flash.utils.*; /**======================================================================= * * Generic logger that provides filtering so you can specify exactly * classes that should be traced out. You do this by adding in a filter * for a specific class using the logger xml file. * * NOTE: * * Load in the logger xml file by listening for the LOADED event * before dispatching and using logging statements. * * @example * *         var logger:FlashLogger = FlashLogger.getLogger( this, “” ); *             logger.addEventListener( FlashLogger.LOADED, onLoggerLoad ); * *        public function onLoggerLoad( event:Event ):void *        { *            var logger:FlashLogger = FlashLogger.getLogger( this ); *            logger.debug(“Test”, “param2”); *        } * * * Specify log filters in logger.xml: * * <?xml version=”1.0″ ?> * <Logger logLevel=”DEBUG”> * <filters>com.adobe, com.adk.util</filters> * </Logger> * * You can add as many filters you want and specify the log level. * * @author Austin Kottke *=======================================================================*/ public class FlashLogger extends EventDispatcher { /*============================================================================ * Events and log types. *============================================================================*/ public static var NONE : uint = 0; public static var INFO : uint = 1; public static var DEBUG : uint = 2; public static var WARN : uint = 3; public static var ERROR : uint = 4; public static var FATAL : uint = 5; /*============================================================================ * Variables *============================================================================*/ public static var LOG_TYPES : Array; private static var logLevel : int; private static var filters : Array = new Array(); private static var filtersLoaded : Boolean = false; private static var created : Boolean = false; public var className : String ; /*============================================================================ * EVENTS *============================================================================*/ public static var LOADED : String = “xmlLoaded”; /********************************************************************************** * Adds in a new filter * * @param aString Adds in a new filter for the logger. **********************************************************************************/ public function addFilter( aString : String ) { FlashLogger.filters.push(aString); trace(“FlashLogger.addFilter(” + aString + “)”); } /********************************************************************************** * Checks if the class is in the filter. * * @return true or false if the class is in the filter or if there are no filters. **********************************************************************************/ private function isClassInFilter( aClassName : String ) : Boolean { for ( var i : Number = 0;i < filters.length;i++ ) if ( aClassName.indexOf(filters[i]) >= 0 ) return true; if ( filters.length == 0 ) return true; return false; } /********************************************************************************** *  Constructor **********************************************************************************/ public function FlashLogger( aClassName : String, loggerXMLPath : String ) { className = aClassName; if ( !created ) { FlashLogger.LOG_TYPES = new Array(“NONE”, “INFO”, “DEBUG”, “WARN”, “ERROR”, “FATAL”); setLogLevel(DEBUG); created =…

As I look more and more at the industry trends, we see more and more handheld devices being developed, that’s a no brainer. More and more devices, such as the android, sidekick, blackberry and iphone have some form of a web browser. Just the other day I was walking outside and I saw atleast 4 young kids with sidekicks, a blackberry and a couple with an iphone. Now when we look at trends we see that the majority of people browse with their own personal computers, but as the future progresses more and more people will be using their mobile devices to browse the web. Of the 4 different devices I mentioned NONE have the flash player, or are capable of viewing flash in a normal browsing environment. Now, I’ve been developing flash applications for over 10 years, I started with flash 4. Used flex, and all variations with design patterns, coding standards, but the one thing that is becoming more difficult is convincing executives of the company to use a flash solution when all of the above devices competently show ajax and html just fine. I know that the flash player is going to come to the android…. but let’s get real, is adobe taking a serious look at this? I mean its awesome to do flashlite for the various nokia devices and devices that can support this. But there needs to be major changes here because as the industry moves more and more mobile, ajax/html solutions are becoming a lot more appealing because…

January 11th, 2009

2009 – Actionscript 4?

8 Comments, actionscript, as2, flex, by austin.

Is there any kind of official word on whether there is going to be an actionscript 4? Im curious, as i develop mainly in as2.0 and some 3, but the jumps are huge. Is there just going to be actionscript 3 and small modifications to it as the player comes out?

Is it me, or did Colin Moock’s post stir up some feelings I have about flash 9 cs3? I’ve used flash 8 for years and haven’t had a single problem with it except for the slow compile times. Now, adobe comes out with the new flash 9 cs3. Not only do they take out the data services, they add in this really odd way of generating classes and re-work the entire way the objects are created on the stage. This makes the workflow not as simple and generally re-works the flow. So, my question on flash 9 cs3 is, why? 1. Why take out the data services? So we all move to flex? I do flex projects, don’t get me wrong. I think flex is great for what it is. But the problem is in flash there is SOOO much more freedom because of assets and the timeline and animation and designs are so much easier to create. 2. Why make it more complex? Why make every object it’s own class? What if we have a whole series of nested objects and don’t want to make every nested symbol a property in a file? Why not just simply let it be by itself… Keep it simple. The amount of times I’ve opened a project and not been able to compile it because of the “Automatically declare stage instances.” really gets on my nerves. Error messages — Man – some of these just don’t make sense. They are verbose and unclear. In flash 8 it was…

I’ve been thinking a few things out on a dynamic layout engine written in xml. Flex mxml layouts are all precompiled. This makes it faster at loading, however it makes the layout xml not reside on disk which therefore makes it harder who do not know flex to make modifications. We recently wrote an entire actionscript 2.0 layout engine which was an enormous amount of work, but we achieved the point of having other developers make modifications to the xml without them having to know the entire flex framework. So it was pretty cool. But, the question is – what are the advantages and disadvantages of doing a new layout engine for flash 9 cs3. Is it worth it? My problem with the flex framework is that the movies always seem over bloated some times. As an example, the actionscript 2.0 layout engine, the core layout code ended up being 60k, for full HBox, VBox, widget set. What do you think?

I was on a project which required me to be able to take a 60 second intro that I did in flash and save it to dvd. I thought this would go smoothly now that flash 9 cs3 can export to quicktime video. Little did I know that this was ultra lame as when cs3 records the movie to quicktime it screws up the frame rate and the .mov looked really bad. After a bunch of unsuccessful attempts at getting it right, I tried screen recorders (about 10) and couldn’t find any that worked right. Adobe needs to work a little harder on this one as DV pros need to be able to have a constant framerate which can be burned to DVD, etc – otherwise it’s almost impossible to recreate the flash movie. The animation I made combines actionscript with frames, creating random actionscript particles and just recording it is very hard. So I grabbed a program called MagicSWF and this recorded it at 22 frames per second to an AVI. It was smoothe as hell. I then took the AVI into after effects and recomposited the quicktime video with a wav file and the AVI file and voila I had a flash animation prepared for going HD. And it looked almost as good as the original SWF. I could blow it up — stretching and the hardware scaling worked great. Anyway, this is a tip for anyone trying to record a flash movie to HD.

Man, I want to move over to actionscript 3, but I still can’t do it yet. I have so much proficiency with actionscript 2 for the last 4 years that I can’t do it yet. I’m so used to it. I want to do 3, but it seems like I have such a cool workflow right now with what I got, events, separation of responsibilities, that moving over to 3 seems like a waste of time. I mean, obviously I could do it, but the penetration isnt right yet. What do you think? I’m also a bit weary because flash 9 cs3 still has issues. It’s not fully developed past 9.0.45 – if it had more penetration then I might jump over to using 3 and start fully developing in 3 now. But the component set in flash 9 cs3 only works with a player version as of a couple months ago. I think the main jump that will push me over is now that FDT 3 is out I might start going hardcore actionscript 3 now. The only thing I really liked about actionscript 2 was that FDT was so awesome and there were no bugs I couldn’t figure out in as2 – it’s just like everything could be overcome. It seems like because we’re building on an existing framework with flash 9 cs3 it might get a bit complicated. I’ve already seen some weird posts on flash 9 cs3 and no web service support that it’s not really worth it yet. What are…