Archive for Flash tutorials

Flash Tutorial - AS Coding standards (Good coding guide)

ActionScript Coding Standards

Macromedia Flash applications have generally been built without regard to particular standards or guidelines. While this flexibility allows for a wide variety of solutions to a problem, it also makes it difficult for anyone other than the author of an application to understand the code. Even the author may have difficulty reading his or her own code after it is written. If a developer cannot understand the code in an application, it will not be easy to debug the code, make changes, or reuse.

This documents outlines a system of best practices specifically designed for coding with ActionScript and building applications with Macromedia Flash. Applications that use these guidelines should be more efficient and understandable-and the underlying ActionScript code will be easy to debug and reuse.

Naming guide lines

Most importantly, an application’s naming scheme must be consistent and names should be chosen for readability. This means that names should be understandable words or phrases. The primary function or purpose of any entity should be obvious from its name. Since ActionScript is a dynamically typed language, the name should also contain a suffix that defines the type of object being referred to by the name. In general, “noun-verb” and “adjective-noun” phrases are the most natural choice for names.

For Example

Movie name - my_movie.swf

entity appended to a URL - course_list_output

component or object - ProductInformation

variable or property - userName

Function names and variables should begin with a lower case letter. Objects, and object constructors, should be capitalized. Using mixed case is also recommended when naming variables, although other formats are acceptable as long as they are used consistently within the application.

Variable names can only contain letters, numbers and underscores. However, do not begin variable names with numbers or underscores.

Examples of illegal variable names

Read more at adobe

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • YahooMyWeb
  • Furl
  • Spurl
  • Technorati

Comments

Flash Tutorial - Reducing SWF file size (How To)

How to reduce swf file sizes: Written by Paul Bainbridge - Innovative Designs 

Replace images for vectors wherever you can.
Import images dynamically if vectors is not an option.

Reduce publish settings for images..

Do scripted movement rather than tweens… puts pressure on processor rather than file size to the swf.

You can also simplify your vectors by using the optimise option.

Use symbols for repetitive graphics.

Reduce frame rate and shorten tweens.

Sometimes (depending on the font) you should break apart the font to make it a vector then you’re not importing the font, just drawing a simple shape. This does depend on the font, and how often characters are repeated.

You can opt to use device fonts for body copy.

Make sure PNG’s are close cropped because believe it or not that transparent space actually ways something.

Generate a size report from your publish setting to see where the weight lies in your file.

Delete any stray or inappropriate key frames because this is causing a redraw.

A motion tween can often be heavier than a shape tween… because motion tweens don’t do anything mathematical the compiler actually converts them to individual key frames.

All masks and hit areas can be done with one square transparent symbol that you use throughout your FLA.

Then beyond that its tricks you use to give the illusion of an object but with optimising in mind…

i.e. if you have a symmetrical bitmap, save half of it out from Photoshop then flip it to make the whole graphic.

Similarly flipping graphics to get the opposite action rather than having to different graphics.

If you’ve got any bitmaps that are silver, save them as greyscale.

Make use of tint and other advanced colour setting for symbols rather than recreating graphics.

It’s endless really… but depends on the job.

Paul Bainbridge

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • YahooMyWeb
  • Furl
  • Spurl
  • Technorati

Comments (1)

Flash Tutorial - Clear, clean, crisp font’s (How to)

How To Keep Fonts Clear: Written by Paul Bainbridge - Innovative Designs

Here are the basic rules to follow to keep text from anti-aliasing (ie. getting fuzzy, unclear, blurred). I’ve also included a few notes that could be useful when manipulating text with actionscript.

RULE #1:
Know the ‘Size Intended’! 

The first bit of info you will need is the size that the font was intended to be set at. Most fonts are between 8-12 pt fonts. In the case of the popular miniml fonts they are 8. Contact the creator of the font if you can’t determine the correct size.

RULE #2:

Be sure that the font being used is only set to multiples of the size intended. For example, miniml fonts should only be size 8,16,32,40, etc. If you try other sizes the flash anti-aliasing will kick in and they will blur.

RULE #3:

Adjust placement of text so that it rests on integer (ie 1,2,3,4.. not 1.1,2.5,1.2,5.6, etc.) x and y values. If the text is placed on say x:1.4 y:2.3 the text will anti-alias and blur. The exact position of text is easily changed by selecting it and opening the info box in flash. Simply type in the rounded x and y values.

Those are the three basic rules. Here are a few notes/tricks for other situations:

NOTE #1:

A lot of times you will have text within a movie clip. Even though the x and y values may be integers it may still look blurry. This is because the movieclip that it resides in is not on integer values. It’s generally good practice to manually adjust movieclips via the infoBox whenever they contain text.

NOTE #2:

You will run into a problem with the aliasing when you scroll or manipulate the location of the text via actionscript. This is obviously due to the text being moved between integer values. The solution is to modify the actionscript so that when it determines the x and y position of the text you include a Math.round() argument.

NOTE #3:

The final note. You may also run into problems when you try to Justify text other than left justify. Try and keep all your text fields left justified.

I hope this helps, if you have any questions, feel free to ask!

Paul Bainbridge

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • YahooMyWeb
  • Furl
  • Spurl
  • Technorati

Comments (3)