PDA

View Full Version : Components make me cry like a baby!


ixlepixle
07-06-2004, 03:22 PM
Gaaa! Maybe I am retarded but I just can't make the components in MX2004 work...

The problem is this:

I have subclassed MovieClip, and made a onPress() method. When the mouse is pressed, I want to dynamically add a TextArea to the stage. First of all, yes I have added a TextArea component to the library, so that is not a problem :)

I've tried using this

createClassObject(TextArea, "test", 300);

How on earth do you create components and then add them to a movieclip?? (Inside a class, dynamically) I know how to do it by adding a component to the stage and giving it an instance name, but that isn't interesting.

ixlepixle
07-07-2004, 07:58 AM
Phew, I finally figured it out :)



public function addContent():Void{
textArea = TextArea(this.attachMovie("TextArea","textArea", 300, {visible:true, _width:200, _height:150 }));
textArea.move(10, 10);
textArea.text = "test";

}


silly, I sure as he** couldn't find this syntax in the Help files... :(

emergency_pants
07-07-2004, 09:05 AM
Yep... not much help file stuff about components... it's probably hidden somewhere in the depths of an article, just mentioned in passing.

I'm building an application in Flash which uses components extensively, tickboxes, text areas, connectors and the like... and I get stuck on something like this daily. It then takes me three or four hours to find an answer, hence losing half a day. Shocking. I've never had such a nightmare on a single project before.

Does anyone know any GOOD books on using flash components, which cover all these odd commands and settings that there's so little about in the help files?