Archive Page 2

Hide .svn Folders in Flex Builder

If you’re working with Subversion (and you should), you probably noticed the .svn folders in Flex Builder’s Navigator pane. It doesn’t really bother me that much seeing those folders in there but I wondered if they can be hidden to make the source tree a bit cleaner. It turned out that it’s just as simple as activating a filter for the Navigator pane. Simply select the .* filter from the Navigator menu according to this thread.

Unable to Debug in Firefox 3

After installing FF3 a few weeks ago I found myself unable to debug my Flex projects using it. I resorted to using IE as my main debug browser. This worked fine at first but I still really needed to debug in FF3. So today I tried looking for a possible solution and came accross this bug. In a nutshell, the bug is about incompatible add-ons in FF3 that prevents the Flex debugger from running.

For my browser it was Google Toolbar that’s causing the problem, uninstalling it allowed me to debug again. Good thing it wasn’t Charles or TwitterFox.

PureMVC Notifications

I’ve been trying to play around with the PureMVC framework during the past few weeks and I would like to post my thoughts on the subject. This will serve as my reference later on and may also be of help to others who are interested to learn the framework. One obvious thing I should point out is that the learning curve for PureMVC is quite steep. Familiarity with the concept of design patterns is a requisite to be able to understand the framwork.

Notifications are similar to Flex Events. This may seem like a duplication of function at first but as you gain more understanding of this concept, you’ll learn to appreciate its purpose. Also a major reason why notifications exist is the language and framework agnostic nature of PureMVC. This approach made it possible for PureMVC to be ported to other languages or frameworks, not just Flex or AS3.

I’ll now proceed with the discussion of the major components of PureMVC and how they behave in relation to Notifications. I recommend going through the Minimalist MVC Example first to gain an understanding of the components that I will be discussing.

Continue reading ‘PureMVC Notifications’

Flex 3 Cookbook

I just found out that my recipe, How do you display swf objects as items in a Menu using an item renderer?, was included in the recently released O’Reilly book, Flex 3 Cookbook. You can view a sample of the recipe here. It’s in Chapter 7 with a title of Display SWF Objects as Items in a Menu by Using an Item Renderer.

I wonder if the contributors will receive a complimentary copy of the book…

I also would like to apologize for the lack of updates recently. I have been very busy with studying PureMVC and with my new job. This means most of the articles that I will be publishing from now on will be related to this framework.

CHILD_REMOVE Event Triggered Before Actual Child Removal

One of the many things I learned from my development experience with Tongits is that the CHILD_REMOVE event of the ChildExistenceChangedEvent object actually happens just when a child is about to be removed and not after the child was removed. This means numChildren is still the same inside a CHILD_REMOVE event listener. On the other hand, the CHILD_ADD event happens after the child has been added to the display list.

Thrower – A Simple Ball Throwing Game in AS3

 A Simple Ball Throwing Game in AS3

This is a small experiment on simple ball physics and collision detection wrapped in a frustratingly difficult game. You have to successfully shoot a ball to progress to the next level. The arrow simply rotates by 1 degree on each level. If you successfully complete all 51 levels you’ll be able to play the game in “free play” mode where you can control the direction of the arrow with the mouse. If you manage to finish the game please do tell us about your accuracy rating and how many minutes it took you to win the game. It took me about 15 minutes to finish the game with a very low 24% accuracy. I think this kind of gameplay coupled with a nicer reward system plus better graphics has potential to be a nice little flash game.

Play Thrower

Source Code 

How to Make a Tetris Game in AS3

TINT - Tint Is Not Tetris

I had some free time this week so I tried to make a Tetris clone. It is a complete game in under 600 lines of pure AS3 code. It mainly uses 2 dimensional arrays to represent masks for the bricks and to make collision detection easier. The output is simply a bitmap data filled onto a shape object and then scaled to a more comfortable zoom level. I did not refer to available algorithms online, I tried figuring them out by myself so you might find them to not be the most efficient.

Just add some sound, fancy graphics and high score submission and this could be a nice little online game though TTC won’t be too happy about that. I named the game TINT for Tint Is Not Tetris.

Play TINT

Source Code

Disclaimer: This is purely for educational purposes only.

Custom Menu Project Files

Custom Menu

Shashikurlemali asked a few days ago for the projects files for my Creating a Custom Menu Using Item Renderers tutorial so here it is. Just right click on the demo to view the source and download the zipped project files. I lost the original project files so I had to create a new one with new SWF objects. I also added item click event handlers.

Here the SWF objects are loaded at runtime, it is better to just embed them since they’re just a few kilobytes. I’ll leave that as an exercise for you.

Tongits: An AIR Powered Game

Tongits Game ScreenshotI have just released version 1.0 of Tongits, an Adobe® AIR™ based game that I’ve been working on for almost 2 months now. It is a significantly improved version of my old open source Tongits game. This time I decided to release it as shareware, registration is $15. I think this will greatly help in motivating me to continue working on and improving the game.

This is also a sort of experiment on the commercial viability of AIR as a game development platform. I have big plans for this little game including multiplayer support and online betting.

I hope you enjoy playing and if you think it is worth the $15 then please register. Thanks!

Visit Tongits’ Website

Simple Way To Invert The Colors Of An Image

Simple Way To Invert The Colors Of An ImageSimple Way To Invert The Colors Of An Image

We need to put the Image object inside a Canvas and create another Image object with the same source file inside the parent Canvas. We then set the new image’s blendMode to invert.

private function invert(holder:Canvas):void {
if (holder.numChildren > 1) {
// remove the invert effect
holder.removeChildAt(1);
} else {
var img:Image = holder.addChild(new Image()) as Image;
img.source = Image(holder.getChildAt(0)).source;
img.blendMode = BlendMode.INVERT;
}
}

« Previous PageNext Page »