Category Archives: Actionscript Examples

Framework Profiling Robotlegs Vs PureMVC

Following up from A post on the Robotlegs forum

The Results:
http://stimuli.tv/frameworktests/spreadsheet/framework-profiling-23062011.xls

The Test Applications:
http://stimuli.tv/frameworktests/puremvc/srcview/

http://stimuli.tv/frameworktests/puremvc/

http://stimuli.tv/frameworktests/robotlegs/srcview/

http://stimuli.tv/frameworktests/robotlegs/

Sources:
http://stimuli.tv/frameworktests/source/FrameworkProfileHarnessAs.zip (Flex SDK 4.1 & AIR 2.5 for TV)

http://stimuli.tv/frameworktests/source/FrameworkTesting.zip (Flex SDK 4.5 & AIR 2.6 for Mobile)

http://stimuli.tv/frameworktests/source/PureMvcBasic.zip

http://stimuli.tv/frameworktests/source/RobotlegsBasic.zip

http://stimuli.tv/frameworktests/source/StimuliUtils.fxpl – change .zip extension to .fxpl

The AIR Wrappers:
http://stimuli.tv/frameworktests/air/FrameworkProfileHarnessAs.air – change .zip extension to .air (Flex SDK 4.1 & AIR 2.5 for TV)

http://stimuli.tv/frameworktests/air/FrameworkTesting.air – change .zip extension to .air (Flex SDK 4.5 & AIR 2.6 for Mobile)

http://stimuli.tv/frameworktests/air/FrameworkTesting.apk – change .zip extension to .apk (Flex SDK 4.5 & AIR 2.6 for Mobile)


Just A Couple Of Useful Posts

I read then as is usually the case i forget and do it the long way… so for future reference:


I call this one SWFObject IE-EI-OH!

All i wanted was for a swf to talk to javascript and back using our friend ExternalInterface. As with almost everything i publish SwfObject was mandatory. Within about 20 minutes it worked… or did it hmmm. As always mr IE stepped in to prevent me (and he did so with much rage and anger).

Anyways here is my SWFObject solution it is ‘simples…’

I hope this zip helps.


Preloading in Actionscript 3 with 2 swf’s

Here’s an example document class that belongs to a preloading swf that loads in my main application swf.

package com.deceptiveresolution.demo.swf.preloading
{
import flash.text.TextField;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.display.MovieClip;
import flash.display.Sprite;

public class PreloadingContainer extends MovieClip
{

private var __container:Sprite;
private var __preloader:Loader;
public var percent_txt:TextField;
private static const __APP_URL:String = “TextChat.swf”;

public function PreloadingContainer()
{
trace(”\nPreloadingContainer()”);
__preloader = new Loader();
__preloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, _onPreloadProgress, false, 0, true);
__preloader.contentLoaderInfo.addEventListener(Event.INIT, _onPreloadInit, false, 0, true);
__preloader.contentLoaderInfo.addEventListener(Event.COMPLETE, _onPreloadComplete, false, 0, true);
__preloader.load(new URLRequest(__APP_URL));
}

private function _onPreloadProgress(e:ProgressEvent):void
{
trace(”\nPreloadingContainer._onPreloadProgress()”);
var percentage:Number = e.bytesLoaded / e.bytesTotal;
percent_txt.text = String(Math.ceil(percentage * 100));
}

private function _onPreloadInit(e:Event):void
{
trace(”\nPreloadingContainer._onPreloadInit()”);
percent_txt.text = “100″;
}

private function _onPreloadComplete(e:Event):void
{
trace(”\nPreloadingContainer._onPreloadComplete()”);
removeChild(percent_txt);
percent_txt = null;
__container = Sprite(__preloader.content);
addChild(__container);
__preloader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, _onPreloadProgress);
__preloader.contentLoaderInfo.removeEventListener(Event.INIT, _onPreloadInit);
__preloader.contentLoaderInfo.removeEventListener(Event.COMPLETE, _onPreloadComplete);
__preloader = null;
}