September 20, 2009

Autotyping text animation in flash


From:
www.flashfridge.com




Step 1

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as whatever you like. Select white color as background color. Set your Flash movie's frame rate to 34 and click ok.

Step 2

Select the Text Tool (A) and go the Properties Panel (Ctrl+F3) below the stage. Then, choose the following options:

1. Select a Dynamic Text field,
2. Select a Lucida Sans as font.
3. Choose 12 as font size and bold it,
4. Select #000000 as color,
5. As the rendering option, select Use Anti-alias for readability.
6. For instance name choose My_text.



After that, click and drag out a big text field on the stage. Make it a little bit smaller than the stage.



Step 3

Call the current layer autotyping text. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 4

Create a new layer above the layer autotyping text and name it action script. After that, select the first frame of layer action script and go to the action script panel (F9). Then, enter this code inside the actions panel:

var i:Number = 0;
var myMessage:String = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. \n\n It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.";

function autoWrite():Void {
 if (i<=myMessage.length) {
  My_text.text = myMessage.substr(0, i)+"█";
  i = i+1;
 } else {
  clearInterval(writingInterval);
 }
}

var writingInterval:Number = setInterval(autoWrite, 16);
Again_btn.onRelease = function():Void {
 i = 0;
 writingInterval = setInterval(autoWrite, 16);
}

Step 5

Create a new layer above the layer action script and name it again button. After that, select the Text Tool (A), choose Static Text, any font, font size and type somewhere on the stage again. After that, while the text is still selected, hit F8 key (Convert to Symbol) to convert it into a Button Symbol.



Step 6

While the button symbol is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Button Symbol "Again_btn". See the picture below!



We're done now!

Test your movie and enjoy!

Full particle animation using the AS


From:
www.flashfridge.com




Step 1


Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the width of your document to 400 pixels and the height to 250 pixels. Select any color as background color. Set your Flash movie's frame rate to 33 and click ok.


Step 2


Call the current layer background. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!


Step 3


Save the image below!





Step 4


Choose now File > Import > Import to stage (Ctrl+R) and import the image that you just saved into a flash stage. While the image is still selected, go to the Align Panel (Ctrl+K) and do the following:


1. Make sure that the Align/Distribute to Stage button is turned on,
2. Click on the Align horizontal center button and
3. Click the Align vertical center button.





Step 5


Click now on frame 30 and hit F5 key.


Step 6


Create a new layer above the layer background and name it particle.


Step 7


Select the Oval Tool (R). In the Colors portion of the Tool panel, block the Stroke color by clicking on the little pencil icon and then on the small square with the red diagonal line. For Fill color choose any color and draw a circle shape about 20x20 px like it is shown on the picture below!





Step 8




While the circle shape is still selected, go to the Color Mixer Panel (Shift+F9) and make the adjustments as follows:





Step 9


While the particle shape is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol. See the picture below!





Step 10


Double-click on the movie clip on stage with the Selection tool (V). You should now be inside the movie clip.





Step 11


While the particle shape is still selected, hit again F8 key (Convert to Symbol) to convert it into a Graphic Symbol.





Step 12


Select now the first frame, go to the As panel (F9) and enter this code inside the actions panel:


xMin = 0;
xMax = 400;
yMin = 0;
yMax = 250;
minSize = 10;
maxSize = 50;
easeFactor = 10;
randomX = Math.random () * ( xMax - xMin ) + xMin;
randomY = Math.random () * ( yMax - yMin ) + yMin;
randomSize = Math.random () * ( maxSize - minSize ) + minSize;


Step 13


Click now on frame 3 and hit F6 key. After that, while you're still on frame 3, go again to the AS panel (F9) and enter this code inside the actions panel:


distance = Math.sqrt(Math.pow(this._x-randomX, 2)+Math.pow(this._y-randomY, 2));
if (Math.abs(this._width-maxSize)>1) {
  this._width += (randomSize-this._width)/2;
 this._height += (randomSize-this._height)/2;
}
if (distance>1) {
 this._x += (randomX-this._x)/easeFactor;
 this._y += (randomY-this._y)/easeFactor;
 gotoAndPlay(2);
} else {
 gotoAndPlay(1);
}


Step 14


Go back now on the main stage (Scene 1). After that, select the particle and duplicate it few times!


That's it!


Test your movie and enjoy!

Full movie symbol control using the AS


From:
www.flashvault.net


Step 1

First of all, download images of button symbols that we will use for this lesson.

Step 2

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as whatever you like. Select any color as background color. Set your Flash movie's frame rate to 32 and click ok.

Step 3

Call the current layer button symbols. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 4

