Showing posts with label effects. Show all posts
Showing posts with label effects. Show all posts

Monday, March 19, 2012

Quick Tip: Create a Typewriter Text Effect Class

In this Quick Tip, we’ll create a static, re-usable ActionScript class that will produce a Typewriter effect with a single line. Read on!

Step 1: Brief Overview

We’ll split a user defined string into an array, and then add the resulting letters to a TextField one by one using the Timer class.

Step 2: Typewriter Class

Our class will be static, which means it doesn’t need to be instantiated using the new keyword. To access a static class member, use the name of the class instead of the name of an instance. Create a new ActionScript file and write the following code:
package
{
 import flash.text.TextField;
 import flash.utils.Timer;
 import flash.events.TimerEvent;

 public final class Typewriter
 {
  /* Declare the variables and methods as static */

  private static var chars:Array; //the characters in the string
  private static var cLen:int; //length of the string
  private static var tf:TextField; //textfield to which the string will be written
  private static var timer:Timer; //pauses between writing each character
  private static var i:int = 0; //variable used to count the written characters

  public static function write(txt:String, txtField:TextField, time:Number):void
  {
   chars = txt.split(""); //split the string into an array of characters
   cLen = chars.length + 2; //length of the string
   tf = txtField; //assign tf to the text field passed to the function
   timer = new Timer(time); //set time according to parameter

   timer.addEventListener(TimerEvent.TIMER, writeChar);
   timer.start(); //start writing function
  }

  private static function writeChar(e:TimerEvent):void
  {
   tf.appendText(chars[i]); //writes a char every time the function is called
   i++; //counts the written chars

   if(tf.length == cLen) //check whether string is complete
   {
    timer.stop();
    timer.removeEventListener(TimerEvent.TIMER, writeChar); //clear timer
    timer = null;
   }
  }
 }
}

Step 3: Usage

The usage couldn’t be easier – just add the Typewriter.as class to your project folder and use the following code:
import Typewriter;

Typewriter.write('Text to Write', targetTextfield, 50);
That’s it, test your movie and you’ll see your TextField using the Typewriter effect.

Step 4: Example

I used the class in on this example swf so you can see the effect [...]
Read more: Quick Tip: Create a Typewriter Text Effect Class

Friday, April 1, 2011

Exclusive Freebie: Ten Fab Filter Effects for Your Flash Textfields

Exclusive Freebie: Ten Fab Filter Effects for Your Flash Textfields:

If you enjoyed Muhammed Abid’s tutorial on glassifying your text with Flash filters, you’ll love this Exclusive Freebie from frequent author Carlos Yanez. It’s a set of ten such effects, ranging from gold to bubble gum, which you can easily copy and paste to apply to any text in any of your Flash projects.


The Final Results

Here’s what the ten different effects look like in action:


How To Use These Effects

Download the source zip file, extract it to your hard drive, and open TextFXPack.fla. You’ll see all of the effects available on the first frame of the timeline.

Click on the text (not the background) of the effect you wish to duplicate:

Gold text

In the Properties panel, check out the Filter section:

Gold filters

Click the little clipboard icon, and press “Copy All”:

Gold filters copy all

In your own Flash project (i.e., another FLA), select the text to which you’d like to apply the filter:

Midas text

In the Filters section of the Properties panel, click the little clipboard again and select “Paste”:

filters paste

Tada!

Midas Gold text

Friday, January 21, 2011

Use the Flash Project Panel‏ to Build a Dynamic AS3 Menu

Use the Flash Project Panel‏ to Build a Dynamic AS3 Menu: "

During this tutorial, we’ll use the Project Panel in Flash to create a vertical animated AS3 menu. The whole process will allow you to easily customize all aspects of the menu using the parameterized constructors. Read on to learn more!


Final Result Preview

Let’s take a look at the final result we will be working towards:


Step 1: Create a New Project

