2 Replies Latest reply on Oct 10, 2006 5:58 AM by LifeBugs

    var in loop

      hello all,
      I have a action script class which is bindable and instantiates objects of other class
      as :

      public class Templateobjects

      public var template1 = new sampleTemplate1();

      public var template2 = new sampleTemplate2();

      public function Templateobjects(){

      // constructor function


      and in my mxml file i import this class as and trying to access this variables in this class, as:

      import Templateobjects;
      public var templatelistObject:Templateobjects = new Templateobjects();

      for(var i:Objects in Templateobjects){
      trace(" found objects");

      i am not getting the trace...
      please tell me how should i go about this.


        • 1. Re: var in loop
          inlineblue Level 1
          From the docs:

          ...you can use a for..in loop to iterate through the properties of a generic object...What you cannot do is iterate through the properties of an object if it is an instance of a user-defined class, unless the class is a dynamic class. Even with instances of dynamic classes, you will be able to iterate only through properties that are added dynamically.
          • 2. Re: var in loop
            LifeBugs Level 1
            Right i tried that and it worked ..