Skip to main content

Posts

Showing posts with the label Actionscript

Parts of A Flash Game

If you are going to make a Flash game here are the things you need to make. 1. Pre-Loader. Although broadband is the standard connection now a days there are still some who use the internet using slow dialup. A preloader would insure that your player see's something like a percentage counter. Instead of getting the notion that your program might have hanged. 2. Intro Screen. This contains the title of your game. 3. Instruction or Help screen. Helps the player know how to operate the game. 4. Game Level Screens. 5. Game Loop. Is the heart of a Flash game. It is an infinite loop but can be stopped when certain conditions are met. Like if the player completes the game or the game hero or heroes die. The game loop is responsible for tracking the various status of ingame objects and ensuring that they perform their programmed tasks based on player commands and ingame conditions. 6. Game Over / Retry Screen. Shows up when the player loses. It can also show the High Score s...

Actionscript: Custom Random Function

I made a custom random function in case you are looking for a random number generator in Actionscript. Actionscript has a random number function but it does not really allow you to specify a minimum and maximum range. Here is the code: private function getRandomNumber(min:int, max:int):int {     var xRandomNumber:int;     xRandomNumber= Math.floor(Math.random() * (max -1)) ) + min;     return(xRandomNumber); } // getRandomNumber

Back from Neverland

Wow. I leave for couple of weeks and the traffic has dropped 75%. Lol. I guess blogging is kind of like office work. In the office you are slave to the bosses. With blogging we are slave of our readers and the almighty search engine - Google. Google show me some love please. Bring back the precious traffic. I promise I will try to update as often as I can. Please. Anyway, kidding aside, where have I been? I would like to tell you that I have been hauled in the basement for the past weeks. The only problem is we don't have a basement. So let me just say, I have been busy with something. Here is an article about  Flash Game Development to give you an idea. Programming games is what got me interested in computer science in the first place. It is something that I always wanted to do. It has not been a viable profession years ago unless you live in the US. Not until the past two years. Thanks to the internet, now anyone can enter this industry irregardless of where you are...

Adobe Flex: How to Embed and Display SWF Assets

I have an swf file, published for Flash Player 9+ that contains two symbols. I am going to need one symbol which is actually a movie clip. This movie clip is named Jar and it comprises of two frames. The first frame is a picture of an okay jar. The second frame contains a picture of a broken jar. How do we embed and display this in Flex 3? (I will assume you are familiar with Flex 3) ... import mx.core.MovieClipAsset; import mx.controls.Image; [Embed(source="myassets.swf", symbol="Jar")] [Bindable] public var JarClass:Class; ... That is about it when declaring it in Flex using Actionscript. Now lets displaying using a function. I made a function named init() which I call every time the CreationComplete event of the application is executed. Here is the function: private function init():void {      var myJar:MovieClipAsset = MovieClipAsset(new JarClass());      myJar.gotoAndStop(2); // Display the second frame   ...

Adobe Flex: Specifying Remote Object End Point

Update September 2009 :   (In Adobe Flex SDK 3.3 and older, there is a difference between mx.rpc.remoting.RemoteObject and mx.rpc.remoting.mxml.RemoteObject .  The first one does not have an endpoint parameter that is why you can't dynamically specify the endpoint using Actionscript. That is why I use mx.rpc.remoting.mxml.RemoteObject . But as of Adobe Flex SDK 3.4, you can now use endpoint parameter with mx.rpc.remoting.RemoteObject. ) This is the sample code I use to call a Remote Object in Actionscript rather than the usual Adobe Flex MXML tag. There are some advantages to doing your code this way. Like you can specify the endpoint dynamically. You will need this import statements. import mx.events.CloseEvent; import mx.collections.ArrayCollection; import mx.utils.ArrayUtil; import mx.rpc.events.ResultEvent; import mx.rpc.events.FaultEvent; import mx.rpc.remoting.mxml.RemoteObject; var clientrecs:ArrayCollection; ... I use a one fault handler for...

Adobe Air Versus Java Write Once Run Anywhere

Java's original intent was to allow developers to write programs and it is supposed to run in any OS without the need to change your code. Hence, it's slogan "Write Once Run Anywhere" . Unfortunately, Java was not really able to fulfill this promise. It is widely known that the different JVMs (Java Virtual Machines) are incompatible with each other. This is what Adobe AIR promises to solve. And so far if you run Adobe AIR applications like Klok, you will find that it will run exactly the same whether you are using Windows or Linux. I cannot however answer with regards to Mac. Because right now it appears that Apple, Inc. is not very fond of Adobe, Inc.