Start by creating a new project. Open Flash and go to File > New, then select Flash Project. The Project panel will appear.

Create a New Project

In the Projects dropdown select New Project. Type the project name “AnimatedMenu”. In the Root Folder, browse and choose where you want to save your project; you can select an already existing folder or create a new one. Make sure the ActionScript version is set to ActionScript 3.0 and click Create Project.

Creating a New Project

Step 2: Add the Classes Folder

Now that the project is created, we are going to add a new folder to group in it our classes. Still in the same panel “Project” press the “New Folder” icon in the bottom, name the new folder “Classes” and click Create Folder.

Add the Classes Folder for simple Flash menu tutorial

Step 3: Install TweenLite

During this tutorial we will use the TweenLite classes from GreenSock for tweening, so we need to add it to our project. Download it and extract it, place it in your project folder (so you will have AnimatedMenu/com/greensock/).

Now if you refresh the Project panel you should see this structure:

Install TweenLite for simple Flash menu tutorial

Step 4: Create a New Flash File

Click the “New File” icon in the Project panel to create a new file, name it “AnimatedMenu.fla” (make sure that the File Type is Flash File) and click Create File [...]

Wednesday, January 19, 2011

Creation of realistic Flash water ripples with AS3

Creation of realistic Flash water ripples with AS3:

This is basically the Flash porting of the Flex experiment made by David Lenaerts in his blog.

I found the script a very interesting way to use the NascomASLib, an open source AS3 library that provides a couple of interesting graphic effects such as pixelate and rippler, the one used in the example. The point is the original source code was written for Flex, and reading through the comments it wasn’t easy to change the embedded image with one used in the library. Some comments even say to use the Flash timeline.

That’s why I provided a quick AS3 solution to achieve this effect with no headache.

This is the script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package {
 import flash.display.Bitmap;
 import flash.display.Sprite;
 import flash.events.MouseEvent;
 import flash.display.BitmapData;
 import flash.utils.Timer;
 import flash.events.TimerEvent;
 public class Ripple extends Sprite {
  private var myRippler:Rippler;
  var rippleTarget:Bitmap;
  public function Ripple() {
   var rippleBitmap:BitmapData=new BitmapData(640,480,false,0);
   var ripplePicture:toRipple=new toRipple();
   var timer:Timer=new Timer(100);
   timer.start();
   rippleBitmap.draw(ripplePicture);
   rippleTarget=new Bitmap(rippleBitmap);
   addChild(rippleTarget);
   myRippler=new Rippler(rippleTarget,20,5,5);
   stage.addEventListener(MouseEvent.MOUSE_MOVE,onMouseMoveTriggered);
   timer.addEventListener(TimerEvent.TIMER, onTimerTriggered);
  }
  private function onMouseMoveTriggered(e:MouseEvent):void {
   myRippler.drawRipple(rippleTarget.mouseX,rippleTarget.mouseY,20,1);
  }
  private function onTimerTriggered(e:TimerEvent):void {
   var posX:Number=Math.random()*640;
   var posY:Number=Math.random()*480;
   myRippler.drawRipple(posX,posY,15,5);
  }
 }
}

The core lies in line 9 which calls the Rippler class that I modified to work as a standalone class (you will find it in the downloadable source code at the end of the post), then at line 13 that constructs a toRipple object, that is the MovieClip Symbol with the background image [...]

Tuesday, January 18, 2011

The Particle Sessions : Part One, Is this it ?

The Particle Sessions : Part One, Is this it ?:

Particles

Part One of the Particle Session kicks off with looking at a system similar, but simpler then this Bloom particle experiment (music made for it by the fantastic artist Rich Bologna, thank you again for it, Rich!). We’ll be taking slow steps of optimizations and at the end have a get prepared for the next level. To be able to get up to speed with the working of the video particles, we’ll start from the beginning and work our way up. For that reason, we’ll start very simple and look at a basic unoptimized particle system with next to zero functionality, and modify the code for performance.

