ActionScript Functions

Here are a few tips when using functions in Flash.
function callMe(){}

object.variable1 = callMe();
object.variable2 = callMe;
There is a big difference in how a function works depending on if () are used.
When you use () with a function you are calling it, at which point it runs its code and returns any values. When you do not use () it assigns the function to the variable name. The variable name will then be able to be used to call the function.

By |November 18th, 2009|

imbed your flash fonts

Flash allows you to imbed the fonts along with the rest of your media. This makes sure everyone working on the file has the same font. It allows Windows and Macs the same access to the flash file. Even more importantly it allows you to name the font so that you know its usage. Even more importantly than that is if you need to revisit the file months or years later you can be confident that all the pieces you need to work from that file are included.

To add a font in Flash do the following steps.

Open your Library.
Click the drop down in the upper right of the palette.
Click New Font…
A window will pop up where you can name your font. Personally I name them by their usage, such as page_header_arial_bold or drop_down_menu_eurostyle_ext. It’s always a good idea to use descriptive names in case you need to come back into the file months later.

Thats all there is to it. Now go forth and build brand new flash files confident that you will never loose the font

By |August 18th, 2009|

CSS Expressions

I’ve come across expressions in CSS style sheets and decided to investigate if they really were as powerful as they seem. Expressions are JavaScript code that is applied as part of a class in the style sheet,  this is useful for keeping all the elements of that class from expanding beyond a specific size for instance . While it may seem like a good idea it turns out that it is more likely to cause your webpage to lag. Expressions are re-evaluated every time there is any interaction with the page, instead of when you want it too.

The best practice is to use JavaScript. Especially with JavaScript libraries and frameworks out there the need for css expressions are gone. My recommendation is to Avoid CSS Expressions, use JQuery, Prototype, MooTools or Scriptaculous instead

By |August 15th, 2009|

To HTML or XHTML that is the question, isn’t it

With HTML 5 coming into use even as I write this it seemed like a good time to look over the various document definitions I may be calling on when coding webpages.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
The standard beginning to to XHTML 1.0 Strict documents. This is the standard DOCTYPE used across the web. You can learn which tags are no longer allowed here: zvon.org. You can follow this link to learn the rules that XHTML follows: W3G XHTML guidlines.

Slightly older is:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
<HTML>
<HEAD>
<META HTTP-EQUIV=”Content-Type” CONTENT=”text/html; charset=UTF-8″>
The main benefit of HTML over XHTML is that it has optional opening and closing tags and can even have empty tags. XHTML insists on the markup being properly closed and formatted. Although XHTML tags do allow you to open and close them in the same tag, such as <br />

Now comes HTML 5.0 which adds many new elements and provides a way to play video and audio files without additional plugins. The beginning of the HTML 5.0 doc is as follows:
<!DOCTYPE html>
Thats it. HTML 5 is definitely designed to be much more streamlined than the two previous markup languages. They also changed
<div id=”header”> to <header>
to name just one new tag. They are really  simplifying the markup so that they can push layout to the style sheet and just have the data in the html document. HTML 5.0 takes webpages one more step toward XML. You can find more information about HTML 5 here: w3 developer docs HTML 5 you can also find which browsers are supporting it at: Browser Comparison on Wikipedia

By |August 12th, 2009|

KODU – EKG Respawner

For those of you new to the latest Xbox Community game Kodu, it is a game creation engine that allows you to build using a simple modular system that is fun to work with. Having built a few games in it I thought I would share solutions to some of the more complex techniques used in other games.
The most common is allowing players to repawn when they die.

THE EKG RESPAWNER – The idea is the player is telling the respawner that he is still alive. when he stops the respawner makes a new player.

Player
WHEN 3 Sec DO +1 score **

Respawner
// PAGE 1 (this is the game initializer. It makes a player at start of game then never comes back to this page)
DO Create player Once
DO Switch Page 2

//PAGE 2
WHEN Timer 3 Sec DO Switch Page 4

// PAGE 3
DO Create player Once
DO Switch Page 2

// PAGE 4
WHEN Score 0 DO Switch page 3 **
DO -1
DO Switch page 2

** Each player has its own score color for its EKG Respawner to work.

Make sure you turn off the scores so they don’t show up when playing.

That’s it. The respawner is basically asking, are you dead yet, and the player says nope. Once the player stops responding it respawns a new one.

You can find a sample of it under GRAFIKIMON on xbox live in a game called Star Hunter.

By |July 15th, 2009|