Groups | Blog | Home
all groups > flash actionscript > september 2004 >

flash actionscript : drawing box as long as text is


talltyler
9/26/2004 4:01:10 PM
Has anyone come across a good way to duplicate movie clips but change there
size in relationship to how much text is imported - like a message board some
comments are long other short. I know it is commplicated but if anything would
be great, I know people have done this kind of thing before. Thanks
kglad
9/26/2004 4:27:37 PM
just create an autoSize textfield in a movieclip. for example:

_root.createEmtpyMovieClip("tboxMC",1);
_root.tboxMC.createTextField("tbox",2,0,0,1,1);
with(_root.tboxMC.tbox){
autoSize="left";
}

now when you load your text and assign it to this textfield, tboxMC's (and
tbox's) _height property will adjust.
talltyler
9/26/2004 6:07:23 PM
This sounds great but doesn't autoSize make it expand width and higth, is there
a text box attrabute to confine the width?

also I am going to have to check for when the text is there, how should I
check if it is loaded because the one on top has to be figured out before the
box below, correct?

thanks kglad, your the best.
kglad
9/26/2004 6:40:47 PM
no, autoSize doesn't affect the _width property. you can set width either in
the createTextField() statement or later. i didn't do either in my code so
that wouldn't work. you should use either:

_root.createEmtpyMovieClip("tboxMC",1);
_root.tboxMC.createTextField("tbox",2,0,0,yourWidth,1); // where yourWidth is
defined on this timeline
with(_root.tboxMC.tbox){
autoSize="left";
}

or:

_root.createEmtpyMovieClip("tboxMC",1);
_root.tboxMC.createTextField("tbox",2,0,0,1,1);
with(_root.tboxMC.tbox){
_width=yourWidth; // again, define this parameter.
autoSize="left";
}
kglad
9/26/2004 6:43:37 PM
and you should use a data handler to figure out when data has been received.
for example:

_root.creatEmptyMovieClip("dataHolder",3);
dataHolder.loadVariables("yourText.txt");
dataHolder.onData=function(){
_root.createEmtpyMovieClip("tboxMC",1);
_root.tboxMC.createTextField("tbox",2,0,0,1,1);
with(_root.tboxMC.tbox){
text=this.yourTextVar; // where yourTextVar is defined in yourText.txt
_width=yourWidth; // again, define this parameter.
autoSize="left";
}
}
talltyler
9/26/2004 6:52:08 PM
kglad
9/26/2004 6:53:25 PM
AddThis Social Bookmark Button