Popular Posts

Recent Comments

About

I'm Thomas Viktil. I like to play with all sorts of things. And this is where I write about the things I learn while playing.


Archive for the ‘AS3’ Category:

Garbage collecting in AIR

At a recent project I had to make a video loop indefinitely and most importanly: seemless. I tried all kinds of different methods, including using FLV, F4V, M4V, FLVplayback component, the Video class, embedded video and a few other. The only solution that worked was (in my opinion) the most ...


AS3 Snippet #3: Remove all childs

I code snippet I tend to use quite often. And one that I tend to forget how I wrote the last time i used it. while (this.numChildren > 0) {     removeChild(this.getChildAt(0)); } Update: And when you want to remove a child as a part of an event handler, do this: event.target.parent.removeChild(event.target); Let's say you want to ...


Tips: Reading variables from Arduino using Flash, Flex or AIR

If you have experienced getting only gibberish from the Arduino when tracing it's output using Flash, Flex or AIR, you might have misconfigured the socket server. I spent a whole day trying to figure out why I only got square boxes, a couple of random numbers and an occasional 'f' now ...


ActionScript 3: Events

A couple of days ago I encountered a problem with Events. I clicked and object, but another returned the event. Despite adding mouseEnabled = false to the objects I didn't care about, I still couldn't figure it out. Events is nothing new to me, but this was beginning to get ...

Posted in AS3, flash, flex

Actionscript: Accessing MovieClips from an externally loaded SWF

For the time I'm working on a website and so far I've only spent some time doing research around all the ideas I have. One of them was to put all MovieClips in one externally loaded SWF. Loading the SWF is easy, but how do you access the individual MovieClips? ...


Papervision3D: workaround for onReleaseOutside

I just stumbled across a very simple way of achieving an onReleaseOutside event when working with Papervision3D. Now, why would I bring up Papervision3D in such a setting? If you, like me, have included a Papervision3D scene on a stage where other 2D objects (like MovieClips and other Flash components) are ...


Actionscript: Outputting a grid using only one for-loop

Sometime this winter a friend of mine (Knut Urdalen) introduced me to a part of mathematics called modular arithmetic. Now that is a nifty little thing. In modular arithmetic, or modulus if you like, numbers reset themselves when reaching a given limit. Modulus is also known as "clock arithmetic", and the ...


Making a YouTube-esque video player in Flex

Earlier this week I finished a project for one of our clients. The client produces quite lot of video content, and wanted a video player that could be embedded in other websites. This was a rather straight forward project where I got to use a lot of things I already ...


totalTime and MetadataReceived from VideoDisplay object in Flex

Interesting (and more than a bit annoying) observation; neither the property totalTime or the event MetadataEvent.METADATA_RECEIVED will trigger unless the buffer is full.I just discovered this as I tried to dynamically set the bufferTime to be 30% of the total playtime (I calculate the bufferTime using totalBytes and bytesLoaded). But ...


AS3 Snippet #1: Copy text to clipboard

A useful little snippet of code for when you want to copy text to the clipboard: System.setClipboard(source.text); Where 'source' is the id of e.g. a text field.

Posted in AS3
Tags: , , , ,