Sunday, April 25, 2010

About Coding Standards

Flash applications are generally built without coding standards whrere as flex applications have some standard.
Next version of Flash (CS5) have code hinting properties where as Flex already have it.
This flexibility allows solutions to variety of  problem.
It is very difficult for anyone to understand others code. Even sometimes when code becomes wast author may have difficulty for reading his or her own code.
If a developer unable to understand the code in an application, it will not be easy to debug the code, make changes, or reuse the code.

Optimization is also one of the important factor, while you are playing with Flash, Flex or ActionScript.

Here are some useful links i found while surfing on net.

Coding Standards:
http://www.rivellomultimediaconsulting.com/files/presentations/2012/BestPractices_Coding_v1.1.pdf
http://download.macromedia.com/pub/devnet/downloads/actionscript_standards.pdf

Video:
http://www.adobe.com/devnet/flash/articles/flash_to_video.html

Image:
http://www.kirupa.com/forum/showthread.php?320007-Image-Quality-in-Flash

Optimaization:
http://www.kirupa.com/forum/showthread.php?339677-Optimise-the-game
http://gamedev.michaeljameswilliams.com/2010/02/10/optimise-as3-for-speed/
http://osflash.org/as3_speed_optimizations
http://lostinactionscript.com/2008/09/28/tips-on-how-to-write-efficient-as3/
http://wiki.joa-ebert.com/index.php/Category:Code_Optimization
http://board.flashkit.com/board/showthread.php?t=788271

Access of MainTimeline to class file

Here is code for How to access MainTimeline objects in fla to .as class file.

In main.fla,
There are two text boxes SentText and gettext.
code is:

import com.sample

var sample:Sample=new Sample(this)
sample.SentText("Sent to Class File")
gettext.text=sample.GetText();

Here this keyword  represents MainTimeline, to class sample , when instance of that class is created.

in Sample.as

package com
{
public class Sample
{
private var SuperObject:Object;
public function Sample(mySuperObj:Object)
{
SuperObject=mySuperObj;
}
public function SentText(str:String)
{
SuperObject.Mytext.text=str
}
public function GetText():String
{
return SuperObject.Mytext.text;
}
}
}


Here SuperObject is a variable of type Object , which represent MainTimeLine.
When object of class Sample is created, MainTimeline is passed to Sample Class constructor.
If we trace (SuperObject) it shows [object MainTimeline].
If you write this code in document Class, this document Class represent MainTimeLine
and now we can access of objects of MainTimeLine as seen.

Thanx;
Enjoy Actionscripting..........