The function flash.utils.getDefinitionByName has been discussed in various other places (amongst others here and of course in the documentation), but it took a bit of a mental jump to use it as the solution for the problem that linked library instances without a class are not known inside FDT.Suppose we have a library item with a linkage id of “square”, and we decide not to attach a class to it. Flash CS3 reminds us that it will create one for us, and if we code inside the Flash IDE, we can happily write: var s:Sprite = new square(); addChild(s);However, FDT will show an error, because it doesn’t have a clue what you’re talking about. To solve this, use getDefinitionByName("square"), as shown in the following example:
-
-
package {
-
import flash.utils.getDefinitionByName;
-
-
-
-
public function Application () {
-
addChild(s);
-
}
-
}
-
}
-
Comment by Jankees
1 26 Nov, 2007, 12:08 o'clock |
Just what I was looking for