Tilegame level editor in Flex
In my spare time I’ve been working on a tile-based level editor. It is still in development, but has the basics covered. The idea is to make it available for free when it is done. It will be a standalone Air application (so it can save files to the disk) and hopefully will become a full game development tool. Here a video of the basic features currently available, if you are interested to beta test the app when it is done leave a message with your email so I can contact you when the beta is ready.
I got inspired making this editor when I was reading this tile game tutorial by Mattias Stridsman. I wrote a tilescrolling script based on this tutorial that will be used for previewing and testing the levels within the editor. In my opinion this way of making game levels is more versatile than using grid based tile levels where each tile needs to be defined, where in Mattias’s example you cluster tiles in one rectangle so that you only describe the position, dimensions and graphic of the tile.
The artwork used in the video is by David Baumgart
Filed under Actionscript 3, Air, Flash, Flash Games, Flex | Comments (2)Alpha blending CSS TextFields in ActionScript 3
The problem I encountered with CSS driven TextFields in AS3 was that I was no longer able to use “embedfonts = true” to be able to set the TextField alpha. To solve this issue you can use blendModes on the TextField object, as in the following:
myTxtField.blendMode = BlendMode.LAYER; myTxtField.alpha = 0,5;
This also works with a mask over a textfield.
Example
Do realise that using blendmodes you increase the clients CPU load.
Filed under Actionscript 3, Flash, Flex, linkedin | Comment (0)Flash Media Server Eclipse/Flex Builder plugin
I stumbled upon this FMS plugin for Eclipse. Unfortunately it is beta and never finished, but it still helps enough to write your FMS apps allot faster. It was originally available on fczone.net but for some reason that site is no longer part of the internets.To install, just drop it in you Eclipse/Flex Builder plugin folder.
Filed under Actionscript 3, Flex | Comments (3)
BitmapData/draw() and checkPolicyFile
Today I ran into the following error:
SecurityError: Error #2122: Security sandbox violation: BitmapData.draw: http://exampledomain.com/file.swf cannot access http://exampledomain.com/images/image.jpg. A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
The error was generated by a class in our util folder that we use quite much, but we never had this problem. Well as the error is mentioning, the checkPolicyFile is not set because the LoaderContext is set to null when you don’t supply one in the Loader.load(request:URLRequest, context:LoaderContext = null):void. The strange thing is that the browser is loading the images, only when I create a bitmap and want to draw() the bitmapData I get the above error. I don’t get why it doesn’t check the policyfile when I request the image from a different domain. In order to get rid of the error I did the following:
1 2 3 | var loaderContext:LoaderContext = new LoaderContext(); loaderContext.checkPolicyFile = true; Loader(_loader).load(_req,loaderContext); |
So adding the loaderContext with checkPolicyFile on true does the trick.
Filed under Actionscript 3, Error handling AS3, Flash, Flex | Comments (8)AS3 onReleaseOutside
It seems to be that the ReleaseOutside we all know from Actionscript 2 is no more in AS3. Why? I don’t know. I noticed allot of people having problems with this lack of feature. The work around has been published all over the web, another reference here will help spread the word. The idea of an onReleaseOutside MouseEvent is that you detect if the mouse is not over the object when it is up. So what you simply need to do is relocate the MouseEvent.MOUSE_UP from the object you want to detect to the stage. So what does this look like?
// constructor public function MyClass() { //we use this event to obtain the stage object addEventListener(Event.ADDED_TO_STAGE, onAdded); } // stage object is now available private function onAdded(e:Event):void { addChild(_yourbutton); _yourbutton.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); } private function onMouseDown(me:MouseEvent):void { trace("mouse down"); stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp) } private function onMouseUp(me:MouseEvent):void { trace("mouse up"); stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp) }
I hope you find this useful.
Filed under Actionscript 3, Flash, Flex | Comment (0)Virtual Soundscape with DDR input
A friend of me called me this week that he had a problem with a assignment for school. He wanted to make an original concept for this circus poster assignment, and chose to make a poster for the blind. Earlier that week (he was also over for an assignment) he saw my DDR Dance Mat (that I bought earlier to experiment with) and proposed the concept of making an interactive poster with relief that can be pushed on different sculpted sections of the poster. After messing around with a piece of foam, trying to sculpt it in recognizable shapes we realized that that wasn’t going to work. We dumped the foam and started to think of an other concept, we ended up with a virtual soundscape that is lets the user roam through the circus environment.
Here we see the visual representation of the virtual environment (click the image to see the demo). The black dot is the user and is controlled by a DDR Dance Mat. The red dots are sound source, around the red dot you can see the range of the audio that is connected to its volume. For the Dance Mat input we used a app called ControllerMate, this is a small application for the mac that can recognize USB devices and port these trough to all kinds of output.
If you would like to see how it is done, click the following link to download the source files (Actionscript Project made in Flex)Source.zip [11.34 mb]
Filed under Flash, Flex, Input Devices | Comment (0)LocalConnection and ExternalInterface
For my Flashden portfolio I made an example of the different ways of communicating between different SWF’s and the browser. It demonstrates the bi-directional usage of LocalConnection and ExternalInterface.
It is written in AS3 together with a little piece of javascript and needs to be run in a webserver environment to avoid sandbox violations.
Filed under Actionscript 3, Flash, Flex | Comment (0)
