0% found this document useful (0 votes)
11 views10 pages

Matrix

The document provides a step-by-step guide for creating a pulsing effect in Adobe Flash using ActionScript and MovieClips. It details the setup of the document, creation of a text field, embedding a font, and coding the Matrix effect with animated lines of code. Additionally, it includes instructions for creating a flickering neon sign effect with randomized alpha settings using ActionScript.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views10 pages

Matrix

The document provides a step-by-step guide for creating a pulsing effect in Adobe Flash using ActionScript and MovieClips. It details the setup of the document, creation of a text field, embedding a font, and coding the Matrix effect with animated lines of code. Additionally, it includes instructions for creating a flickering neon sign effect with randomized alpha settings using ActionScript.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 10

Step 1 : Document Setup

Open Adobe Flash and Modify the Document Properties.


Modify > Document
Size: 380 x 250 (You can make it any dimension)
Frame Rate: 30 fps
Background: Black

Step 2 : Creating The One


This effect is achieved using ActionScript and one MovieClip. So let's start by creating
The One and then we'll code his purpose.

Select the Text Tool, , and set the properties below:

Text properties continued:

Click on Stage to create a Text Field and enter a single letter.

Since the Matrix font is uncommon; we need to embed it into the Flash Movie. Select the
Text Box and click Embed...
We only need the lowercase letters.

Now go back to the text properties and give it an instance name "Neo".

With Neo selected, convert him into a MovieClip symbol.


Modify > Convert to Symbol
Name: the_one
Registration: bottom, center

Give the MovieClip an instance name of "the_one".


Step 3 : Pulsing with power
In this step we will setup the_one to pulse with power. To understand what I mean, look
at my Matrix animation and watch as a white pulse of energy flows up each of the lines
of code. It's a nice added touch.

With the_one Movieclip selected, wrap it inside another Movieclip:


Modify > Convert to Symbol
Name: one_pod
Registration: bottom, center
Export for ActionScript: checked
Linkage Identifier: one_pod

Double Click the Movieclip on Stage. Select frame 10 and insert a keyframe:
Insert > Timeline > Keyframe (F6)
Now insert an additional keyframe at 20.
Click frame 10 again, select the MovieClip on Stage and change the Color to "Tint" with
the following settings:

With the MovieClip still selected, open the Transform Pane and increase it the scale to
125%. This will make the pulse buldge with energy as it travels up the line of code.

Now the tweening white pulse. Click in between frame 1 and 10:

In the properties pane, select "Motion" under Tween and set Easing to 100.
This will gradually slow the pulse as it reaches the brightest point.

Click between frame 10 and 20, set Tween: Motion, easing -100 IN.

Your timeline should now be all blue.

One last important thing, Click Frame 1 and open the ActionScript window
Window > Actions
Enter the single command "stop();".

We are done setting up the Movieclip, click "Scene 1" to return to the Main Timeline.

Click the MovieClip on Stage and Delete it. Don't worry, it remains in our library ready
to be referenced by the Linkage Identifier "one_pod".

Step 4 : Coding the Flash Matrix


It's time to code the Matrix. The ActionScript below may look intimidating at first but,
like most scripts, if you take the time to read the comments you will begin to understand
how it works.

Select Frame 1 on the Timeline and open the ActionScript Window.


Window > Actions

Copy & Paste the following code: ( All explained in my comments )

