AS3 - Multiple instances
I have created 4 types of MovieClips objects.
How can I create (name) intances for every type of these objects to be shown on the scene? (every type can appear more than twice)
I have created 4 types of MovieClips objects.
How can I create (name) intances for every type of these objects to be shown on the scene? (every type can appear more than twice)
First you need to designate the object in the library as an item that can be loaded dynamically.
Right click on it in the library and select Linkage from the menu that appears. In the interface that appears, select Export for Actionscript. A Class name will automatically be assigned, which you can change as you like (lets just say you name it MyObject). This is the name you will use to call in the item from the library.
When you click OK to close that interface, it may come up with an indication saying it can't find the class so it will create one at complie time... click OK there too. You're done preparing the object in the library.
To add the item to the stage, treat it like any other new object instance:
var newObject:MyObject = new MyObject();
newObject.x = .... etc...
this.addChild(newObject);
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.