-
how do i :swap "instance of" in code??
hey, i have been looking how to do this but i am stuck...
say i have a symbol composed of different symbols, how can i use actionscript to swap the "instance of" of one of the internal symbols to a different one?
thanks for any help !!
-
Very misleading title. "instanceof" like "is" is an operator which lets you test whether an instance is an instance of a particular class.
For your question, the answer depends on what you mean by "swap". Do you have another instance already that you want to put in place, or just something in the library?
If you already have it, you can simply remove the first item with removeChild, set the other one's transform to the same, and then add it with addChild.
If you don't already have it, you'll have to create it from the library before adding.
the following assumes that you want to swap parta out and partb in, and they are in a movieclip with instancename container.
Code:
var trans:Transform = parta.transform;
partb.transform = trans;
container.removeChild(parta);
container.addChild(partb);
-
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
|