Thursday, June 4, 2009

technology anil nain most powerfull idea

Technologyanil nain 9416077273Light produced by a computer monitor is not constant. As you read this article, you are viewing approximately 30 separate images a second. Your brain rejects the information it doesn't want to see, and blocks out the frequent moments that your screen is blank. With this in mind, it is important not to make the colors on your web site too busy. This produces unnecessary strain on your eyes. Harsh, contrasting colors should be avoided. Giving people headaches does not aid in selling products!
It should also be noted that there are four factors that determine how color is rendered on your computer monitor: the CPU (the computer's brain), the computer platform (Windows, Mac OS, etc.), the video card, and the monitor itself. What you see may not be what others see. In some cases, royal red may appear as hot pink. Navy blue may look black. During the development process, try to view your site on different computers.
So what do you do?
You may find, in many cases, trial and error is the only way to determine what works. Be patient, and don't hesitate to make changes. The factors in determining color schemes of a web site, or any advertising for that matter, require careful consideration. Remember... Symbolism, Psychology, Gender, and Technology... Color does matter.

Thursday, December 18, 2008

अनिल नैन अबाउट इवेंट handler

What Is an Event?
Application programmers (the folks who make the everyday programs you use for Windows or Macintosh)
have long known that the key to graphical user interface (GUI) programming is events. So, what is an event,
and why are events so important? To answer that question, take a closer look at GUIs.
A GUI is, at its most base form, a large menu that lets the user choose what he wants to do. The problem is that
how the user does this choosing is based on a lot of complex interactions: keys being pressed, keys being
released, the mouse moving, a mouse button being pressed—you get the idea. Each one of these interactions is
an event. It occurs at a specific time and may have information associated with it. (The key that was pressed,
for example.) Now, events aren't limited to forms of user input. Things such as timers, network connections,
and file I/O also can create events. Basically, anytime you are working with something external to your code,
whether that is the hard disk, the user, or even time, you will be working with events.
Methods of Event Handling
There are two main methods to work with events in Flash MX: callbacks and listeners. Both have their
strengths and weaknesses as well as situations for which they are best suited. The most important thing to
remember about both methods is that organization and documentation are key to writing maintainable code.
Callbacks
The first method of working with events is known as a callback. Callbacks take advantage of the fact that
ActionScript is a highly forgiving language. In particular, callbacks execute a function that doesn't exist, and
Flash won't generate an error or even complain. Some forms of callbacks also utilize the fact that you can
overwrite any variable in Flash at any time, which includes functions.

मिग्रेशन अच्शन्स्क्रिप्त

Migrating from ActionScript 1.0 to ActionScript 2.0
The first thing to understand about updating existing (Flash MX) ActionScript to ActionScript 2.0 is that, in many cases, it's not necessary. ActionScript you wrote in earlier versions of Flash continues to work in Flash MX 2004 and Flash Player 7.
Migrating your code from ActionScript 1.0 to ActionScript 2.0 is beneficial mainly in the following circumstances:
For a large-scale Flash application or presentation that contains a lot of code, using ActionScript 2.0 simplifies the development process and provides more debugging information than ActionScript 1.0.
To upgrade OOP programs that you created originally in Flash MX or Flash 5, using ActionScript 2.0 makes maintaining and modifying the code much easier.
You're curious about OOP and want to learn about it in a familiar authoring environment.

अनिल नैन अबाउट एक्शन सकत

ActionScript 2.0 Language Details
ActionScript 2.0 introduces several new programming keywords and concepts, including classes, inheritance, and interfaces. These concepts comprise what is commonly known as object-oriented programming.
Classes you create in ActionScript must be stored in separate ActionScript (AS) files; you can't create classes in a Flash (FLA) frame or button script. Some important points about class files:
Only one class can be defined per AS class file.
The name of the file that contains the class must match the class name.
ActionScript class files must be located in a folder where the Flash compiler looks for classes.
You can combine several classes in a folder to create a package.
Read Full Tutorial

अनिल नैन अबाउट Differences Between ActionScript 1.0 and 2.0

Differences Between ActionScript 1.0 and 2.0
If you're familiar with ActionScript 1.0, you'll find that ActionScript 2.0 is similar, yet it has several subtle but important differences. In this section, we examine some of them so that you can take your hard-earned knowledge of ActionScript 1 and put it to use with ActionScript 2.0.
Before we look at these differences, let us first tell you up front that if you want to stick with what you know (programming in ActionScript 1.0), then by all means, do so. ActionScript 1.0 syntax still works in Flash MX 2004. But while this may be the case, and you do have a choice, we recommend you take the time to learn ActionScript 2.0, for a number of reasons.
First, there may come a time when a version of Flash is released that no longer supports ActionScript 1.0. Time spent learning version 2.0 now will be time you might have to spend down the road anyway. And while we can't guarantee it, don't expect ActionScript to jump to version 3.0 any time soon (if ever), because version 2.0 is now built around professional programming language concepts that have stood the test of time. As a matter of fact, outside of a few syntactical differences, writing ActionScript 2.0 code is not much different from writing Java code.
That's right; if you take the time to learn ActionScript 2.0, you'll be able to quickly transition your knowledge to the Java universe, where industrial-strength, cross-platform applications are standard. Consider learning ActionScript: it's a two-for-one deal!
Second, by its very nature and requirements, ActionScript 2.0 will force you to become a more efficient, organized, and better coder. As you will soon see, ActionScript 2.0 has some very strict requirements about how things are done. It's a lot less forgiving than ActionScript 1.0. This may seem like a bad thing, but it actually prevents you from being too sloppy with your scripts, which can make finding bugs a pain, and which can make updating a project months later an arduous task.
Finally, if speed is important to you, you'll be happy to know that ActionScript 2.0 has been shown to be three to seven times faster than ActionScript 1.0. This speed increase will promote the development of even more robust Flash applications.
Let's next look at some of the main differences you'll find between ActionScript 1.0 and ActionScript 2.0.
Case Sensitivity
In ActionScript 1.0, these variable names referenced the same variable:
myVariable MyVariable
In ActionScript 2.0, however, they would be considered two separate variables due to the case difference in their spelling; the first variable begins with a lowercase character, while the second an uppercase character. In fact, all of the following are considered different elements in ActionScript 2.0:
myName MyName MYNAME myname myNAME
This case sensitivity rule applies to all elements in ActionScript 2.0, including instance names, keywords, method names, and so on. Thus, while this syntax will stop all sounds from playing:
stopAllSounds();
this will cause an error:
stopallsounds();
Tip: One easy way of testing for case errors is to press the Check Syntax button on the Actions panel. Errors resulting from case mismatches will appear in the output window.
Strict Data Typing
Variables are used to contain data. This data comes in many forms, including strings of text, numbers, true/false values, references to objects such as movie clip instances, and so on. In ActionScript 1.0, when creating a variable, Flash would automatically assign a data type to it. In this example, Flash understood that the value on the right was of the Number data type:
myVariable = 36;
While Flash will still automatically recognize this variable as holding a Number data type, ActionScript 2.0 introduces what is known as strict data typing, which gives you more control over setting a variable's data type. Here's how it works.
When creating a variable with ActionScript 2.0, you use this syntax not only to create the variable, but also to assign its data type at the same time:
var myVariable:Number = 36;
As you can see, this syntax is not that different from what you're used to using in ActionScript 1.0. The difference is the addition of the var keyword, and the explicit declaration that this variable will hold a number, as indicated by the :Number syntax.
A variable that will hold a string looks like this:
var myOtherVariable:String = "Hello";
In addition to assigning data types to regular variables, strict data typing is used in the creation of object instances:
var myArray:Array = new Array();
and function definitions:
function myFunction (name:String, age:Number)
Note: Both of these types of strict data typing will be explained in greater depth later in the book.
How can all those extra keystrokes be an enhancement? Well, there are several ways.
If you're familiar with the Actions panel's ability to provide code hints (which we will discuss shortly), you'll be happy to know that strict data typing activates code hinting for named elements. For example, if you create an Array object using the syntax:
var myArray:Array = new Array();
the Actions panel will recognize from that point forward that any reference to myArray is a reference to an Array object, and it will automatically provide Array object code hints whenever you script that object. In some cases, this new ability eliminates the need for a suffix (_array, _xml, and _color, for example), which was one of the ways that Flash MX enabled code hinting for an object. While the new syntax requires a few more keystrokes, you'll save a few because you no longer have to add suffixes to elements' names, so consider it a decent trade-off.
Note: You'll notice we said that in some cases the new ability eliminates the need for suffixes. Visual elements (movie clip instances, buttons, text fields, and components, for example) are not created and named in the same manner as data elements. For this reason, suffixes for these elements' names (such as _mc, _btn, and _txt) are still useful. For this book, we will generally use suffixes only for visual elements.
Code hinting isn't the only benefit to strict data typing. By indicating the type of data a variable will hold, you save the Flash player a whole lot of time trying to figure it out on its own. When the Flash player is running your application, Flash needs to keep track of the type of data each variable contains. If you use strict data typing, you make this process a lot easier and less processor-intensive for the Flash player. As a result, your scripts will execute much faster. If you want to increase the speed of your applications, use strict data typing.
Finally, strict data typing can be a very simple way of helping you uncover bugs in your code. Here's an example:
var favoriteBand:String;
This line of script creates a variable named favoriteBand, which has been strictly typed to hold a String.
Later in your script you assign this variable a value or give it a new one using the syntax:
favoriteBand = "The Beatles";
However, if somewhere in your script you use something like this syntax:
favoriteBand = 46;
the Output panel will open and display a "Type mismatch" error when you attempt to export (compile) your movie. This is an error indicating that you've attempted to assign an incorrect value type to a variable. In our example, we've attempted to assign a numeric value (Number data type) to a variable that has been set up to hold a string value.
This functionality can help prevent a number of bugs that can result from simple mistakes you might make when assigning values to variables.
Class Structure
Perhaps the biggest change in ActionScript 2.0 is the way that object-oriented programming is implemented. For example, with ActionScript 1.0, a custom class of objects was defined this way:
_global.Person = function (name, age){ this.name = name; this.age = age; }
In ActionScript 2.0, the same class is created using this syntax:
class Person { var name:String; var age:Number; function Person (name:String, age:Number){ this.name = name; this.age = age; } }
Notice the use of the new class keyword. This syntax is very similar to the syntax for creating classes of objects in Java. As you learn more about this syntax (which we won't discuss in detail at this point), you'll quickly see its benefits over ActionScript 1.0.
Another subtle difference in creating custom classes of objects between ActionScript 1.0 and 2.0 is that the script that contains the class definition must exist in its own external .as file. This means that the script for defining the Person class would need to be saved as an external .as file (which is nothing more than a text file with a .as file extension) named Person.as. This is different from ActionScript 1.0, which allows you to place the code for a class definition on Frame 1 of a movie clip's timeline. This is no longer possible when creating content for the Flash 7 player. Class definitions must exist in an external .as file. We'll discuss this functionality in Lesson 7, "Creating Custom Classes." For now, be aware of the difference.
Note: You can still place scripts on frames, buttons, etc., but class definitions must exist in their own .as files.
To make the creation of .as files as easy as possible, Flash MX 2004 now provides a stand-alone ActionScript editor, which is separate from the Actions panel, and which is used for nothing more than the creation and saving of .as files. Later in this lesson, we'll look at both the Actions panel and the stand-alone ActionScript editor.
There are other differences between ActionScript 1.0 and ActionScript 2.0, but this brief overview should provide you with enough insight to get started if you've worked with ActionScript 1.0.

अनिल नैन अबाउट Object-Oriented Programming

अनिल नैन अबाउट Object-Oriented Programming
ActionScript 2.0 is fully object-oriented programming (OOP) language that provides several benefits to programmers, especially when creating large-scale Flash applications or presentations. OOP encourages reusability. You reuse a class you created in ActionScript 2.0 by inheriting the functionality of that class in other classes. The modular nature of OOP lets you replace or swap components of an application without changing the application's structure. Finally, the fundamental metaphors of OOP design closely mirror the natural world (objects that have internal states and can do certain things), which speeds and facilitates the application design process.
Like ActionScript, OOP languages are based on the concept of classes and instances. A class defines all of the properties that distinguish a series of objects—it defines a category of object. A class describes the properties (data) and methods (behaviors) for an object, much like an architectural blueprint describes the characteristics of a building. The Date class is an intrinsic ActionScript class. Using the Date class you can make many instances. Each instance, or Date object, can represent a different (or the same) date. For example, you can make a Date object to represent August 1, 2010 and another to represent August 2, 2010. Each object inherits the same functionality from the Date class. However, each instance is an independent object much as two buildings built from the same blueprint are unique instances.
Classes define data types. When an application has a new logical classification for data that doesn't fit any pre-existing data types, you can write a new class. For example, if you are building an application that showcases t-shirts then you can write a TShirt class that defines the characteristics of that data type such as color and style. To define a class, you use the class keyword in an external script file. You can create an external script file in the Flash authoring tool by selecting File > New > ActionScript File.
As always, ActionScript 2.0 provides several powerful and familiar OOP concepts and keywords (such as class, interface, and package) found in other programming languages, such as Java. The programming language lets you build program structures that are reusable, scalable, robust, and maintainable. It can also decrease development time by providing users with thorough coding assistance and debugging information. You can use ActionScript 2.0 to create objects and establish inheritance, and to create custom classes and extend the top-level and built-in classes in Flash.
Flash Basic 8 and Flash Professional 8 include approximately 65 top-level classes that provide everything from core data types (Array, Boolean, Date, and so on), to custom errors and events, as well as several ways to load external content (XML, images, variables, and more). You can also write your own custom classes and integrate them into your Flash documents, or extend the top-level classes and add your own functionality or modify existing functionality. You write a custom class in an external ActionScript (AS) file and you can import it into your application when you compile the FLA file. Classes can be very useful when you build larger Flash applications because you can organize a lot of the application's complexity in external class files. When you move a lot of the logic into a custom class, you can not only make the code easier to reuse, but you can also “hide” some of the methods and properties from other parts of the ActionScript code. This helps you prevent other developers on the team from accessing sensitive information, or changing data that shouldn't be changed.
When you use a class, you can also extend existing classes and add new functionality or modify existing functionality. For example, if you create three very similar classes, you can write a base class (abstract) and then write three classes (implementations) that extend the base class. These three subclasses can add additional methods and properties, so that you don't need to create three class files that all duplicate the same code and logic.
Another benefit of using classes is code reusability. For example, if you create a custom class that creates a custom progress bar using the Drawing API, you could save the progress bar class in your classpath and reuse the same code in all of your Flash documents by importing the custom class. For more information on setting the classpath, see About Importing Class Files and About Setting and Modifying the classpath.