Tuesday, December 13, 2011

Arguments and Methods in Scripting

Arguments and Methods are two more important concepts in the scripting world. Without these two pieces of code the objects are there, but nothing can happen because nothing is telling it what to do.

Lets refer back to our code that we wrote for the objects.

jump_btn.addEventListener(MouseEvent.CLICK, personjump)
function personjump(event:MouseEvent){
              person_mc.gotoAndPlay("jump");
}

The parts that are highlighted are methods. Methods essentially hold functions that affect the object in some way. For instance, in the first method it is holding MouseEvent.CLICK, which means that nothing will happen to this object until the mouse clicks on the the object which in this case is the jump button. Also, the easiest way to figure what is a method, is by looking directly after it. Methods are always followed by parentheses. They may have stuff in them and they may not, but they always have parentheses.

Now lets look at that code again.


jump_btn.addEventListener(MouseEvent.CLICK, personjump)
function personjump(event:MouseEvent){
              person_mc.gotoAndPlay("jump");
}

The next part that is highlighted is an argument. Arguments reside within the methods and give information to the methods on what needs to happen when the button is clicked. For example, the personjump argument is listed below in the second line as an argument then. It is now holding important information. The information is what actually happens meaning the person is going to jump. The timeline is going to move across to wherever it is marked "jump." Essentially this particular method links the two parts of top and bottom. The button will not cause the person to jump unless personjump is telling the person to jump on the timeline.

Functioning App

Finally after we made the documents in Photoshop, we created interactive pdfs and then finally animations briefly showing how our apps would actually function. This video just goes through some of the things you can click and modify in order to give you a taste of the possibilities this app has to offer.

PSD Documents

For about a month since I posted my ideas I have been battling through many different looks of how my app should look like. However, like most good designs, you can't expect them to be perfect on the first go through and mine wasn't. I would say I went through about five major changes until I found the best layout of how my major pages should look in terms of content and layout. Below are the finalized versions of my three main pages and one sub-page.