background preloader

Tuts

Facebook Twitter

Flash ActionScript 3.0 Tutorials. AS3: Contact Form Learn how to create an email contact form for your website.Added on August 9, 2010 AS3: Changing Colors Learn how to change the color of an object using the ColorTransform Class.Added on November 30, 2009 AS3: setInterval Learn how to execute code repeatedly.Added on November 20, 2009 AS3: Using CSS Learn how to format your text fields using external style sheets.Added on October 31, 2009 AS3: Drawing Vectors Learn how to draw lines, make fills, and create basic shapes.Added on September 29, 2009 AS3: Keyboard Interaction Learn how to execute commands in your Flash movie by using the keyboard.Added on September 16, 2009 AS3: Switch Statement Learn how to execute conditional code depending on the value of a case.Added on September 8, 2009 AS3: Trace() Command Learn how to debug your code inside Flash using the trace() command.Added on August 31, 2009 Creating a Twitter Widget AS3: Date Class Learn how to manipulate time information using ActionScript 3.0.

AS3: Masking AS3: Arrays. Using the Date Class in AS3. By Riyadh Al Balushi | Flash CS4 | ActionScript 3.0 | Beginner This tutorial will teach you how to use the Data Class in AS3 to retrieve all information related to time (includes dates and days). This tutorial will teach you the basics on how to use and manipulate the date class to retrieve this type of information. This is a beginner level tutorial that doesn't require any advanced knowledge of ActionScript. This tutorial is divided into the following sections: Basic usage of the date class. Retrieving specific date details.

Retrieving the year, the day of the month, the hours, the minutes, and the seconds. Basic Usage of the Date Class We will start off by using the date class to show basic date date in the output window. Var my_date:Date = new Date(); You can learn more about AS3 Variables by reviewing our tutorial on this topic. If you would just like to show the basic date details in one piece you can simply use your my_date variable as if it was a String variable. Retrieving the Month. AS3 Tween Class. By Riyadh Al Balushi | Flash CS3 | ActionScript 3.0 | Beginner The Tween Class lets us create simple animations easily in ActionScript by specifying the starting and ending points of an object animation positions.

This tutorial will teach you everything you need to know about the Tween Class, it's basic usage, easing variations, Tween methods, and Tween Events as well. The movie below shows an image moved around using the Tween Class. You might be interested in checking our tutorial on using the TransitionManager Class which can be used as alternative to the Tween Class for creating richer transition effects instead of use simple animations. This tutorial is written for the AS3 Tween Class. This tutorial will be divided in the following sections: Basic Usage of the Tween Class Easing Variations Tween Methods Tween Events Misc Tween Properties Basic Usage of the Tween Class The Tween Class is a ActionScript class that can be used to tween any property of any object.

Running your own example. XML Basics. By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner Using XML is one of the best ways for structuring external content in a logical format that is easy to understand, process, and update. This tutorial will teach you the basics on how to load and process XML in Flash using ActionScript 3.0. You are assumed to have basic knowledge of ActionScript in order to follow this tutorial. This tutorial is for working with XML in ActionScript 3.0. Our tutorial will be divided into the following short sections: What is XML?

What is XML? XML stands for Extensible Markup Language, it is a markup language used to structure data logically using tags that look very similar to HTML. <? As you just saw, XML makes it possible for authors to create and name their tags in whatever form they choose as long as they adhere to the basic rules of the language. Moving on the actual content within an XML file, each XML tag is called a node in ActionScript.

The XML file must have ONE root level XML tag. Var myXML:XML; Creating a Flash Preloader. By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner This tutorial will teach you how to create a very simple preloader for your Flash movies using ActionScript 3.0. A preloader is an essential asset in every single Flash movie you put on the internet as it prevents the movie from playing before downloading all its assets and also informs the user about how long he is expected to wait before the downloading process finishes. This tutorial will not require you to have any special ActionScript 3.0 knowledge and will make use of the LoaderInfo class to retrieve downloading data.

