3 Replies Latest reply on Dec 18, 2006 8:07 AM by demiurgu

    Dynamic instance of AS2.0 class problem

    demiurgu
      Flash compiler actually _omits_ the classes that I reference using import if they are not literally called upon in code (which is ridiculous)

      It would be interesting to see what Adobe has to say about this and to explain how we can instance dynamic.

      please help me and tell me what diffrent is in this code:

      1.
      this code do not make mx.transitions.easing.Bounce visible in _globals
      import mx.transitions.easing.Bounce




      2: Corect code
      this cod bring mx.transitions.easing.Bounce in _globals
      import mx.transitions.easing.Bounce
      mx["transitions"]["easing"]["Bounce"];



      3.Not corect code
      this code do not make mx.transitions.easing.Bounce visible in _globals ;
      import mx.transitions.easing.Bounce
      var t:String = "Bounce"
      mx["transitions"]["easing"][t];



      hmmm ... please help me.

      Demiugu
        • 1. Re: Dynamic instance of AS2.0 class problem
          arunbe Level 1
          Hi,

          The Flash class files like transition manager classes will not allow us to use the functions name by strings. You have to mentions the functions name directly.
          Better , if you want to make this for so many transition , use the switch case method and assign the function directly in the cases.
          • 2. Re: Dynamic instance of AS2.0 class problem
            Peter Lorent Level 2
            The import statement doesn't import anything. It just enables you to not have to type the fully qualified path every time you reference the class (pretty ridiculous that you don't know that...).
            Just:
            mx.transitions.easing.Bounce;
            will force the compiler to include the class.
            • 3. Re: Dynamic instance of AS2.0 class problem
              demiurgu Level 1
              import mx.transitions.easing.Bounce
              mx["transitions"]["easing"]["Bounce"];

              this is work ...
              I used the functions named by strings, but if i use varialble in place of literaly string it is not work ...


              Now i know that "the import statement doesn't import anything" so ...
              how can create object instanced dynamic...

              for example i have an class wich is named "TestClass"
              It's name is contained in string variable. ...

              there is a class in "Utils" wich is named "ClassFinder". This class has a method "findClass" wich is searching in _globals for references to constructors ... i can not use this if the references to constructor is not in _globals.

              please without switch methods :)

              10x