MovieClip Loop Control

?View Code ACTIONSCRIPT1 2 3 4 5 6 import net.peteshand.utils.LoopCtrl; LoopCtrl.setLoops(this,3,40); // Parameters: // Target MovieClip, // Number of Loops, // Frames of end of timeline to stop at (default = 0) ?View Code ACTIONSCRIPT1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 package net.peteshand.utils { import flash.display.MovieClip; import flash.events.Event; import flash.events.EventDispatcher;   public class LoopCtrl extends EventDispatcher { /** @private **/ private static var ref:MovieClip; private static var loops:int;   public function LoopCtrl () {   }   public static function setLoops(_ref:MovieClip, _loops:int=1, preEndFrame:int=0):void { ref = _ref; loops = _loops; var count:int = 0;   ref.addFrameScript(ref.totalFrames-1-preEndFrame, LastFrame); function LastFrame():void { count++; if (count == loops){ ref.stop(); ref.dispatchEvent(new Event("LoopEnd")); } } } }...

.MPO to Anaglphic or Stereo Pair JPG

I recently bought the new Fujifilm FinePix W3, it a nutshell its a camera with stereoscopic lenses (see below) which means you can shoot 3d photography and hd footage. It doesn’t stop there though, on the back of the camera you have a 3.5-inch glasses free 3d display. Without a doubt the coolest gadget I’ve ever bought. One thing that surprised me was the format in which the W3 saves stereoscopic images, the file extension is called .mpo and I can’t say I’ve ever heard of it. I was expecting it would save as a stereo pair .jpg or .jps which would be easier to view and edit on a regular computer display. It turns out there are a few programs out there that will convert .mpo to .jpg, but not that many. So i decided to look into the possibility of converting in actionscript. Because the .mpo format is basically multiple jpgs saved within the one file it turned out to be pretty straight forward. Building on Thibault Imbert’s work on jpg decoding I simply wrote a few classes to parse the .mpo into separate jpg byteArrays and then output the result as a stereo pair or a anaglyphic...

Performance vs filesize vs fidelity

Performance, file-size and visual/audio fidelity is something every designer and developer should consider when creating content for the web. I can remember when I first started using flash it was all about doing as many cool and complicated on-screen concoctions as possible, regardless if the frame rate slowed to a crawl. However as I and the platform as a whole has matured I’ve found myself considering and weighing up the above to get the most out of every experience I fashion. This post looks at a recent project of mine, which at face value appears quite simple, however behind the scenes there were a number of hurdles that needed to be overcome before the finish line. you can view the final advertisement here (turn the sound on!) So the basic idea was to have hundreds of coffee beans sitting in the leader-board banner at the top of the screen and an Espresso cup sitting in an MPU banner bottom right. When the user interacts with either banner the beans would begin to fall down, get ground up and coffee would pour into the espresso cup. Once this animation finished the user would be prompted to pick their favorite type of coffee, which would then transition the MPU banner to the users selection. Sounds easy enough right… Well yes… and no. The main problem with this campaign is that it was for McDonalds, they expects the finest visual aesthetics however we have very limited file-size and processing power to play with. I first concentrated on creating a realistic looking bean. Seeing as the geometry involved is quite simple I decided...

Trace Event

It would be great to add a way to track trace events. when testing flash within the browser its nice to be able to see the trace output. currently there are ways to do this with plugins for firefox or air apps from De MonsterDebugger, but sometime your testing on someone elses computer who don’t have these programs installed. if we had the above event we could simply read a class that shows a debug panel when you input some key combo. ?View Code ACTIONSCRIPT1 2 3 4 5 stage.addEventListener(TraceEvent.UPDATE, OnTrace); function OnTrace(event:TraceEvent):void { textField.text = event.trace } if you’d like to see this event added to actionscript please visit the below URLs and add your support:...