Our tutorial will be divided into two sections, in the first section we will prepare the graphical assets of our preloader and in the second section we will code our movie. Preparing Preloader Graphical Assets Start off by creating a new Flash movie with the ActionScript version set to 3.0. Our preloader project is going to have two things only, the content and the ActionScript. Stop(); stop(); That's it! AS3 - Custom Context Menu. By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner The default commands in the Flash context menu (the right-click menu on Windows or the control-click menu on a Mac) let the user change zoom and playback settings in a way that could alter the flow of a Flash movie in a manner not desired by the original developer.

This tutorial will teach you how to customize the context menu by removing the default items and adding your own items instead. Accomplishing this task will require using the ContextMenu Class and the ContextMenuItem Class. You are not required to have any advanced ActionScript knowledge except the basics of variables and event handling. Check the movie below to see an example of what we are going to accomplish by the end of this tutorial. This tutorial is divided into the following sections: Hiding Default Menu Items. Hiding Default Menu Items Hiding default menu items will explain the basic format in which the ContextMenu Class is used. Hiding your default items. Loader Class. By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner The Loader Class is an ActionScript class that lets us load external assets (such as images and Flash files) at run time onto a Flash movie. Using such technique makes our Flash movie more efficient as you load specific files only when needed instead of embedding them regardless of whether the user ends up watching them or not.

Separating our movie into distinct sections loaded at run time makes the website easier to update as you can update the external assets without going back to the main FLA. Our tutorial will teach you the basics on how to use the Loader Class to load an external asset. Check the example below to see the Loader Class in action: The ActionScript 3.0 Loader Class replaces all the previous ActionScript 1/2 methods such as .loadMovie(), loadMovieNum() and the MovieClipLoader Class. It is the only native class for loading external graphical assets. Our tutorial is divided into the following sections: - End of Tutorial. Timer Class in AS3. By Blue_Chi | Flash CS3 + ActionScript 3.0 | Beginner The Timer Class in AS3 lets you execute any code repeatedly over specific time intervals. It is an extensive class which offers functionality that exceeds the older setInterval() method which is more commonly used in previous versions of ActionScript.

This tutorial will teach you the basics on how to use the Timer Class to execute any code repeatedly over a period of time. You are expected to know the very basics of the ActionScript 3.0 Event Handling system to follow this tutorial. The example below shows how the Timer Class is used rotate a movie clip a little bit each second: Basic Usage of the Timer Class The Timer Class is used to execute any code repeatedly after certain time periods. In order to use the Timer Class the following procedure must be followed: Create an instance of the Timer Class and set the delay period and the repeat count when as you create the new instance.

We are going to explain this code step by step. Text Fields and Formats. By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner This tutorial will teach you the basics for dealing with text and text formatting in ActionScript 3.0. You should be able to create a text field, change its color and attributes, position it, and use a specific font for your text field by the end of this tutorial. We will use the TextField Class and the TextFormat Class to carry out these taks. This is a very basic tutorial that will only require you to know the fundamentals of AS3 Variables and the Display List. This tutorial is divided into the following sections: Basic Usage of the TextField Class. Basic Usage of the TextField Class Start off by creating a new Flash file, right-click the only frame you have on the timeline and select Actions to open up the Actions Panel. Creating a text field is similar to the creation of an instance of any other class in AS3.

Var myText:TextField = new TextField(); You can learn more about AS3 Variables by reviewing our tutorial on this topic. Functions. By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner Functions are fundamental tools used in ActionScript to reduce the amount of written code, save time, and add a logical structure to your code. This tutorial will describe the basic usage of functions in ActionScript 3.0. This is an ActionScript 3.0 tutorial. To learn about using Functions in AS2 please review our tutorial on that topic. Our tutorial is divided into these sections: What is a function? A function is a block of code wrapped together in a way so that it can be re-used at anytime in the code.

Function Code Example For example, say that you want to create an instance of a certain Star object, set its x and y properties, and add it to the display list. Var myStar:Star; myStar = new Star(); myStar.x = 100; myStar.y = 150; addChild(myStar); The Star Class is an imaginary class, it does not exist in the default set of Flash Player classes. You can learn more about AS3 Variables by reviewing our tutorial on this topic. var myStar:Star; AS3 Masking. By Riyadh Al Balushi (Blue_Chi) | Flash CS4 | ActionScript 3.0 | Beginner A mask is an object that limits the visibility of an object to the shape of the mask applied to it. This tutorial will teach you the basics on how to apply masks dynamically using ActionScript 3 along with a number of tricks related to masking.

