beverlyslis.com beverlyslis.com
Main Page >> About Us >> Add Your Link >> Privacy of Info >> Terms & Conditions >> Add Your Article
Search:   
Add Url
 

Investment & Finance

Property & Agents

Self Help

Children

Lifestyle & Fashion

Food & Recipe

Automotive

News & Media

Health & Hygiene

Travel & Vacation

Politics & Government

Society & Issues

Healthcare & Medicine

Science & Research

Sports

Online & Indoor Games

Internet & Computers

Culture & Art

Music & Entertainment

Careers & Employment

Garden & Home

Education & Reference

Companies & Business

Shopping & Auction

 

Main Page » Internet & Computers » Computer Software
 

Flash ActionScript - Correct 2.0 Practices

 
Author: Ashley Peach
 

Actionscript is a very powerful language made by macromedia. Learning actionscript can be tricky until you get your mind thinking the same way actionscript does. Actionscript is evolving at a very fast rate into a top programming language. With the release of ActionScript 3.0 excepted in the next few months its important to get use to good 2.0 practices.

So what are correct 2.0 practices?

Correct 2.0 practices would include strict data typing all variables, function return values and values excepted. Strict data typing can also be used in classes which is another great 2.0 practice. OOP is Object Orientated Programming; OOP is like an advanced external function. Languages such as Java are purely OOP all programming done is Java uses classes. The advantages to classes are they can be re-used time and time again. They can be extended with additional classes, They can be shared and there great for organization. Once you start programming things over 1000 lines of code things can get very complicated and some times impossible because you simply dont know what goes next. This is where classes come in classes with organize your entire site into manageable sections. An example of using classes would be a members system. You could create a members class in that class could contain a signup function that registers the users checked for blank values and further validation. You could then have a login function which checked the users name and password against the database and returned a value of true if the username and password supplied match that of the database. OOP really is the future of programming without OOP you will struggle with medium to large sized projects. Another huge advantage to OOP is when working in a team you can simple work on a class each and modify or extend another persons class. Where as without OOP would have to look through maybe 10,000 lines of code to find 5 lines of code that needed modifying. Good 2.0 practices would also be using movieclips instead of buttons. Movieclips have far more functionality than buttons ever could actionscript 2.0 can do just about anything to movieclips change the color, size, shape, movement, the list goes on and on. Buttons really are the past the future is movieclips.

How to define strict data typing

For example to define a variable as a number we would use:

var - to signal what we are defining is a variable.

thename - anything you like to define the specific variable.

:number - the data type this could be a number, Boolean or string.

= - to define what will be inside the variable.

4 - the value that sites inside the variable.

; - just to end the line of code

So in full

var thename:Number = 4;

String and boolean would look as follows.

var thestring:String = hello;

var theboolean:Boolean = true;

If you wanted to make something happen when a user clicked a movie clip the correct 2.0 code to use would be:

nameofthemovieclip.onPress = function ():Void {

//what you would like to happen in here.

}

We define the function as void so that actionscript does not except a retuned value.

If we were to put expected values inside the function we would use:

myfunc = function (mynumber:Number):Void{

//code goes here

}

So remember to always use correct 2.0 practices and your code will shine.

 
 
 

Related Articles

 
Business Planning Software
 
10 Cool Ways To Attract People To Your Website
 
Four Crucial Steps to Effective Internet Marketing
 
10 Things You Should Be Monitoring On Your Website
 
How To Implement World Class Internet Marketing
 
Web Traffic Article Reveals An Amazing New Way To Get More Web Traffic Using This Proven System
 
Top 7 Tools for Affiliates
 
From PR Zero To PR Hero In 3 Easy Steps; Part 1
 
Web Hosting Geeks : Web Hosting Instructions
 
Words That Sell - Internet Marketing
 
 
 
 
 

9 Steps to Getting More Shoppers to See Your Amazon Products

Tips for optimizing your Amazon marketplace feed to increase your chances of appearing, or appearing ... - Brian Carter
 

E-commerce: Is It Right for You?

This articles covers the basics of setting up an online business. It covers different types of busin ... - Mark J Thompson
 

Marketing Article: Easiest Low Cost Way To High Traffic

There is hardly any other online marketing tool that is as effective and yet so low-cost as articles ... - Christopher Kyalo
 
 

Best Tablet PC

The race for becoming the "best tablet PC" is on. There are no clear verdicts, as technology is a dy ... - Steve Valentino
 

10 Essential Steps You Need To Take To Succeed With any Affiliate Program

So what is the critical affiliate program information you will need to know, and the steps you need ... - Jeff Casmer
 
 
Main Page >> Privacy of Info >> Terms & Conditions
Copyright © www.beverlyslist.com - All Rights Reserved Worldwide