When I attempt to create a new flash list component from my as3 file (FrontEnd.as) and add it to the stage, I get the following error: "1046: Type was not found or was not a compile-time constant: List". Below is the code:
package {
import flash.display.MovieClip;
import fl.controls.List;
public class FrontEnd extends MovieClip {
public function FrontEnd():void {
trace("FrontEnd Here");
init();
}
private function init() {
var userSelect:List = new List();
addChild(userSelect);
userSelect.move(200, 100);
userSelect.width = 120;
}
}
}
Someone commented on a livedocs page that you have to drag the component to the .fla library and cannot create it solely from as3. Is this really 开发者_如何学Pythontrue? Hoping someone can set me straight, thanks.
That is true, Think of the UI Components in Flash as made of 2 parts:
- The classes that manage the components
- The visual assets of the components.
When you import the classes from actionscript alone, they will be missing the visual elements that go hand in hand with that, so just drag the List component to the Library and you should be fine.
精彩评论