AS3 Camera Motion Detection using BitmapData.threshold()
The idea for this experiment was to detect the percentage of motion on camera from previous frame to current frame.
The idea for this experiment was to detect the percentage of motion on camera from previous frame to current frame.
I came across an instance the other day where I had a set of links; some of which where internal, while others where external. I wanted the internal links to open in the same window(target="self"), and the external links to open in a new window/tab(target="blank"). Since I was loading these links from an external json file, populated dynamically and displayed in Flash via a loop, the easy solution to determine the window target was to search for the internal domain name substring within the url string using String.search().
Last summer when Google announced that they were now indexing SWF files, they spawned many questions among the Flash community. "What exactly is being crawled?", "Do we need to do anything different?", "Which Flash Player versions?". At the same time, Google too, was a little unsure to what extent this content would be crawled.
"We've developed an algorithm that explores Flash files in the same way that a person would, by clicking buttons, entering input, and so on. Our algorithm remembers all of the text that it encounters along the way, and that content is then available to be indexed. We can't tell you all of the proprietary details, but we can tell you that the algorithm's effectiveness was improved by utilizing Adobe's new Searchable SWF library."
The Grid overlay class is just that. It's a utility class that draws a grid overlay (or underlay, or even middle-lay--however you want) within your swf during run-time, of specified numbered columns and gutter width. I created this class as a way to assist in maintaining the grid of the layout during the development stage.
The above example is another take on moving particles with perlinNoise. This time I'm containing the particles within a circular boundary by using the logic from my previous post, Mirrored Circular Motion in AS3, to regenerate particles on the opposite side of the circle. This experiment, as well as the rest of my perlin particle experiments, inspired by the magic Robert Hodgin created with his Weird Fishes video.
This experiment illustrates the angles of circular movement in Flash, while mirroring those angles on the opposite side of the circle. I have two mirrored movements here. The first movement being a Sprite that mirrors the mouse’s position on the opposite side of the circle, while snapping to the boundaries of that circle. Then a second Sprite, that mirrors the mouse’s position on the opposite side of the circle, but instead shares the same distance of the mouse from the center point.
While recently working with the NetStream class, I was surprised to learn that there was no preset method in place for maintaining the pixel aspect ratio. The situation I faced was that I was building a video player that needed to host both 4:3 and 16:9 ratios. However if the Video object's dimensions are preset to that of a 16:9 ratio, and a video with a 4:3 ratio is loaded in, instead of the clip maintaining shape and centering within the video object, it instead flushes with the edges of the 16:9 dimensions.
Makes sense, right? In reality it's doing what I ask. It's displaying the video at the dimensions I specified. However, it's distorting the the video in the same process.
The BitmapData.getPixel method is a pretty interesting method. In previous posts I've experimented, using the number it returns, to scale, rotate, move, and in my last post, create a halftone pattern.
Expanding on my previous experiment, using the BitmapData.getPixel and PerlinNoise to scale a Sprite based on the color info of a defined pixel, I noticed that it seemed to be creating this halftone pattern with the different scaling. Where in the previous I applied to an PerlinNoise pattern, here I thought I'd apply to an image.

A while back I created a little ActionScript 3 class, using the ExternalInterface.call method, that returns a query string value from the url. This came in pretty handy for things such as direct linking to certain videos within a video player, displaying campaign specific content on load based on different referring sites, ect, etc.
Upon second glance, I realized that I got a little loop-happy with the previous attempt. Below is a slimmer version with the redundancies taken out.