AS2: Subservient Chicken Tutorial

Last year, I created the source code to make Burger King’s Subservient Chicken for one of my class projects. It was a lot of fun and I am finally releasing the code on my blog. It was pretty easy, just take a look at the code.

Description of the Project

Super Fred AS2 creates a Burger King Subservient Chicken-style interface to control the actions of a video character on screen. It allows keyword String matches in AS2 and loading and queing of video files of the matched video that meets a certain video keyword criteria.


Step 1: Introduction

Okay, once again, I have lied. This is not really a tutorial. The code however is very well commented and I hope you can follow along very easily. I made this about 1.5 years ago so please don’t spam me if you can find a better way of doing it. I was newb then and I am n00b now =). But it doesn’t mean you can’t take the code ;) and make it better.

Also note, that due to recent advances in AS3, I would highly recommend going with that route rather than using my older AS2 version. This demo is merely to show you how crappy I was 1.5 years ago lol… just kidding. Speaking from an AS3 point of view, you can use the same concepts applied within this package to create the same effect. It is still a good example for newcomers to Flash and I hope you find this useful if not entertaining.

In case you haven’t seen the subservient chicken website, go here and check it out first to know what you will be making: http://www.subservientchicken.com/

Download the Package Here:

as2-subservient-fred.zip

Here is the completed project that earned me an A+:

http://www.ayanray.com/img/blog/2007/11/subservientfred.swf


Step 2: Taking the Videos

Taking and editing the videos is the hardest but most fun task for this project. You and a couple friends can get a video camera and tripod (from somewhere) and set it up in a nice open room. After that, go wild and make sure your character is always in the same spot at the beginning and the end by marking an X with tape where he/she will stand. The sky is the limit on this one and as you can see from Burger King’s Subservient Chicken, they really went wild.


Step 3: Using the AS2 File

Using the AS2 File is a piece of cake. All you need to do is setup the 2 arrays at frame 1 of subservientfred.fla. I think it’s self explanatory. Anyways, that’s it. Enjoy!


Links

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Related posts:

  1. Self-Service: Subservient Video AS3 Flex 3 As my first self-service application, the Subservient Video AS3 application...
  2. AS3: Apple’s Leopard Time Traveller Tutorial Okay I lied, this isn’t really a tutorial. This is...

About Ayan

Ayan Ray is a creative technologist living in the San Francisco Bay Area. He specializes in creating applications for Flash, PHP, Android, iPhone, and HTML5/CSS. He holds an undergraduate degree from Carleton University in Information Technology with distinction and numerous awards. This blog is all about his observations in technology, entrepreneurship, and his daily life. In his free time, he enjoys reading, staying fit by swimming, playing soccer and volleyball, and spending time with his friends and family.
This entry was posted in Flash and tagged . Bookmark the permalink.

6 Responses to AS2: Subservient Chicken Tutorial

  1. jamie says:

    I noticed that you had setup 2 videos called "none" and "none2" im just wondering if you were thinking of implimenting how to play a video if something was entered that didnt match ?

    is there an easy implimentation of something like this ?

    i was looking around the match loop at the top of textsearch.as

    any ideas ?

    otherwise great work , you deserved the mark and definetly nailed it !!

  2. jamie says:

    lol , sorry i figured it out , tre stupid of me !!

    My issue came along when i was using none.flv , since the video was shorter then 5 seconds and the buffer would tie the video up and not play back to the loop video.

    i made this simple adjustment to the loop

    if(checkWord(words[i]) == true){

    checkWords[numb] = words[i];
    numb = numb + 1;
    }else{
    //trace(labels[11]);
    checkWords[numb] = labels[11];
    numb = numb + 1;
    }

    and then i associated a new 11th clip and keyword in the initial arrays which i added..

  3. Ayan says:

    Thanks for your comments! I am glad you liked it! This was an old project and if you want to do an AS3 version, let me know. It could be very beneficial to others.

  4. Dustin says:

    Hello Ayan, this is a fun program to learn Flash with! Thanks for posting it. I've used this to create my own subservient character, the only thing I wish I could do is make it recognize unique objects in the user commands. Like what if you have two books, a red one and a blue one. It's easy to call up a video file for the command READ BOOK. But is there an easy way to make your program call up a different video for both READ RED BOOK and READ BLUE BOOK without rewriting the entire script? Thanks for any help if you get this…

  5. Ayan says:

    Hi Dustin, I am glad you like it! The way the script works is it searches for keywords. So, if you order your key words like "blue", "read", "book" vs "red", "read", "book", it should work fine. If this doesn't work, I'm afraid that you will need to change part of the code. Thankfully, you would only need to edit the keyword matching. To give you an idea on how you could change the keyword matching is to do this: for each word that the user enters, loop through the video list to see if any words hit (how it works now). At the end of looping through all the search words, you can add up all the search word hits for each video. Then you can just pick the one with the greatest number of hits (given that it is a successful match!). Hope that gives you some good direction and good luck!

  6. Dustin says:

    Hello Ayan, thanks for the tips I'll try them out and see what I can do!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>