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:...

Circle Preloader

Here’s a nice little circle pre-loader class created recently. All you really need to do is add it to the stage and then update its percent value (between 0 and 1) on a ProgressEvent or whatever event you want really. There are also two optional values that you can set in the constructer which relate to the colour of the loader. You can download the source here ?View Code ACTIONSCRIPT1 2 3 4 5 6 7 8 9 10 11 12 13 import flash.events.ProgressEvent; import net.peteshand.utils.CirclePercentLoader;   var circlePercentLoader:CirclePercentLoader = new CirclePercentLoader(0xAAAAAA, 0x666666); circlePercentLoader.x = stage.stageWidth/2; circlePercentLoader.y = stage.stageHeight/2; addChild(circlePercentLoader);   loaderInfo.addEventListener(ProgressEvent.PROGRESS, OnProgress); function OnProgress(event:ProgressEvent):void { circlePercentLoader.percent = loaderInfo.bytesLoaded/loaderInfo.bytesTotal;...

Reverse Video Playback

If you’re at all familiar with video within flash you’ll know that there is no built in functionality to play a video in reverse. The reason for this is quite simple. When a video is encoded regardless of the codec or the wrapper format some frames are keyframes (iFrames) and other are in-between frames (pFrames or bFrames). Basically the in-between frames need data from other frames, which are usually sequentially before them, so if the video is played in reverse each time an in-between frame is encountered data will potentially be missing. You could make every frame a key-frame to get around this, however this would result in huge file size. Another approach that can work in some cases is to take a bitmapdata capture of each frame as the video plays, save them to a Vector and then once this process has been completed you can jump to any frame within the Vector regardless of if the original frame was a key-frame or not, or even play through the Vector in reverse. The movie above demonstrate this method, source files can be download from here. The downside to this approach is that each frame that is placed in the Vector has to be saved into memory, so if the video is really long in length, or has large dimensions this may slow performance significantly, so keep this in mind. The other downside is that you have to play through the video to capture each frame before you can play it in reverse, I guess it really depends on your project as to if this is going to be...

First Person Interaction For Flash Please!

Update: This feature has now been added to flash 11.2. you can read more about it here: http://www.bytearray.org/?p=3755 ———————————————————————————————————- ———————————————————————————————————- While creating 3d environments within flash you are currently limited in the way you get user mouse input. In your traditional first person shooters moving the mouse will turn the view left and right, up and down. The problem you face within flash is that once the mouse hits the edge of the movie or if it is in full-screen mode, the side of the screen there is no way to receive mouse input as the mouseX and mouseY values to longer change, even if the user is still moving the mouse. The first two videos below show methods which are achievable with the current functionality, the last video shows what would be possible if we had access to raw mouseOffset values. AbsoluteDrag shows the view turning via the absolute location of the mouse. The problem with this method is that as soon as the cursor hits the side of the flash movie input stops. AbsoluteClickAndDrag only turns the view when the user clicks and drags the mouse. This method continues to turn the view after the cursor has left the stage as long as the mouse button remains held down, however stops as soon as the cursor hits the side of the screen, it’s also not ideal for the user to always have to click and drag to turn as you would usually use the left mouse button as an action input (eg fire your gun). RelativeDrag is my suggestion to this problem. With this extra functionality you...

TextToSpeech Accessibility

I recently posted a TextToSpeech as3 interface class which you can view here. Basically you pass it a string and it will read it out loud. Today I’ve added an easy way to increase the accessibility of your flash microsite without having to go through the whole project adding code to every button. Simply add the two lines below to your root document and this class will search through every display object and add rollover text to speech. ?View Code ACTIONSCRIPT1 2 3 import ps.GText2Speech.Accessibility;   var accessibility:Accessibility = new Accessibility(this); You can also specify to read the text on a click or rollout instead of the default rollover. ?View Code ACTIONSCRIPT1 2 3 4 5 6 import ps.GText2Speech.Accessibility;   var accessibility:Accessibility = new Accessibility(this); accessibility.Rollover = false; accessibility.Click = true; accessibility.Rollout = true; In most cases there will probably be some textfields you want to ignore, so if you need to do this simply add the display object to the exclude list. ?View Code ACTIONSCRIPT1 accessibility.exclude(mc_skip); You can download the source and example files here. If you fine any bugs or have any additional feature requests please post them below....