actionscript3: Category

Category: actionscript3

Talking Trash – An overview of Player GC

Posted At: October 11, 2011 11:42 AM | Posted By: Michael Labriola
Related Categories: actionscript3, AIR, flashplayer, Uncategorized

Okay, so, I have been a little behind schedule actually posting content. Here is my first attempt at reconcilliation. These are the slides from my garbage collection talk at flash and the city this year. They go into moderate depth about the internals of garbage collection on the Flash Player and AIR along with some speculation about where things may be going. The speculation is based off of commits happening on the tamarin project from our friends at Adobe.

  Cheers, Labriola    

Comments (3)

Lots of new prereleases from adobe

Posted At: October 25, 2010 3:40 PM | Posted By: Jeff Tapper
Related Categories: ActionScript, actionscript3, adobe, Adobe Flex, AIR, as3, flash, flex, flex4

Late last night adobe released several new betas on the labs.adobe.com site, including: • 64 bit Flash Player (Code Named “Square”) • Flex 4.5 SDK (Code Named “Hero”) • Flash Builder Next (Code Named “Burrito”) • Flash Catalyst Next (Coe Named “Panini”) Square is obviously very interesting, as more and more end users now have 64 bit machines, it is great that the flash player will now be able to leverage the full power of the underlying operating system. It seems that 64 bit players are now available for Windows, Mac and Linux. Hero is another great release, with Adobe continuing to move the flex sdk forward. In this release, many of the components which were not migrated to the spark architecture in the 4.0 release have now been completed, including the DataGrid, Form, and Image components. Even more interesting is the rework done to make to make Flex applications run well on mobile devices. Having done a few AIR for Android applications using AS3 without the flex framework, I look forward the increased productivity I can realize by leveraging flex on these devices as well. Burrito and Panini are both improved tools to allow developers and designers increased productivity with the new SDK. In addition to supporting the latest SDK, Burrito also includes a workflow to ease development of mobile applications, a series of coding improvements, such as the introduction of templates, metadata code hinting and more. All told, these new releases promise to push the flash platform forward, and increase the world of possibilities for those of us who develop for the platform.

Comments (1)

What’s under your skin

Posted At: September 21, 2010 1:52 PM | Posted By: Jeff Tapper
Related Categories: actionscript3, adobe, as3, flash, flashplayer, flex4, fp10, skins, Speaking Conferences

At 360|Flex DC yesterday, I presented my “Whats under your skin” presentation, all about architecting components with skins and layouts. I had a great audience, who was very engaged and asked lots of pertinent questions.

For anyone interested, here are the slides. The code for the ShoppingList component can be found below from the download link. The code for the Clocks are proprietary, and can not be shared. Sorry. Download

Comments (0)

Ouch, it hurts when i do that

Posted At: March 10, 2010 2:03 PM | Posted By: Jeff Tapper
Related Categories: actionscript3, as3, flash, flash9, flashplayer, flex, flex3, flex4, fp10, Speaking Conferences

As promised, here are the slides for “Ouch! It hurts when i do that.” presentation first delivered at 360Flex San Jose, March 10th, 2010.

Comments (3)

Flex 360 tickets selling fast

Posted At: December 17, 2009 12:12 PM | Posted By: Jeff Tapper
Related Categories: actionscript3, flash, flashplayer, flex, flex3, flex4, FlexUnit4, fp10, fp9, Speaking Conferences

Down to the last 5 (Cheap) tickets left for 360|Flex. Register now, save $100 and get the same awesome content for a little less coin. Act fast, these last tickets won’t last. When they’re gone, the regular price of $599 kicks in. Come on out and hear me give advice how not to hurt yourself with code, in my “Ouch, it hurts when i do that” talk.

Comments (0)

Fun with custom preloaders in Flex

Posted At: October 2, 2009 11:10 AM | Posted By: Jeff Tapper
Related Categories: actionscript3, as3, flash9, flex, flex3, fp10, fp9