Choose File > Import > Import to Library. In the file explorer window that appears, find a three images (button, button1 and button2) and Shift-click to select them all. Then click open. If you now open your flash library (Ctrl+L key) you will see three images that you just imported. See the picture below.



Step 5

Select the Selection Tool (V) and using the drag and drop technique, move all button symbols from the flash Library on the flash stage and place it on the position like it is shown on the picture below!



Step 6

Select now just left rotation button like it is shown on the picture below!



After that, hit F8 key (Convert to Symbol) to convert it into a Button Symbol.



Step 7

While the new made Button is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Button RightRotate_btn. See the picture below.



Step 8

Select now just up arrow button and hit F8 key (Convert to Symbol) to convert it into a Button Symbol.





Step 9

While the new made Button is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Button UpArrow_btn. See the picture below.



Repeat this process also for every other button symbols but for instance name choose (DownArrow_btn, RightArrow_btn, LeftArrow_btn and LeftRotate_btn.

Step 10

It's time for Movie Symbol, so create a new layer above the layer button symbols and name it Movie Symbol.

Step 11

Select Movie Symbol layer and draw or import any object, image which will represent movie symbol.

Step 12

While the image or object is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.



Step 13

While the new made movie clip is still selected, go again to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip object_mc. See the picture below!



Step 14

It's time for action script, so create a new layer above the layer Movie Symbol and name ti action script.

Step 15

Select now the first frame of layer action script and enter this code inside the actions panel:

UpArrow_btn.onPress = function() {
 object_mc.onEnterFrame = function() {
  this._y -= 4;
 };
};
UpArrow_btn.onRelease = function() {
 delete object_mc.onEnterFrame;
};
DownArrow_btn.onPress = function() {
 object_mc.onEnterFrame = function() {
  this._y += 3;
 };
};
DownArrow_btn.onRelease = function() {
 delete object_mc.onEnterFrame;
};
RightArrow_btn.onPress = function() {
 object_mc._x += 4;
};
LeftArrow_btn.onPress = function() {
 object_mc._x -= 4;
};
LefttRotate_btn.onPress = function() {
 object_mc.onEnterFrame = function() {
  this._rotation += 3;
 };
};
LefttRotate_btn.onRelease = function() {
 delete object_mc.onEnterFrame;
};
RightRotate_btn.onPress = function() {
 object_mc.onEnterFrame = function() {
  this._rotation -= 3;
 };
};
RightRotate_btn.onRelease = function() {
 delete object_mc.onEnterFrame;
};

We're done now!

Test your movie and enjoy!

Create an eye-catching glittering neon


From:
http://www.riacodes.com/flash/create-an-eye-catching-glittering-neon


Preview link:
http://files.riacodes.com/flash_neon


Download source:
http://files.riacodes.com/flash_neon/src.zip


1. Create a new flash file (Actionscript 3.0) and save it as neon.fla.
2. Rename “layer 1″ to “neon” and on this layer, draw the shape that will be your neon. Convert it to a movie clip and give an instance name of “neon_mc”.
3. Create a new “actions” layer. With its first frame selected, open the actions panel.
To create the appearance of a neon we apply to “neon_mc” a glow filter.
To make the “on/off glitter”, we use the Timer class. We declare two timers, one that will tell us when the neon will start glittering and the second that we’ll use to set the duration of the glitter.
When the light is off, we set the alpha property to a low value and when we want the neon to glitter, we change its alpha property to a random high value.
4. Here’s the entire code, test your movie to see it in action. from
01.var timerOn : Timer ;
02.var timerDuration : Timer ;
03.var glow:GlowFilter ;
04. 
05.function init():void{
06.glow = new GlowFilter(0xFFFF5B,1,5,5,2,BitmapFilterQuality.HIGH);
07.neon_mc.filters = [glow];
08.neon_mc.alpha = .1;
09.timerOn = new Timer(1000);
10.timerDuration = new Timer(3000);
11.timerOn.addEventListener(TimerEvent.TIMER, startGlitter);
12.timerDuration.addEventListener(TimerEvent.TIMER,stopGlitter);
13.timerOn.start();
14.}
15. 
16.function startGlitter(e:TimerEvent):void{
17.timerOn.stop();
18.timerDuration.start();
19.this.addEventListener(Event.ENTER_FRAME, glitter);
20.}
21. 
22.function glitter(e:Event):void{
23.neon_mc.alpha = .5 +(Math.random() * .5);
24.}
25. 
26.function stopGlitter(e:TimerEvent):void{
27.timerDuration.stop();
28.this.removeEventListener(Event.ENTER_FRAME,glitter);
29.neon_mc.alpha = .1;
30.timerOn.delay = 1000 + Math.random()*3000;
31.timerOn.start();
32.}
33. 
34.init();