Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Duplicate movieclip you dynamically made

Guest
Jan 30, 2013 Jan 30, 2013

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

TOPICS
ActionScript
430
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 31, 2013 Jan 31, 2013

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.

Translate
LEGEND ,
Jan 31, 2013 Jan 31, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 04, 2013 Feb 04, 2013
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines