
It’s been a while since I’ve posted anything on here. Things have been soo busy recently, I’ve had some really exciting projects to work on including more portfolio websites and online ad campaign and my handy work is even going to be featured on a TV campaign coming up.
There has been a bug in flash that has always niggled me, and I’ve always wanted to try and find a solution but for one reason or another never had a chance to. This bug occurs when you dynamically insert text in to a TextField in Flash which is allowed to autoSize and then selected all the text by dragging. In most cases, as you drag down the text will scroll up 1 line and you will loose the top line. This is a really ugly bug.
After reading Tomek’s blog post on the same bug and his fix , I’ve managed to discover what the problem is and the slightly modified (improved… cough, cough) on Tomek’s solution.
Tomek’s solution worked perfectly, which was to insert the text, store the height, set the autoSize property to NONE and then manually increase the height of the TextField. This means that the text fits within the resizes TextField fully and does not need to scroll.
The thing I didn’t like is that I was just adding 10 pixels to the height. What if I was using a large font size and that solution didn’t work? After some experimenting I found that the value you need to increase the height of the TextField by is the leading. So if your leading is 0 the bug will not appear, if you leading is something crazy like 24, then you will need to add 24 pixels to the height of your dynamic TextField. It seems that when Flash resizes the TextField as you flow the copy in, it doesn’t take in to account the leading, or at least ignores it on the last line.
My Solution is this:
- Set the autoSize property to LEFT (or similar)
- Insert the text
- Store the height
- Set the autoSize property to NONE
- Increase the height by adding the leading value of the TextField’s TextFormat object.
text2.autoSize = TextFieldAutoSize.LEFT;
text2.text = lipsum;
var h : Number = text2.height;
text2.autoSize = TextFieldAutoSize.NONE;
text2.height = h + text2.getTextFormat().leading;
I finally managed to spend a little time exploring Flocking and AI using Flash to visualise the emergent system. This effect has been done by other people numerous times so it’s nothing new, but it’s the first time I’ve been able to work on this effect.
As you can imagine a lot more work needs to be done so that the behavior looks better and the groups appear within the system (at the moment the Agents seem to overshoot the groups a lot of the time until they are out of range to affect the group and they all disperse).
Click the image below the launch the demo, and download the source here.

I’ve have been following the development of Cargo for a couple of months now and just recently signed up for a beta account. Cargo is a fantastic Personal Publishing Platform that is currently open for beta testers and provides a simple and clever way to built a beautifully simple portfolio and the ability to follow and be followed by other Cargo users.
For my new portfolio I specifically wanted to use video to showcase my projects and more specifically, Flash video. There is talk on the discussion boards of a video player component and ability to upload video being introduce to a future version of Cargo which will be fantastic. Especially if the videos get hosted and streamed from a Streaming media server such as red5 or FMS (in case any Cargo guys read through this :).
In any case I just couldn’t wait and thought it would be a fun experiment to try and create my own simple video player that I could embed in to my Cargo pages. So I spent last Thursday afternoon doing just that am I am pretty pleased with the initial results. I mentioned this on the Cargo discussion boards to say that anything is possible and some asked for a little more info. So I thought I would try and break down the process in to a few simples steps and explain what I did. It still needs a lot more work and I’m not actually going to be using this component in my final portfolio, but at least I know I can do it ).
Download the source files here.
Read More »
I was working on a job last week where I need to create an animation of ‘data lines’, ie lines that seem to pulse from one point to another. The first thing that sprung to mind was using the bitmapData Class in a similar way to other examples I have seen, and use a particle system to emit dots which would travel out from a pre-determined point and leave a trail behind them. This was exciting because it’s the first time I’ve used something from my research & development time on a live job, instead of a live job sparking ideas which I explore in my research & development time. Well the job went great, the client loved the effect that the dots created and all-in-all everyone was happy.
Then, a few days later I received an email saying that the animation was chugging and was creating a really negative experience when used on lower-end machines. I’d also started to encounter this problem when I was building the animation and pumping it with 300+ particles to update each frame. I couldn’t explain it, I was using bitmapData to make the thing run fast and stop any performance problems. Well, after some research in to tips and trick for using the bitmapData class, it turns out I had used the technique in the wrong way! Thankfully I need to remove 1 line of code from my Particle class and place it in the ENTER_FRAME loop instead. A simple change that literally meant I can now run an animation with 1000+ particles @ 60 fps and not get a performance hit (unless I go fullscreen!).

Read More »
I’ve just spent the past couple of hours revisiting some tutorials and thoughts on bouncing ball physics and I wanted to try and incorporate collision detection. As far as I can tell it seems to work quite well. I even set the rotation of each of the balls based on their current x velocity so that it looks like they are actually spinning around. Click on the image below to launch the experiment.

I wanted to test out the performance of my new and improved Tweeny animation engine. For this all I’ve done is create a simple demo which created 1000 balls and adds them to the display list. Then tweens each to a new random position somewhere on the stage once every 3 seconds. Once the timer stops the experiment traces the lowest framerate that the SYSMonitor (a system monitor component) recorded.

Read More »
March 23, 2009 – 10:36 pm
Anyone who checks this blog regularly will notice that I am forever tweaking, re-writing or updating my Tweeny class. This is an ultra simple tween engine that I’ve start developing that is very personalized for me and is aimed at providing the simplest and quickest way for me to add dynamic animation to an AS3 project. I’ve had a few hiccups recently, main because I’ve been getting my head around the best way to write and organize Tweeny.
For a job I’m working on at the moment I’ve needed to create several different types of animations, some are simples slides, others where 100+ objects bouncing down on to the stage. I used Tweeny for these so that I could create the effect I wanted but without having 100 tweens on the timeline, what if I needed to change the speed or position, I wasn’t going to sit and adjust 100 guide paths. (I haven’t started using my CS4 install yet but hopefully that will all be a thing of the past anyway).
So I needed to add some additional functionality to Tweeny for these new animations.
- Animate multiple objects and then listen for a COMPLETE event once they are all finished.
- Now Tweeny 0.9 dispatches a COMPLETE event each time all tweens are finished and Tweeny is deactivating. All I have to do now is register for the event using Tweeny.addEventListener(Event.COMPLETE, completeHandler) and then use removeEventListener() in the handler function so that I only listen for this event once. Otherwise the next time I tween something, Tweeny will still dispatch the COMPLETE event even if it’s a different item. This is a faster way of implementing a TweenyGroup. I was thinking about creating a TweenyGroup class but what’s the point when I can achieve the same effect with less code.
- Pause every tween.
- Now Tweeny 0.9 has to new methods. pauseAllTweens() and resumeAllTweens(). These do exactly what they say on the tin. The stop the update function from being called until resumeAllTweens() is called to resume. (Maybe I should add a completeAllTweens() and stopAllTweens() to completely remove all tweens from Tweeny. One will force the tween to the end and call any onComplete functions that have been set, the other will simple stop all the tweens in their tracks and remove them from the tweens array.
Visit the Tweeny page for more info and a link to download the latest zip from my code.google account.
It arrived yesterday, I’m so excited. I finally have a copy of After Effects to start learning, not to mention Flash CS4. Things are really going to get exciting.

For the past 3 years at least, I’ve been designing and developing websites for a variety of clients. I’ve built portfolio websites for photographers, art dealers and other designers I’ve created e-commerce websites in Flash and built PHP and Flash CMSs for most of them to allow the website to be updated easily. I’ve created complex websites that involve a lot of planning and Math or hours and hours of tweaking animations as well as simple websites which only appear to have 1 or 2 pages and very understated animation.

Read More »
The past few weeks have been really nice. I’ve been working on a number of freelance jobs which have involved little to no programming and have also been managed quite well so that I’ve had a little more spare time in my evenings. This has been nice because I’ve spent a few hours researching and reading about technique to improve and optimise my ActionScript code.
Once of the best ways I have found to really learn something is to copy it from it’s original source and write it down for my own notes. This is exactly what I plan to do with this post. I will be wrtiting down a series of tips and tricks as well as posting the original articles that I got them from. Some of these articles may go in to even more detail about these techniques and suggest others, so I would definitely not treat this post as a definitive list, it is simply an overview of some of the key points that are tried and tested techniques.
Read More »