-
duplicate a movieClip containing dynamically created field
is there a way to duplicate a movie clip with everything that it contains?
I created a MC dynamicallly and I created dynamically a text in it:
createEmptyMovieClip("clip1", 3);
clip1.createTextField("TF", 0, 0, 0, 10, 10);
clip1.TF.borderColor = 0xFFFFFF;
clip1.TF.border = 1;
duplicateMovieClip(clip1, "clip2", 4);
clip2._y = 10;
The textField doesn't exist in the clip2. why?
It does works when you just create shapes in it
createEmptyMovieClip("clip1", 0);
clip1.lineStyle(1, 0x4E0053, 100);
clip1.lineTo(10, 10);
duplicateMovieClip(clip1, "clip2", 1);
clip2._y = 10;
-
Beats me ... anyone know? The line is duped but the text not.
Code:
createEmptyMovieClip("clip1", 0);
clip1.lineStyle(1, 0x4E0053, 100);
clip1.lineTo(10, 10);
clip1.createTextField("TF", 2, 10, 10, 100, 100);
clip1.TF.borderColor = 0x000000;
clip1.TF.border = 1;
clip1.TF.text="hello";
duplicateMovieClip(clip1, "clip2", 5);
clip2._x = 300;
Mark
-
does it work for you?
It does duplicate clip1 with the line in it but in clip 2 there's still no text field
-
In need of one of the heavyweights ...
Mark
-
The duplicateMovieClip is redundant here. If you want to copy the MC, you need to use createEmptyMovieClip again - in a loop, if many are needed.
duplicateMovieClip copies what is on the stage from author time; that is, it ignores action script. (It's a quirk that it copied the line).
Can anyone confirm these findings?
My findings are based on: if you use createTextField to create a text field within an on-stage instance-given MC, and then dupe that MC, the MC is duped MINUS the text field. My conclusion (after other messing around): duplicateMovieClip ignores AS.
Mark
-
I figured once you added a TextField to the MC at runtime the MC now has a new property. How hard is it for flash to duplicate that property along with the MC itself?
-
If you want a textfied in your dupe, just code it into the dupe directly.
_root.clip2.createTextField("TF", 3, 10, 10, 100, 100);
Don't code the text field into the original MC and then try to dupe that. As we see ,it fails. Add the textfield where it is needed.
Mark
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|