Advertisement
  1. Code
  2. JavaScript

Quick Tip: Check Flash Player Version Using ActionScript 3

Scroll to top
Read Time: 1 min

In this Quick Tip, I'll show you how to get and display the Flash Player Version using ActionScript. Let's take a look!


Final Result Preview

Here's the final result we will be working towards:


Step 1: Brief Overview

Using the Capabilities class, we'll get the Flash Player version and Operating System then display them in a series of TextFields.


Step 2: Set Up Your Flash File

Launch Flash and create a new Flash Document.

Set the stage size to 300x100px.


Step 3: Interface

This is the interface we'll be using, a simple background with six TextFields, three static, three dynamic. Don't forget to add the instance names shown in the image.


Step 4: ActionScript

This is the class that does the work, it's basically a common class structure, the constructor sets the Capabilities returned values to the TextFields in stage.

1
2
package 
3
{
4
	import flash.display.Sprite;
5
	import flash.system.Capabilities;
6
	
7
	public class Main extends Sprite
8
	{
9
		public function Main():void
10
		{
11
			playerVersion.text = Capabilities.version;
12
			osVersion.text = Capabilities.os;
13
14
			/* This is a shorthand if statement, the regular if would look like this:

15


16
			if(Capabilities.isDebugger == true)

17
			{

18
				debugger.text = "Yes";

19
			}

20
			else

21
			{

22
				debugger.text = "No";

23
			}

24
			*/
25
26
			debugger.text = Capabilities.isDebugger ? "Yes" : "No";
27
		}
28
	}
29
}

Step 5: Document Class

Remember to add the class name to the Class field in the Publish section of the Properties panel.


Conclusion

Now you know how to check and display the Flash Player version, useful in many ways, especially if your application requires a newer version and you want to display a message to alert the user.

I hope you liked this Quick Tip, thank you for reading!

Advertisement
Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.