Learn Actionscript - 10 Code Examples & CST Typing Practice Test
ActionScript is an object-oriented programming language originally developed for Adobe Flash, used to create interactive multimedia, animations, games, and rich web applications.
View all 10 Actionscript code examples →
Learn ACTIONSCRIPT with Real Code Examples
Updated Nov 20, 2025
Code Sample Descriptions
ActionScript Counter and Theme Toggle
var count:int = 0;
var isDark:Boolean = false;
function updateUI():void {
trace("Counter: " + count);
trace("Theme: " + (isDark ? "Dark" : "Light"));
}
function increment():void {
count++;
updateUI();
}
function decrement():void {
count--;
updateUI();
}
function reset():void {
count = 0;
updateUI();
}
function toggleTheme():void {
isDark = !isDark;
updateUI();
}
// Simulate actions
updateUI();
increment();
increment();
toggleTheme();
decrement();
reset();
Demonstrates a simple counter with theme toggling using ActionScript variables and console output.
ActionScript Simple Addition
var a:int = 10;
var b:int = 20;
var sum:int = a + b;
trace("Sum: " + sum);
Adds two numbers and prints the result.
ActionScript Factorial
function factorial(n:int):int {
if (n <= 1) return 1;
return n * factorial(n - 1);
}
trace("Factorial 5: " + factorial(5));
Calculates factorial recursively.
ActionScript Fibonacci Sequence
function fib(n:int):int {
if (n < 2) return n;
return fib(n-1) + fib(n-2);
}
for (var i:int = 0; i < 10; i++) {
trace(fib(i));
}
Generates first 10 Fibonacci numbers.
ActionScript Max of Two Numbers
var a:int = 10;
var b:int = 20;
var max:int = (a > b) ? a : b;
trace("Max: " + max);
Finds the maximum of two numbers.
ActionScript Array Sum
var arr:Array = [1,2,3,4,5];
var sum:int = 0;
for each (var x:int in arr) {
sum += x;
}
trace("Sum: " + sum);
Sums elements of an array.
ActionScript Even Numbers Filter
var arr:Array = [1,2,3,4,5];
for each (var x:int in arr) {
if (x % 2 == 0) trace(x);
}
Prints even numbers from an array.
ActionScript Conditional Counter Increment
var count:int = 3;
if (count < 5) count++;
trace("Count: " + count);
Increment counter only if less than 5.
ActionScript Resettable Counter
var count:int = 0;
count++;
count++;
trace("Count: " + count);
count = 0;
trace("Count: " + count);
Counter that increments and can be reset.
ActionScript Theme Toggle Only
var isDark:Boolean = false;
trace("Theme: " + (isDark ? "Dark" : "Light"));
isDark = !isDark;
trace("Theme: " + (isDark ? "Dark" : "Light"));
isDark = !isDark;
trace("Theme: " + (isDark ? "Dark" : "Light"));
Toggles theme multiple times.
Frequently Asked Questions about Actionscript
What is Actionscript?
ActionScript is an object-oriented programming language originally developed for Adobe Flash, used to create interactive multimedia, animations, games, and rich web applications.
What are the primary use cases for Actionscript?
Interactive web applications. Flash and AIR games. Animations and multimedia content. GUI elements and dashboards. E-learning and interactive tutorials
What are the strengths of Actionscript?
Easy to learn for JavaScript developers. Strong multimedia integration. Rich support for interactive animations. Cross-platform via Flash Player or AIR. Fast prototyping of web-based games
What are the limitations of Actionscript?
Limited modern browser support due to Flash deprecation. Security concerns in web environments. Smaller ecosystem today. Not suitable for server-side or mobile-first development. Performance limited compared to modern JS engines
How can I practice Actionscript typing speed?
CodeSpeedTest offers 10+ real Actionscript code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.