Basis : The Particle

The opening picture of this post is the album cover of The Strokes – Is This It. It being one of my favorite albums, I have listened to it many times, but never noticed what the cover really was. It’s amazing & inspiring what imagery one can get from science. Now put on your headphones and listen to that album while reading this post.

Over the last years I’ve more and more started enjoying introductory books about theoretical physics. In complete honesty, it wasn’t even that long ago that I didn’t know that the Boson in the Higgs Boson wasn’t the other guy discovering it, next to Mr.Higgs. You know, like the Hale-Bopp comet was discovered by Hale & Bopp.

Luckily for us and this post, we don’t need to deal with wave particle duality and quantum entanglement, but we can achieve seeming complexity by using simplicity.

Getting started : Simplicity & Complexity

The simple core particle we will be using in this session get its complexity from its display of large numbers of them, not from per instance properties. To illustrate that, let’s start off with a simple particle object in AS3 [...]

Sunday, January 2, 2011

Exclusive Freebie: The Piecemaker 2

Exclusive Freebie: The Piecemaker 2:

Last year, Björn from Modularweb created the Piecemaker, a completely free, open source, 3D Flash image rotator gallery. Now, to kick off 2011, Björn’s giving away The Piecemaker 2: totally revamped, with brand new features. Read on for more!

What’s New?

Building on the original, the Piecemaker 2 now includes:

  • Unlimited transition effects
  • The ability to include SWF files and videos
  • Improved navigation (using tooltips)
  • Animated shadows
Piecemaker 2 Image Rotator: New Features

It’s also entirely XML-based, and the HTML/CSS parsing has been improved, allowing special characters to be used. Plus, images can now contain hyperlinks to other websites.

Piecemaker 2 Image Rotator: Embedded SWF

Take a Look

Static screenshots don’t do it justice; click here to take a look at the online preview and see it in action [...]

Monday, December 20, 2010

Glassify Your Text Using Flash Filters – Basix

Glassify Your Text Using Flash Filters – Basix:

In this tutorial you will be converting your text to give it a glass-like effect, using filters in Flash. This technique also works on vector graphics. We will achieve it with a fairly simple method of overlaying multiple layers with different effects.


Final Result Preview

Let’s take a look at the final result we will be working towards. This is a swf file and the text below is selectable, so go ahead, select the glass text to see a glass-like highlight:


Step 1: Create Your Text Field

Open your version of Flash and open a new Flash file. ActionScript version does not matter for this tutorial, as there is no code. In your file, put a text field onto the stage. To do so, click the text button (T) on Tools menu and drag a rectangle on stage as shown in the image below:

click on text field and draw it on stage

Step 2: Select a Large and Bold Font

Once drawn, you can enter your choice of text in the field and set its properties accordingly. The glass effect is more prominent on larger and bolder fonts so I have chosen Elephant here, but you may chose any font you like. Click the Selectable button to make the text selectable in final SWF. The color of the font does not matter here

set text properties

Step 3: Add Some Vector Graphics

Optionally, you may want to see how the effect works on vector graphics. So I will just draw a small graphic using basic Flash drawing tool. Note that glass effect will not take into account the outlines or colors, so plain old graphics in a single color are enough for the moment. Once done with Steps 1 and 2, you will have something like this on your stage:

vector included

You may import vector graphics to Flash surface as well but take note that color differences are not detected by this effect [...]

Thursday, December 16, 2010

Smoke Effect With Papervision 3D

Smoke Effect With Papervision 3D: "

In this tutorial the author, being inspired by the latest PS3 boot menu, creates colorful art using curves in Papervision 3D. Let’s also try to create a dynamic and really good looking smoke effect.

"

Tuesday, December 14, 2010

Fireworks Show in AS3

Fireworks Show in AS3: "New Year is close and this tutorial will show you how to create fireworks in AS3."