Bitmap Filtering With AS3

It’s been far too long since I have had a few minutes to post on the topic of Flash or Actionscript, so I wanted to take a few minutes out of my incredibly hectic schedule and post something I’ve recently learned. I had been looking for a nice, clean way to come up with some more stunning visual effects for my studies, especially when they can be construed as boring by some based on content alone. After finding the Polygonal library on Google Code and studying their particle handling and demos, I decided to give them some sincere flattery and imitate their demo display. I found it to be incredibly clean, and the masking techniques exhibited make for a much more easily managed viewport. While this was a great boost for me, I was most impressed by seeing their incredibly simple solution to some visual effects I had been striving to achieve with some of my particle studies.
Continue reading

Line Movement and Interaction in AS3

For quite some time now, I’ve been trying to figure out the best way to get lines to “move” in AS3. By this, I don’t mean simple rotation and skewing of an existing line, but actually changing the line structure: length, thickness, etc. The challenge first became noteworthy when I was working on my Tower Defense code, and I wanted to have a laser-esque tower that would shoot constantly at an enemy rather than launching projectiles. In other words, I wanted the origin point of my segment to be stationary while the other end of the segment follows the targeted creep. Based on some old Java graphics experience I have, my first thought was to re-render (literally create and destroy) the Sprite object housing the laser on a timer or Event.ENTER_FRAME. However, this immediately proved to be a poor decision, since it caused a horrible flicker, just like a Java applet that was animating without double buffering. So, needless to say, I needed to dig a little deeper into the core of the AS3 Graphics object.
Continue reading

Adding Links to a Dynamic Flash AS3 Slideshow

Those of you who may have followed my previous Flash AS3 Slideshow post may have noted that it was rather limiting in function. While there are sometimes valid uses for a slideshow to statically transition between images (whether or not those images are dynamically loaded), there are typically much more useful things we can do in the presentation. In this post, we will review how to add an optional link to each slide in the XML data that will then turn the individual slides into hyperlinks whenever they are displayed.
Continue reading

Introduction to Manual Compiling with Flex SDK

So, many of you have sent me emails or asked me in person about how, exactly, to get started playing with the Flex SDK without having to pour any money into unnecessary resources or IDEs. First, let me say that purchasing and using Flex Builder will be one of the best investments you can make in your Flex development learning, but yes, you can indeed download the SDK free of charge and manually compile AS3 and AIR applications. This will be a very simple post dealing with just how this can be done. While there are many, many, many details we could approach, I want to tackle this issue in its simplest form and hopefully get people on the ground running within minutes of reading this post. Please note that this will be written for Windows users, though I highly recommend people set up a Linux environment and play with the command line tools there as well, if possible.
Continue reading

Dynamic XML Slideshow in AS3

Over the past year or so, I have been responsible for developing and maintaining a JavaScript Slideshow component for our internal CMS. With the similarities between JavaScript and Actionscript, I have wanted to implement this slideshow in a manner consistent with the flexibility and usage of the JavaScript version. The biggest difference is that the JS one is focused on content, and the AS3 version will be focused on pictures – since AS3 does not fully support markup and CSS yet. This being said, I have had opportunity to attack my project and have the first phase completed. As with so many of my other personal projects, I’m tackling it in phases rather than having a defined spec list ready to go. In this case, I have the slideshow reading an image list from an XML document, loading the individual pictures and setting them on a timed rotation.
Continue reading

Simple Actionscript Shooter Phase 1 (AS3)

Well, OK, it’s not much of a Phase 1 – more like Phases 1, 2 and 3 all rolled into one simple demo, but for my purposes, the name will suffice. Many different ideas and techniques have been rolling around in my head for months, and I finally decided to try and find a simple way to implement some of those ideas into a working model; and what better way to do so than a classic shooter?

With flash gaming sites like Kongregate and ArmorGames offering incentives – and even revenue – to developers, I thought it about time to start put something together and just see what comes of it. Obviously, I have a long way to go, but here is a preview of a little application on which I am currently working.
Continue reading

Embedding Fonts into Actionscript Only Project (AS3)

Embedding fonts has been a bane to me for some time, and I finally spent the time to find both the easiest and most comprehensive way to embed needed fonts into a SWF using AS3 only. As always, I try to keep the demos here as lightweight as possible, and I have tried to keep any code snippets I give free from external resources. In this case, there is a small exception, but it is only the exception of using one of the fonts installed on your own computer.

Basically, we need to understand a couple things about the nature of the embedded font in Actionscript. First, it must be assigned to a String in order to store all the character references. Next, you will quickly find that creating and implementing a TextFormat object to attach the font and styles to the different places in which it will be used is ideal. Finally, keep in mind that attaching several fonts to a single application can significantly increase the file size, so try to consolidate and style for variety as much as possible instead of selecting a boat load of different font faces.
Continue reading

Map Handling Take 3 – Hover Over Borders (AS3)

Well, at the risk of sensory overload today – it’s my blog after all – I decided to post one more version of my map handler. This one adds in the classic mouse hover scroll effect at the edges of the map. I did try to make it a bit more usable, though, by calculating the distance from the edge of the map and accelerating the movement appropriately. So, the closer to the edge you are, the faster the map scrolls. So, to recap, you can use the following methods to move:
Continue reading

Drag Viewport for Map Preview in AS3

So, a really quick update post here. Upon publishing my previous post, I received some great feedback from gamer friends who thought a good way to improve the interaction would be to allow for dragging the preview marker around to update the viewport in addition to simply clicking. After giving this some thought and suppressing some immediate concerns about the overhead calculations this might take, I have implemented this change and am interested in getting some feedback. Of course, all the other features (like clicking the preview and navigating the map using the A, S, D and W keys). Feedback welcome as always…
Continue reading

Handling Larger Maps in AS3

I have been working on some ideas for a TD game that would be both entertaining and original, and I feel that – with the help of a couple friends’ input – I’m on the way to something worth developing. Since I have already put together much of the “guts” for a TD game, I am hoping that I will be able to quickly put together a prototype in my free time. Ideally, once I have a prototype together, I will be able to find a sponsor to pay for development, and I would then be able to focus some solid time on the project, but that is a bit optimistic at this point, since we are still in the baby conceptual stage.

Without giving too much away on my idea, I’m going to try to cover some concepts and specific ideas that I have had to resolve in order to visualize different portions of the interface and interactions. The first thing I realized was, to fully succeed with the idea I want to implement, I would have to be able to support fairly large maps (in some remote cases, massive may be a better term). Having been a long time RTS (Real Time Strategy) player, I decided to take some cues from them and implement a similar map-handling system. Surprisingly, once things started falling into place, it was quite easy to tweak and get working to a satisfactory level.
Continue reading