Saturday, July 31, 2010

Sound class in Actionscript 3: Part 6

In this tutorial we will learn about computeSpectrum and stopping all sounds at once. We will create a working visualizator in Flash and enhance it to look cool. Here's what our final flash will look like:

Thursday, July 29, 2010

Wednesday, July 28, 2010

Tuesday, July 27, 2010

Sound class in Actionscript 3: Part 2

In this tutorial, we will learn how to create a sound buffer, how to find out the size of our sound file and how to pause the song.

Monday, July 26, 2010

Sound class in Actionscript 3: Part 1

Sounds have an important role in all kinds of flash applications. Today we will learn how to play and manage sound in Actionscript 3.

Friday, July 23, 2010

Wednesday, July 21, 2010

Correct Flash embedding with HTML

If you want to embed a Flash movie into a website, you can simply use the Flash built-in publisher code, however it generates a really big XHTML code, which has errors according to W3 validator, here's the screenshot (click to enlarge):

Tuesday, July 20, 2010

Dynamically setting and showing FPS in AS3

In this tutorial we will learn how to set frame rate of our movie with AS3 during its playback and how to create a simple fps displayer.

Monday, July 19, 2010

Use appendText

In AS3, the TextField class has a new method called appendText. In this Actionscript 3 tutorial we will see why and how should we use it.

Saturday, July 17, 2010

Mouse.cursor property in Actionscript 3

Sometimes it is needed to change the default mouse cursor to an already built-in cursor (hand, finger pointer, etc). Here's an example:

Friday, July 16, 2010

Restrict characters in input text field using AS3

Yeah, this is another tutorial about input fields :P
Say, you need to create a text field for phone numbers and you need to restrict every symbol but numbers. This question is asked alot, although the solution in Actionscript 3 is pretty simple:

Thursday, July 15, 2010

Clear text field when focused on

If you are making an input text field, it's often needed to add hints, such as "Enter your name here" and "Enter your email", etc. If you are a good programmer, you will make this default text dissapear when the field is clicked, like in this example:

Wednesday, July 14, 2010

Tuesday, July 13, 2010

How to site lock a flash using Actionscript 3

There are many requests on site locking flash games and applications on the internet. There are many ways to do it, but I chose regular expressions for my code. Here it is:

Monday, July 12, 2010

How to save local data with SharedObject using AS3

Sometimes it is needed to save a piece of data on user's computer, for example to load application settings from the last visit, or to load a saved game. This can be easily done with SharedObject.

Sunday, July 11, 2010

Text embedding in Flash

If you are using dynamic or input text areas in your flash, it is important that you embed the necessary fonts. There are two main reasons why you should do that:

Saturday, July 10, 2010

Create custom context menu using Actionscript 3

Sometimes it is needed to change the default context menu. Although you can't remove right clicking, you can modify the menu items.

Friday, July 9, 2010

How to make a digital clock using Actionscript 3

Have you ever wanted to make your own digital clock? Today we are going to learn how to create one in Flash. Here's how our final product will look like:

Thursday, July 8, 2010

How to create a proper cursor using Actionscript 3

A lot of flashes have custom cursors in them. Basically, it is just a movieclip following the coordinates of the mouse, however, several problems might occur, such as:

Wednesday, July 7, 2010

Saving to clipboard using Actionscript 3

Flash and Flex application developers often need to make a button that would save a piece of text to the user's clipboard, like it is shown in the example:

Tuesday, July 6, 2010

Actionscript 3 Keyboard events

The Keyboard class is used to build an interface that can be controlled by a user with a standard keyboard. It might sound complicated at first, but once you understand what are you doing - it's as easy as creating buttons.

Monday, July 5, 2010

How to create a calendar using only Actionscript 3 - Part 3

In the previous 2 tutorials we have created a base for our calendar and added some functionality. Today we are going to add more stuff to it.

Firstly, add a new loop in the compute function, right after the loop that sets text for each cell:


Sunday, July 4, 2010

How to create a calendar using only Actionscript 3 - Part 2

In the previous part, we created a base for our calendar. Now, we have to make it work like a real calendar.

Firstly, find this line in your code and delete it:


Saturday, July 3, 2010

How to create a calendar using only Actionscript 3 - Part 1

Ever wanted to learn how to create your own calendar, using only ActionScript 3? Now you can!
In this tutorial, we will cover the creation of cells of a calendar, and setting it up for work in future.

First, let's create one cell.
To do this, we will create a text field and edit it to look like a cell.

Friday, July 2, 2010

Returning random numbers using Actionscript 3

Generating random numbers is often needed when developing a game or an application. That was very simple to do in AS2 with the built-in random() function, which returns a random number ranged from 0 to the entered number. In AS3, it's a little more complicated. There is only one built-in function for that, Math.random(), which returns a random number n, where 0 <= n < 1. Let's create a function that will simplify the randomizing process for us (to make it work like in AS2):


Thursday, July 1, 2010

How to check if e-mail is valid using Actionscript 3 and regular expressions (tutorial)

A lot of people, especially when creating forms, need the flash to check, whether the entered e-mail is valid. This tutorial explains how to do that in Actionscript 3. Here's what we're going to make: