ShowSystem.as - Showing System Properties

This section provides a tutorial example on how to system properties - memory usages of the Flash Player.

As another example of using ActionScript 3, I created this code, ShowSystem.as, to show some system properties:

// ShowSystem.as
// Copyright (c) 2014, HerongYang.com, All Rights Reserved.
//
package com.herongyang {
   import flash.display.*;
   import flash.text.*;
   import flash.system.*;
   public class ShowSystem extends MovieClip {
      private var color:uint = 0xffffcc;
      private var black:uint = 0x000000;

// Building my first frame in the constructor
      public function ShowSystem() {
         addCircle();
         addText();
      }

// Building a shap object
      private function addCircle():void {
         graphics.beginFill(color);
         graphics.lineStyle(5, black);
         graphics.drawRect(10, 10, 200, 100);
         graphics.endFill();
      }

// Building a text object
      private function addText():void {
         var object:TextField = new TextField();
         object.text 
            = "Total Memory (bytes): "+System.totalMemoryNumber+"\n"
            + "Free Memory (bytes): "+System.freeMemory+"\n"
            + "Private Memory (bytes): "+System.privateMemory+"\n"
            + "this.toString(): "+System.toString()+"\n"
            + "this.ime.toString(): "+System.ime.toString()+"\n";
         object.width = 200;
         object.x = 20;
         object.y = 20;
         addChild(object);
      }

   }
}

Compile the source code, generate the HTML code, and view it with Firefox. You will see the Flash displaying some messages like:

Total Memory (bytes): 62197760
Free Memory (bytes): 209420288
Private Memory (bytes): 70045696
this.toString(): [class System]
this.ime.toString(): [object IME]

Last update: 2014.

Table of Contents

 About This Book

 Introduction of Adobe Flash

 Adobe Flash Player Plugin for Firefox

 Adobe Flash Player Plugin for Chrome

 Adobe Flash Player Plugin for Safari

 Adobe Flash Player ActiveX for IE

 Using "object" Elements for Flash Files

 Using "embed" Elements for Flash Files

 "mp3player" - MP3 Music Player

 SWFObject - Hidding "object" behind JavaScript

 Flash Player Projector

 SWFTools - SWF File Manipulation Tools

 SWFC Script to Generate Flash SWF Files

 ActionScript Embedded in SWFC Script

AS3Compile - ActionScript 3 Compiler

 What Is AS3Compile?

 smiley.as - First ActionScript 3 Example

 MyMovieClip.as - Adding Graphics and Text

ShowSystem.as - Showing System Properties

 Adobe Flex SDK 4

 SWF File Structure and Tags

 SWF File Processing Rules

 SWF Files for Video and Audio Streams

 Outdated Tutorials

 References

 PDF Printing Version