Archive for October, 2008

AS3 GarbageCollection Utility

The below class serves as Garbage Collection utility for AS3. You can use it to prevent your applications from memory leakage.

import flash.system.System;
import flash.utils.Timer;
public class GCUtil {
private var _timer:Timer;
public function GCUtil(interval_sec:uint = 60) {
_timer = new Timer(interval_sec*1000);
public static function doGC():void {
public function startGC(interval_sec:uint):void {
if (interval_sec > 0) {
_timer.delay = interval_sec*1000;
if (!_timer.running) {
_timer.addEventListener(TimerEvent.TIMER, handleTimer);
} else {
public function stopGC():void {
if (!_timer.running) {
_timer.removeEventListener(TimerEvent.TIMER, handleTimer);
_timer.delay = 0;
private function handleTimer(te:TimerEvent):void                       {


Elearning using Flex

I am glad to announce the first Step for basic requirements of E-Learning using Flex has been achieved.
Basic Requirements met:

  • All Flash player versions starting from Flash Player version 6 to 10, should be loaded. (For support of old elearning courses).
  • Without any memory leak due to loading multiple swf files.
  • Ability to navigate to any particular lesson (SWF).
  • XML Support for loading swf files into a lesson.
  • PreLoader for showing the loading status of individual SWF files
  • Ability to detect events of SWF files (eg: totalframes, swf playing etc.,) 

See the demo of loading a number of animations. The source files include and XML

Power of FP10

Get your own mp3 from local system played from web. more

AVM1Movie Controller in Flex

Overcome restrictions on an AVM1 SWF file loaded by an AVM2 SWF file:

While trying to control AVM1Movie (Flash Player 8, 9, 10 or older) from flex, we will get the below error message: “Property stop not found on flash.display.AVM1Movie and there is no default value. ”

To overcome this problem, ForcibleLoader class converts them into latest player versions on runtime. The below is an working example for how to control AVM1Movie from Flex.

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”; layout=”absolute” initialize=”init()”>
private var swfURL:String = “AVM1Movie.swf”;
private var libMC:MovieClip = new MovieClip();
private function init():void{
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfComplete);
var fLoader:ForcibleLoader = new ForcibleLoader(loader);
fLoader.load(new URLRequest(swfURL));
private function swfComplete(event:Event):void{
libMC = event.currentTarget.content as MovieClip;
<mx:UIComponent id=”swfContainer”/>
<mx:NumericStepper id=”slide” change=”{libMC.gotoAndStop(slide.value)}”/>

Loading flash library asset in Flex

The below is the code to load flash library asset (using linkage name) on Flex.

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”; creationComplete=”onCreationComplete()” >
import mx.core.UIComponent;
private function onCreationComplete():void{
var swfLoader:Loader = new Loader();
swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onSWFLoadComplete);
swfLoader.load(new URLRequest(“flash.swf”));
private function onSWFLoadComplete(event:Event):void{
var tempClass:Class =“libraryAsset”) as Class;
var movieClip:MovieClip = new tempClass() as MovieClip;
var uiComp:UIComponent = new UIComponent();