Copy link to clipboard
Copied
Gidday
I have a class that has this above the constructor...
public var mc:MovieClip = new MovieClip();
... and a later fucntion gives it some graphics etc
In another function later on, I want to make duplicates of 'mc' with different names, but am getting the error:
1046: Type was not found or was not a compile-time constant: mc.
var copies:int = 10;
var y:int = 0;
for(var i:int = 0; i < copies; i++)
{
var clone:mc = new mc(); // <<<< error occurs here
clone.name = 'clip' + i
clone.x = 0;
clone.y = y+10;
addChild(clone);
}
Why does var clone not recognise mc?
I guess my question is - how do you make copies of a dynamically created movieclip (as opposed to one linked from the IDE library in Flash Pro)?
Cheers guys
To create another jusat like it you do exactly what yiou did in the first place... create a MoveClip instance and fill it with the same content that you filled the first one with.
While you are trying to treat "mc" as a class, "mc" is not a class, it is a MovieClip instance.
Copy link to clipboard
Copied
To create another jusat like it you do exactly what yiou did in the first place... create a MoveClip instance and fill it with the same content that you filled the first one with.
While you are trying to treat "mc" as a class, "mc" is not a class, it is a MovieClip instance.
Copy link to clipboard
Copied
Thank you Ned. You poor buggers - I go for months without questions sometimes, and then drown you guys in them - you're a bunch of champions.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now