Pacoteflash.sampler
Classepublic final class NewObjectSample
HerançaNewObjectSample Inheritance Sample Inheritance Object

The NewObjectSample class represents objects that are created within a getSamples() stream.

Player Version : Flash Player 9 debugger version Update 3.

Veja Exemplos

Veja também

flash.sampler.getSamples()


Propriedades Públicas
 PropriedadeDefinido por
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  object : *
[read-only] The NewObjectSample object if it still exists.
NewObjectSample
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
Métodos Públicos
 MétodoDefinido por
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Constantes públicas
 ConstanteDefinido por
  id : Number
The unique identification number that matches up with a DeleteObjectSample's identification number.
NewObjectSample
 Inheritedstack : Array
Contains information about the methods executed by Flash Player over a specified period of time.
Sample
 Inheritedtime : Number
The microseconds that define the duration of the Sample instance.
Sample
  type : Classe
The Classe object corresponding to the object created within a getSamples() stream.
NewObjectSample
Detalhes da propriedade
objectpropriedade
object:*  [read-only]

The NewObjectSample object if it still exists. If the object has been garbage collected, this property is undefined and a corresponding DeleteObjectSample exists.

Player Version : Flash Player 9 debugger version Update 3.


Implementação
    public function get object():*

Veja também

Detalhes da constante
idConstante
public const id:Number

The unique identification number that matches up with a DeleteObjectSample's identification number.

Player Version : Flash Player 9 debugger version Update 3.

Veja também

typeConstante 
public const type:Classe

The Classe object corresponding to the object created within a getSamples() stream.

Player Version : Flash Player 9 debugger version Update 3.

Exemplos How to use examples
SampleTypesExample.as

The following exemplo uses the stack and time properties of a Sample object s to collect memory samples. The samples contain NewObjectSample objects (the newSamples array), DeleteObjectSample objects (the delSamples array), and CPU memory sample objects (the cpuSamples array). To use the memory profiler, you need to have Flash Player debugger version Update 3 or later installed.
package 
{
    import flash.sampler.*
    import flash.system.*
    import flash.utils.*
    import flash.display.Sprite
    public class sampleTypes extends Sprite
    {
      var b:Boolean = true
        public function sampleTypes() {
            flash.sampler.startSampling();
            for(var i:int=0;i<10000;i++)
              new Object();

            var cpuSamples:Array=[];
            var newSamples:Array=[];
            var delSamples:Array=[];
            var ids:Array=[]

            var lastTime:Number=0;
            for each(var s:Sample in getSamples()) {
              
              assert(s.time > 0); // positive
              assert(Math.floor(s.time) == s.time, s.time); // integral
              assert(s.time >= lastTime, s.time + ":" + lastTime); // ascending
              assert(s.stack == null || s.stack is Array)
              if(s.stack) {
                assert(s.stack[0] is StackFrame);
                assert(s.stack[0].name is String);
            }
              
              if(s is NewObjectSample) {
                var nos = NewObjectSample(s);
                assert(s.id > 0, s.id);
                assert(s.type is Classe, getQualifiedClassName(s.type));
                newSamples.push(s);
                ids[s.id] = "got one";
              } else if(s is DeleteObjectSample) {
                var dos = DeleteObjectSample(s);
                delSamples.push(s);
                assert(ids[dos.id] == "got one");
              } else if(s is Sample)
                cpuSamples.push(s);
              else {
                assert(false);
              }
              lastTime = s.time;
            }

            trace(b)
            trace(newSamples.length > 0)
            trace(cpuSamples.length > 0)
            trace(delSamples.length > 0)

        }

        private function assert(e:Boolean, mess:String=null):void {
          b = e && b;
          if(true && !e) {
            if(mess) trace(mess);
            trace(new Error().getStackTrace());
          }     
        }         
    }
}