Total amount of memory allocated (totmem) to Flash Player at 1-second intervals. : FlexGlobals « Development « Flex






Total amount of memory allocated (totmem) to Flash Player at 1-second intervals.

Total amount of memory allocated (totmem) to Flash Player at 1-second intervals.
           

<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->



    <!-- optimize/ShowTotalMemory.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
    initialize="initTimer()">
    <fx:Script> 
        import flash.utils.Timer; 
        import flash.events.TimerEvent; 
        [Bindable] 
        public var time:Number = 0; 
        [Bindable] 
        public var totmem:Number = 0; 
        [Bindable] 
        public var maxmem:Number = 0; 
        public function initTimer():void { 
            // The first parameter is the interval (in milliseconds). The 
            // second parameter is number of times to run (0 means infinity). 
            var myTimer:Timer = new Timer(1000, 0); 
            myTimer.addEventListener("timer", timerHandler); 
            myTimer.start(); 
        } 
        public function timerHandler(event:TimerEvent):void { 
            time = getTimer();
            totmem = flash.system.System.totalMemory; 
            maxmem = Math.max(maxmem, totmem); 
        } 
      </fx:Script>
    <mx:Form>
        <mx:FormItem label="Time:">
            <mx:Label text="{time} ms" />
        </mx:FormItem>
        <mx:FormItem label="totalMemory:">
            <mx:Label text="{totmem} bytes" />
        </mx:FormItem>
        <mx:FormItem label="Max. Memory:">
            <mx:Label text="{maxmem} bytes" />
        </mx:FormItem>
    </mx:Form>
</s:Application>

   
    
    
    
    
    
    
    
    
    
    
  








Related examples in the same category

1.Park Theme ColorPark Theme Color
2.Gets the SWF file's URL and extracts the host name from the URLGets the SWF file's URL and extracts the host name from the URL