This is a beginner tutorial that does not require any advanced skills. However, applying some of the advanced tricks mentioned below will require knowledge of event handling and using the Tween Class. Applying a mask allows the creation of a number of visual tricks similar to the one shown in the movie below. What is a Mask? A mask is an object that limits the visibility of another object to the shape of the mask. A mask could be applied in Flash without the involvement of ActionScript by using Timeline layers. Basic ActionScript Masking In ActionScript 3.0, any object that can be added to the Display List can be masked.

My_object.mask = my_mask; my_object.mask = null; SharedObject Class (Flash Cookies) By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner This tutorial will teach you how to use the AS3 SharedObject Class to store small amounts of data on the end user's machine. This stored data could be used to store a game's highscore, a user's login data, or any other information that you need to be remembered when the user visits your Flash movie again. Shared Objects are very similar to cookies on a browser, however, they are not stored with the rest of your browsers cookies and are not deleted when the user deletes the regular cookies, instead they are completed managed by the Flash Player. Following this tutorial requires you only to know the basics of AS3 variables. The movie below shows an example in which the movie will remember the position of your objects even if you refresh the page.

This tutorial is divided into the following sections: The getLocal() method. Using the getLocal() Method The getLocal() method is the most fundamental aspect of the SharedObject Class. Deleting Data. Filters. By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner Filters are readymade effects which you can apply to all visual objects in Flash. This tutorial will teach you how to apply, customize, and remove these filers from any object using ActionScript 3.0. This is a beginner tutorial that does not require you to have any advanced AS3 skills. The example below shows how the Blur, Glow, Bevel, and Drop Shadow filters were applied to an image: All display objects have a special filters property which can add filters to. Preparing the FLA. Preparing the FLA Start off by creating a new FLA in AS3 format. In order to easily manipulate this object via ActionScript we need to give it an instance name. Our MovieClip is now ready for ActionScript.

Applying a Filter We are going to explain the uses of the four basic filters, namely BlurFilter, GlowFilter, BevelFilter, and DropShadowFilter. Import flash.filters That should allow us to use any Filter we want in our project. import flash.filters. Linking to Another Webpage. By Blue_Chi | Flash CS4 | ActionScript 3.0 | Beginner This tutorial will teach you how to use ActionScript 3.0 to link from your Flash project to another webpage using the navigateToURL() method. Using the navigateToURL() Method Linking to another webpage in AS3 is achieved by using the navigateToURL() method. This method is used in the following format: navigateToURL(myURL, window); Where the URL is passed as an instance of the URLRequest Class and the window is the target window to open the link.

Var myURL:URLRequest = new URLRequest(" navigateToURL(myURL, "_blank"); The var keyword is used to create a variable. You can instantiate your URLRequest inside your navigateToURL() to write less code: navigateToURL(new URLRequest(" "_blank"); The window argument at the end is optional. NavigateToURL(new URLRequest(" navigateToURL(new URLRequest(" "_self"); Displaying Google Maps. By Blue_Chi | Flash CS5 | ActionScript 3.0 | Intermediate Using real interactive maps is one of the best ways to to illustrate location. This might be a cumbersome task if you had to create the whole map from scratch, luckily a number of companies such as Google and Yahoo have opened up the API to their maps and allow 3rd party developers to take advantage of these maps in their own projects.

This tutorial will teach you the basics on how to display a Google Map in a Flash AS3 project to show the exact location of a place and to let users explore that area. This will be done by using the Google Maps API. This is an intermediate level tutorial that requires you know the basics of AS3 such as variables, functions, and event handling. Our tutorial will be divided into the following sections: Setting up the Google Maps component Basic display of the map Inserting a marker and the map controls Setting up the Google Maps component Summary of this Page In this section we did the following: Drawing Vectors. Changing Colors. Tile based games.