SyntaxScrewer's Blog

August 5, 2010

Making an interactive chain in AS3 (without any physics)

Filed under: Flash — geekymaira @ 8:44 am

Heylo folks,

Many-a-times it happens that one makes an ill informed hurried analysis of a simple problem. This is followed by rapid questions on IRC / discussion forums etc, until someone
someone more sensible comes along and makes you realize what a dumb ass you’ve been. 😛

Well something similar happened to me the other day. The task at hand was to create an interactive chain sortta an element for a  project. I started thinking about Physics / The Bone Tool
Linked Lists and what not. I knew I was thinking too much for a simple problem but I couldn’t strike the solution. Then finally, I logged onto IRC and asked around.

Here was my question ,

The answer was – YES!
However, that’s not the one I chose.  The stuff I couldn’t figure out was the “Links” between the nodes.
How would they rise / stretch when the node rises on rollover.  Do I rotate them? Do I scale them ? What should I do ???

The solution was elementary – Anchor the links to the nodes and redraw the links every frame.
That way when a node’s position changes, the new link is drawn from the previous node to  the new position, thus giving
a “stretching” effect when  you use a tween to update the  nodes position. (more…)

July 21, 2010

Firefox MouseWheel Problem with Flash Embedded Objects.

Filed under: Flash — geekymaira @ 10:19 am


It’s been a while since I posted something new on the blog. I remember running into some problems a while back with custom flash scrollbars , the mouse wheel and firefox!

The problem was that my code worked great in flash player but started messing up when I tested it on Firefox after embedding the swf into an HTML. Internet Explorer didn’t have an issue with the scrolling (although I had to click the flash object once to activate it), but for Firefox it failed miserably. So I googled like crazy, found a few workarounds and after reading countless articles and a few code hacks, I discovered that it was a problem with firefox. In very simple words, firefox liked taking control of all the MouseWheel events that occurred on the page. So they never reached my flash object  like I wanted them too : ).  Moreover, I had 2 scrollbars on the stage and one MouseWheel event. So even when the MouseWheel event was passed to my flash object from the browser (if ever), it didn’t control the correct scrollbar. I’m not sure if only 1 worked or both did. It’s been a while.

Anyway, what was the solution ? (more…)

My first *decent* looking flash game.

Filed under: GameDev — geekymaira @ 10:01 am

This is just a gameplay demo right now but I’m still proud of it 🙂

Someone told me that they didn’t understand WHY they were annihilating bugs in the game. I thought about it. They were right. The game has no story, no valid reason for a player to be killing bugs, but that’s the fun of it. It’s kindda instinctive I guess. You give the gamers a gun, some ammo and show em bugs crawling on their monitor. What do you expect them to do but FIRE!! .

Hey, I’m not saying there isn’t a concept behind the game. There is a very valid reason to why I decided to make a game with bugs and a cannon but I’m wondering now, if it’s such a good idea to state it in public. 😀

Anyway, Hoping to get feedback!!



Papervision3D resurrected

Filed under: PaperVision 3D — geekymaira @ 9:47 am


So I’m back on the papervision wagon and its amazing. I’ve been playing around with shaders and bump maps and what not.
Hope to get a 3D game up and running soon. Need to closely monitor the fps  and the memory/cpu utilization because almost
everything that looks good needs more processing power.

I will try and post some examples of the fooling around I’m doing with this library.



May 1, 2010

Newline “\n” problem when reading a text file into a dynamic text field. Why do I see 2 new lines instead of 1 ?

Filed under: ActionScript 3.0,Flash — geekymaira @ 1:40 pm

Hello :),

I was working on something really simple the other day, loading up a text file using the URLLoader.
I didn’t even bother testing my script because I thought there was no scope for errors in something this elementary
but I was wrong!

A friend of mine pointed out that the dynamic text field was showing up “Double Line Spacing” while displaying the text.
I checked and was confused. I thought maybe the text file had changed so I checked it. But it looked alright. So why was
I seeing 2 newlines for every one “\n” that my text file had.

Well here’s why!

Apparantly, when URLLoader read text from my text file and encountered a “\n” , it changed it to a “\r\n”. I’m not sure if URLLoader did that
or if it was stored like that in my text file. Anyway, when the dynamic text encountered a “\r\n” it put in 2 line spaces instead of one. I guess one
for the “\r” and one for the “\n”.

Here’s a trick I found while searching to solve the problem. It works well 🙂

var myTextLoader:URLLoader = new URLLoader();
myTextLoader.load(new URLRequest("temp.txt"));

function onDone(evt:Event):void
	var myData:String ="\r\n").join("\n");
	myText.text = myData;

Basically what’s happening up there is that the “\r\n” are getting replaced by a single “\n”.

February 26, 2010

Collision Detection Tip – Using nested mc’s

Filed under: Flash,GameDev — geekymaira @ 10:55 am

I was trying to get a bullet to collide with a bug(enemy) on the stage. The bullet_mc had a small animation which shape tweened the bullet into a splash.
I wanted this animation to play when the bullet hit the enemy and appear on top of the bug, to depict that the bug had been squatted by the bullet.
So I detected the collision using hitTestObject , stopped decrementing the Y for the bullet (To stop it from
moving upwards) , and called the function on an active collision to play the splash animation.

But, I ran into some problems. (more…)

February 25, 2010

Restricting a nested movieclip from resizing when the parent mc resizes.

Filed under: Flash — geekymaira @ 5:09 pm

Download Source


My colleague ran into a small problem at work the other day. He wanted to resize a movieclip but didn’t want it’s child to resize relatively.
He figured out another way to tackle it , but it got me thinking and after toiling a bit I came up with a working solution.

The solution , uses the functions localToGlobal() and globalToLocal() . These are one of the most confusing functions I’ve ever come across
in Actionscript. I will write an article about them and try and explain them in really simple terms.

For now, lets focus on the problem at hand. (more…)

February 19, 2010

KeyBoarder – A multiple key press / state manager library

Filed under: ActionScript 3.0,Flash — geekymaira @ 3:55 pm

Download Link : Keyboard Library

I’ve recently started using the KEY_DOWN events a lot to detect movement in some projects I’m working on.
But I faced problems , solutions to which are available and I incorporated them too. But I wanted a better
optimized solution. So , I created my own library to handle it.

Let me explain the problem(s) and how I solved them using my library. (more…)

February 17, 2010

Papervision3D , simple 2 cube example.

Filed under: ActionScript 3.0,PaperVision 3D — geekymaira @ 9:47 am

So. I started experimenting with Papervision3D and I have to say, it’s amazing.
This has been the first 3D application I’ve ever made and it feels great :).

Here’s a working demo : View Demo

I’m sorry the guys at WordPress say I can’t embed swf’s for security reasons 😐

Hope to experiment more with PV3D. A “game programmer” friend of mine pointed out that the FOV of the
camera is not correct. That’s why the cubes stretch. I’m trying to find a way to change the value of the FOV.

Any ideas?


– SyntaxScrewer

February 16, 2010

How to preload a video using NetStream

Filed under: ActionScript 3.0,Flash — geekymaira @ 10:09 am

I ran into a small problem at work and I did a little research but couldn’t find any concrete solutions to this. But, I managed to get it working somehow.
The requirement was that I had to show a small progress bar before playing a video stream. In other words, I had to make sure that the video started
playing only once it had completely buffered.

The thing with NetStream is that it doesn’t provide any nice ProgressEvent that can be used to track the progress. So there was a problem. How do we
detect the progress? (more…)

« Previous PageNext Page »

Blog at