// ---------------------------------------------
// The Flash Matrix - www.pixelhivedesign.com
// ---------------------------------------------
// Initialize variables.
maxLines = 25; // Maximum number of lines at once.
minScale = 10; // Minimum scale of a line.
maxScale = 100; // Maximum scale of a line.
// Create an empty Movieclip to hold the Matrix.
theMatrix = createEmptyMovieClip('MatrixCode',1);
curLines = 0; // Keeps track of the current number of
lines.
// ----------------------
// Generating the Matrix.
// ----------------------
theMatrix.onEnterFrame = function(){
// Check that the current number of lines is less than
the maximum allowed.
if(curLines <= maxLines){
curLines++; // Increment the number of lines.
// Create a new line.
codeLine =
this.createEmptyMovieClip('codeLine',curLines);
// Generate a random scale for the line.
// This simulates lines at different distances.
var ranScale = Math.round(Math.random() * (maxScale-
minScale)) + minScale;
codeLine._xscale = codeLine._yscale = ranScale;
// Position the line at a random X location.
codeLine._x = Math.random() * Stage.width;
// Determine line speed based on the distance.
codeLine.speed = (codeLine._xscale)/10;
// ---------------------------------------------
// Creating a line of multiple pods (characters)
// ---------------------------------------------
codeLine.myCodes = []; // Array to store individual
pods.
numPods = 0; // Number of pods.
while(codeLine._height < Stage.height){
numPods++; // Increment the number of pods.
// Attach a single pod to the line of code.
pod =
codeLine.attachMovie('one_pod','pod'+numPods,numPods);
codeLine.myCodes.push(pod); // store pod.
// Position pod above the last one (vertical lines)
pod._y -= (pod._height+2) * numPods;
// Choose a random Matrix character.
// Character Codes for lower case letters are between
96 & 123
pod.the_one.Neo.text = chr(Math.round(Math.random() *
27) + 96);
}
// ----------------------------
// Initialize the white pulse.
// ----------------------------
// Store pod position to start at.
codeLine.ind = 0;
// Store delay between pulses.
codeLine.delay = codeLines.myCodes.length;
// ------------------------------------
// Animating each line of code.
// ------------------------------------
codeLine.onEnterFrame = function(){
// -------------------------------
// Vertical animation of the line.
// -------------------------------
// Every frame make the line move down by it's speed.
this._y += this.speed;
// Check if the line of code has animated off the Stage
if(this._y - this._height >= Stage.height) {
// Yes, so allow an additional line to be generated.
maxLines++;
// Remove this line and free memory.
this.removeMovieClip();
}
// ----------------------------
// Animating the white pulse.
// ----------------------------
// Get next pod to affect.
this.curCode = this.myCodes[this.ind];
// If the pod is not currently animating, start its
animation.
if(this.curCode._currentframe == 1)
this.curCode.play();
// Check if we have reached the end of the line.
if(this.ind < this.myCodes.length and this.delay != 0){
// No, then move on to next character.
this.ind++;
// Decrease the delay before next pulse.
this.delay--;
} else {
// Yes, then reset the character position.
this.ind = 0;
// Reset the delay before next pulse.
this.delay = this.myCodes.length;
}
}
}
}

Neonnnnnnnnnn
Step 1 : Document Setup
Open Adobe Flash and Modify the Document Properties.
Modify > Document
Size: 390 x 250 (Size of my example graphics)
Frame Rate: 30 fps
Background: White

Step 2 : Import Images and Prepare for Effect


Import the supplied sign_off.jpg onto the Stage.
File > Import > Import to Stage...

With the image selected use the Align Pane to position it on Stage. Make sure the "To
Stage" button is down, then click the two align options below:
Window > Align

In the Timeline Pane, rename 'layer 1' to 'Brick Wall'.

Create 1 new layer by clicking Insert Layer, .


Rename the new layer 'Neon Sign', see below:

Import the supplied sign_on.jpg onto the Stage.


File > Import > Import to Stage...
With the On Neon Sign selected, convert it into a MovieClip symbol.
Modify > Convert to Symbol
Name: Neon_Sign

Double click the Neon Sign MovieClip

In the Timeline Pane, rename 'layer 1' to 'Neon Sign'.

Create 1 new layer by clicking Insert Layer, .


Rename the new layer 'Actionscript', see below:

Step 3 : Flickering the Neon Sign using Actionscript


It's already time to code the Flicker effect. The basic idea is to alternate the MovieClip
between two different alpha settings. The rest is making the effect dynamic by
randomizing the times in which the MovieClip will flicker.

Select Frame 1, labeled "Actionscript", on the Timeline inside the Movieclip you want to
flicker and open the ActionScript Window.
Window > Actions

Copy & Paste the following code: ( All explained in my comments )

1. // -------------------------------
2. // Flickering MovieClip Effect
3. // www.pixelhivedesign.com
4. // -------------------------------
5. // All time in milliseconds. (1000 = 1 second)
6. maxTB = 4000; // Maximum time between flickering
7. minTB = 1000; // Minimum time between flickering
8. flickerDuration = 2000; // How long flicker will last
9.
10. // Get a random start time.
11. flickerTime = getNewTime();
12.
13. // Every frame execute the following code.
14. this.onEnterFrame = function(){
15. // Get current time in milliseconds.
16. curTime = getTimer();
17.
18. // Check if current time is past the time to
flicker.
19. if(curTime >= flickerTime){
20. // Flickering.
21. // Check if flicker has lasted the duration
specified.
22. if(curTime <= flickerTime+flickerDuration){
23. // Continue flickering.
24. // Alternate between alpha values.
25. // This creates the flicker appearance.
26. if( cnt >= 2){
27. // Reduce alpha.
28. // Lower this for more dramatic effect.
29. this._alpha = 90;
30. cnt = 0;
31. } else {
32. // Increase alpha.
33. this._alpha = 100;
34. cnt++;
35. }
36. } else {
37. // Flicker lasted for duration.
38. // Stop flickering and get next time to flicker.
39. this._alpha = 100;
40. flickerTime = getNewTime();
41. }
42. }
43. }
44. // Create a random time between maxTB and minTB
specified.
45. function getNewTime(){
46. return getTimer() + (Math.random() * (maxTB-
minTB))+minTB;
47. }

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy