Skip to main content
Participant
December 14, 2006
Question

Dynamic instance of AS2.0 class problem

  • December 14, 2006
  • 3 replies
  • 294 views
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"];



hmmm ... please help me.

Demiugu
This topic has been closed for replies.

3 replies

demiurguAuthor
Participant
December 18, 2006
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




Inspiring
December 14, 2006
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.
December 14, 2006
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.