As you probably know, its pretty easy to use a custom preloader in flex to replace the built in preloader shown as a flex application loads. There are a few tricks to remember with a custom preloader though, remember that the preloader is built to be displayed until the flex framework is done downloading. As such, the preloader won’t display until all the classes needed by the preloader are done downloading. For this reason, its really important to remember that your custom preloader class doesn’t make use of the flex framework, because if it does, the users will see nothing until enough of the framework has been loaded to display the preloader, and the preloader will only be displayed while the remainder of the framework is downloaded. Fortunately, the DownloadProgressBar class makes little use of the flex framework, as it extends Sprite, instead of UIComponent, and only utilizes a few event classes from flex, which don’t require any additional framework classes. A quick google search can show you dozens of examples on subclassing DownloadProgressBar to create a preloader which matches your application. A larger challenge is faced when you have additional needs from a preloader. Frequently, we are tasked with writing a preloader which is shown during the initial download, as well as remaining displayed until some startup procedures are complete within the application. Some might try to approach by referencing Application.application within the preloader, to listen for a custom event indicating that the startup procedures are complete. Of course, this is not an ideal solution, as referencing the Application class will link in the mx.core.Applicaiton class, which in turn links in around 170k worth of the Flex framework. A better approach is to create a new class, which is not linked to the flex framework, which can act as an event bus between the main application and the preloader. If this class is built as a singleton, you can be assured that both the main application and the preloader are accessing the same instance, allowing for a simple and convenient mechanism for the preloader to listen to the main application, without needing any reference to the application or the flex framework.
package net.digitalprimates.preload { public class PreloadEventBus extends EventDispatcher { public var isReady:Boolean = false; private static var _instance:PreloadEventBus; public static const READY:String = "READY"; public static function getInstance():PreloadEventBus { if (!_instance) { _instance = new PreloadEventBus(new SingletonEnforcer()); } return _instance; } public function PreloadEventBus(singletonEnforcer:SingletonEnforcer) { if (!singletonEnforcer) { throw new Error("PreloadEventBus is a singleton class, use getInstance() instead"); } } } } class SingletonEnforcer {}
With this class, when the main application is done with its startup procedure, it’s a simple process to get a reference to the PreloadEventBus, set isReady to true, and dispatch an event.
protected function applicationCustomStartupDone(event:Event) { var bus:PreloadEventBus = PreloadEventBus.getInstance(); bus.isReady = true; bus.dispatchEvent( new Event ( PreloadEventBus.READY ); }
In the custom preloader, you can override the set preload method, and instead of listening for the complete event as the base class does, listen for the INIT_COMPLETE event, which indicates that the application has loaded, and had its initialize event dispatched. In the event handler for this method, you will get a reference to the PreloadEventBus, check if the application has already set the isReady flag to true, and if not, listen for the READY event.
private function bus:PreloadEventBus = PreloadEventBus.getInstance(); override public function set preloader( value:Sprite ):void { preloader.addEventListener( FlexEvent.INIT_COMPLETE , initComplete); }
An important thing to note is the lack of call to super.preloader in this overridden setter. If the base classes setter is allowed to run, the preloader will act as initially intended, such that it disappears when the application is done downloading. As the purpose of this preloader is to allow for the application to determine when to hide the preloader and start the app, its important we override this functionality. You may find that you need to listen for other events here, such as ProgressEvent.PROGRESS, FlexEvent.INIT_PROGRESS or Event.COMPLETE. This example shows the bare minimum you would need to make use of the preloader
private function initComplete( event:Event ):void { if (bus.isReady) { completePreloader(event) } else { bus.addEventListener(PreloadEventBus.READY, completePreloader); } }
While its not expected that the application will be done with its initialization procedures before the INIT_COMPLETE, but, based on how the application is built, it is possible. To avoid this race condition, the isReady property of the PreloadEventBus is used, so that the preloader only listens for the READY event if the application is not already done with its startup. Last but not least is the completePreloader method, which is called when the preloader has determined that the application is ready. With the logic in initComplete, this same method will be used, regardless whether the state of the application was determined by the isReady property, or by listening for the PreloadEventBus.READY event.
private function completePreloader(event:Event):void { dispatchEvent( new Event( Event.COMPLETE ) ); }
Event.COMPLETE is used, as this is the event for which the system manager listens, to know that the preloader is done with its job. By preventing its normal mechanism of dispatching, and only dispatching it when the application determines it is ready, you have a nice clean approach to allow the the preloader to display as long as it needs to.

Comments (3)

FlexUnit 4 feature overview

Posted At: May 20, 2009 9:05 AM | Posted By: Jeff Tapper
Related Categories: actionscript3, AIR, as3, flash, flashplayer, flex, flex3, FlexUnit4, Fluint

More details available on Labriola’s blog and openSource.adobe

Comments (0)

How not to code Flex Applications

Posted At: May 19, 2009 5:05 PM | Posted By: Jeff Tapper
Related Categories: actionscript3, adobe, flash, flex, flex3

Download

Comments (1)

Flex Camp 360 NJ

Posted At: October 7, 2008 9:10 PM | Posted By: Jeff Tapper
Related Categories: actionscript3, adobe, AIR, as3, flex, flex2, flex3, FlexUnit

File this under the better late than never…

 

On September 26 and 27th, the folks who bring you Flex 360, put on a 2 day "Flex Camp" in New Jersery, which went over extremely well.  I was presenting on Testing with Fluint (formerly known as DPUint).  Of course, I promised my slides and materials would be up on here before the end of the weekend.  Well, realizing its over a week later, I'm finally getting them uploaded now.

 

So, if you were one of the many asking for those materials, here they are. 

slides
source code

Comments (2)

I woke up this morning…

Posted At: May 15, 2008 8:05 AM | Posted By: Jeff Tapper
Related Categories: actionscript3, as3, flash, flashplayer, fp10

and found the public beta of flash player 10 was out. How cool is that. I knew this would be coming before too long, but didnt realize that it would be out so quickly. This new version is filled with lots of new features aimed at allowing greater “expressiveness” in flash player content, such as 3d effects, custom filters, enhanced text rendering, and revs to the drawing API. Of course, like each version before it, FP10 also has lots of performance enhancements. What are you waiting for go get it on adobe labs I’m particularly looking forward to working with the Advanced Text Rendering features, which promise to allow lots of layout possibilities, including bi-directional text! more later

Comments (0)