Category Archives: Flash Games

Develop Flash Player 11 and Air 3 Applications (Desktop and Android)

If you haven’t heard already, Flash Player 11 and Air 3 were announced and released at Adobe Max earlier this week. Since it’s out to download, why not take advantage of staying updated and start making cool applications with these new API’s.

Download these files
- You need the AIR SDK

http://blogs.adobe.com/flashruntimereleases/2011/10/04/flash-player-11-and-air-3-now-available/

- You need the PlayerGlobal (.swc)

http://www.adobe.com/support/flashplayer/downloads.html#fp11


Comparing String in Flash AS3

I’m making my first iOS and Android game. While coding this game, I wanted to compare two strings. I thought I could just use someString == stringXYZ. After some tests, I figured out my if statements where not being read. After some searching, I found out to test a string you need to use the Collator class. Once I coded the if statement using the Collator class, my if statement finally worked. Below is some notes on how to use the Collator class.

I want to give credit to the Adobe Flash platform documentation. This is where I found out about comparing strings.

http://help.adobe.com/en_US/as3/dev/WS9b644acd4ebe59998b99a90125fc4fecfb-7ff8.html


var myMatcher:Collator = new Collator("fr-FR", CollatorMode.MATCHING);
if (matcher.equals(string1, string2))
{
trace("we have a match!");
}


How to get your Flash Applications on Facebook!

fcebk icon

This posting will teach you how to get your Flash applications on Facebook.

1. The first thing you want to do is log in to facebook. Then you want to click the developers link on the bottom of the page. After that, click the ‘Apps on Facebook.com’ link on the left.

2. Go down to the ‘Getting Started’ headline and click, ‘register your Facebook application’.

3. Fill out the Application Name and click the ‘Agree’ radio button.

4. Fill out the Security Check.

5. At this point, you should be at the Application Settings page. Fill out the description of your application.

6. If you have a logo and a icon, click the links ‘Change your icon’/'Change your logo’.

7. Next, click the ‘Web Site’ link on the left of the page. Copy your Application ID and Application Secret to a text document for later use. Make sure to click the save changes button.

8. After you have copied the Application ID and Application Secret, fill out the site URL. This URL is the URL of were you have your website page stored on your hosting.

For example, when you are in Flash, and published out the application to a SWF and HTML. You take those files and put it on your server. The URL to those files is the URL you will put into the Site URL blank.
ex: www.mydomain.com/apps/

I used index.php as my page, so I don’t need to reference the page.

9. After that, fill out the Site Domain.  Then click the save changes button.
ex: mydomain.com

10. Then, click the Facebook Integration button the left. Go to the Canvas section. For the Canvas Page, fill out the blank. As you can see, you are making the URL for your application.

Ex: myGame

11. The next step is to fill out the Canvas URL. This is the same as the URL you filled out in the last section.
ex: www.mydomain.com/apps/

12. Select the ‘IFrame’ radio button.

13. Click the ‘Auto-resize’ radio button.

14. Under the Discovery section, make sure ‘Enabled’ radio button is selected. Then click the save changes button.

15. Then you should be at the My Applications page. Go to the bottom and click the ‘example code’ link. At the top, you’ll see

$ curl -L http://github.com/facebook/php-sdk/tarball/master | tar xvz
$ mv facebook-php-sdk-* facebook-php-sdk
$ cp facebook-php-sdk/examples/example.php index.php

Download: http://github.com/facebook/php-sdk/tarball/master
Extract the folder to your desktop. Rename the folder to: facebook-php-sdk.
Upload that folder to your server. Make sure to put it in the same folder that you uploaded the SWF and HTML files that you published from Flash.
The directory of the files that you just downloaded is similar to: www.mydomain.com/apps/facebook-php-sdk/.

16. Now you want to go into that html file that you published from Flash. Copy and paste this code right under the <body> tag. The text after the // can be changed to anything you want. Go the the 'appId' part in the code and put your application's appID that you copied to a text document. Do the same for the 'secret'. 

<?php
// Awesome My Application
//
// Name: Application
// 

require_once 'facebook-php-sdk/src/facebook.php';

// Create our Application instance.
$facebook = new Facebook(array(
 'appId'  => 'YOUR CODE',
 'secret' => 'YOUR CODE',
 'cookie' => true,
));

?>

If your Flash application is on a php page, do this next step, otherwise, skip this step. Go to the html page that you published from Flash and copy the code that starts with ‘<object classid’ all the way to to, ‘</object>’.

Above the ‘?>’ line of code, put this line of code.

echo ‘<CENTER>

Paste that code that you copied from the HTML page that Flash copied and paste it right after the <CENTER> tag. Right after the </object> tag, type:

</CENTER>’;

It would look similar to:

echo ‘<CENTER><object classid=”

</object></CENTER>’;

Save the page and upload it to your server and replace the previous file.

17. To view your application. You should still be at the My Applications page. Click the, ‘Application Profile Page’ link on the right. Then, click the ‘Go to Application’ button on the top left. You should see your Flash application.

flash_application on facebook

My Flash Application on Facebook

Click the picture to test it for yourself!

I am not affiliated with Facebook.


Actionscript 3 Character Shooting – Flash Games

Flash Games are very popular over the internet. The games that seem to be the most fun are the ones that having shooting in them. I used to make tons of these type games when I used to develop games in Director. Since Flash is faster and is widely used, I thought I try making a simple shooting bullets. Besides shooting bullets, I wanted to see if I could get the ship to move in all directions and have the bullet shoot in the direction that the ship is pointing.

This experiment was something I’ve started months ago, but got sidetracked and got interested in learning more about Air and the Tweetr API. Also, I was having difficulty with getting the angle of the ship passed to the bullet, so the bullet would go in the direction that the ship is facing. I knew that I would have to use a getter and setter method, since I developed this experiment using Object Oriented Programming (OOP). I was having trouble figuring out how getter and setter works. When I switched to learning about Tweetr, I came across the same problem with trying to get the input username sent to another class that logged the user in. Fortunately, I finally got it to work. Now that I found some time and figured out how the getter and setter works, i just had to come back to this experiment and get it working.

The key of this experiment is know how to convert angle to radians, since Flash doesn’t calculate angles. Flash calculates radians.

AS3 character shooting, Flash games

View it


Flash Games – Jumping

One of the things that I’ve wanted try was making a character jump an having it all done with code. This experiment started a few months ago, but got put off due to wanting to redo my portfolio and experimenting with one of the Actionscript Twitter API’s, which is in progress.

Flash Games, Jumping animation

Character jumping


Follow

Get every new post delivered to your Inbox.