# Creating Empty MC and Grids

**URL:** <https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694>\
**Category:** flash\
**Created:** [September 19, 2002, 4:39pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694 "2002-09-19T16:39:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jubba](https://avatars.discourse-cdn.com/v4/letter/j/90ced4/32.png) [@Jubba](https://forum.kirupa.com/u/Jubba)\
**Post date:** [September 19, 2002, 4:39pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/1 "2002-09-19T16:39:30Z")

</div>

```auto

_root.createEmptyMovieClip('dot', 1)
dot.lineStyle(.5,000000,100)
dot.beginFill(778833,100)
dot.lineTo(15,0)
dot.lineTo(15,15)
dot.lineTo(0,15)
dot.lineTo(0,0)
dot.endFill()
gridX=30;
gridY=30;
nNum=0;
for (var ii=0;ii < 10;ii++) {
  for (var jj=0;jj < 10;jj++) {
   dot.duplicateMovieClip("dot"+nNum,nNum);
    mc=_root["dot"+nNum];
    mc._x=gridX*ii;
    mc._y=gridY*jj;
    nNum++;
  }
}

```

This just creates a movieclip that is a square, but when I try to duplicate it, it doesn’t work. The Original MC is on the stage, but the grid doesn’t show up, also, the statement

dot.\_visible = 0

Doesn’t work, but

dot.\_alpha = 0

does work…I’m confuzzled…any ideas?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:41pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/2 "2002-09-19T16:41:28Z")

</div>

Try dot.\_visible = 0.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:44pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/3 "2002-09-19T16:44:21Z")

</div>

EDIT: Sorry - I just noticed something - so I deleted what I wrote earlier. I haven’t had a chance to look at the code properly yet, holding my little boy 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:46pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/4 "2002-09-19T16:46:39Z")

</div>

Yeah, I know dot.\_visible = 0

That didn’t work. It was just a typo in my post…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:49pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/5 "2002-09-19T16:49:07Z")

</div>

I had the same problem! It works if you draw the object and give it the instance name. But if you dynamically create it and give it an instance name, it will not work.

Ilyas did it dynamically, but he removed the source code from his entry so I can’t see how he did it.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:52pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/6 "2002-09-19T16:52:31Z")

</div>

Why don’t you create the first tile then use attachMovie - this is what I did here:

Unless there’s a reason you specifically want to use an empty mc and duplicateMovieClip

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:54pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/7 "2002-09-19T16:54:33Z")

</div>

It is fun trying to come up with something you can make purely out of AS without anything in the library.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:55pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/8 "2002-09-19T16:55:55Z")

</div>

Ah, ok.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 4:59pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/9 "2002-09-19T16:59:38Z")

</div>

Is there any benefit for it? I would understand if it saved processing power, etc. but if it’s not usable - I don’t use it.

But if you want to explore the dynamic possibilities of Flash - then that’s different…

![](http://flex.funkyolive.com/im/crash.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 5:07pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/10 "2002-09-19T17:07:01Z")

</div>

I’m just messing around really. I was just trying to teach myself lineTo and beginFill and all that fun stuff…just wondering why it wasn’t working…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 5:09pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/11 "2002-09-19T17:09:09Z")

</div>

Well I am supposing in this case it is for the AS contest…haha.

I do believe it saves on loading time/file size because it does not require the loading of the graphics. And being that the AS contest requires a small file size this really would help.

Also, I just want to figure it out because it is being such a pain and I dont know why.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 5:24pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/12 "2002-09-19T17:24:36Z")

</div>

Ok. I was comparing to to attaching tiles in my example. Compared the way I did it, to this dynamic way - it would hardly save anything since a square of 10 x 10 pixels, wouldn’t but that processor intensive, especially since he whole swf (3) tiles is only around 300 bytes (not even 1 KB)!

But in **other** ways it might save some of your pc’s life span. But all depends how complex a graphic you can create dynamically with lineStyle, etc.

Anyway - you guys are actionscript junkies so I’ll leave you to it!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 5:40pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/13 "2002-09-19T17:40:15Z")

</div>

\_root.createEmptyMovieClip(‘dot’, 1)  
dot.lineStyle(.5,000000,100)  
dot.beginFill(778833,100)  
dot.lineTo(15,0)  
dot.lineTo(15,15)  
dot.lineTo(0,15)  
dot.lineTo(0,0)  
dot.endFill()  
gridX=30;  
gridY=30;

for (var ii=0;ii \< 10;ii++) {  
for (var jj=0;jj \< 10;jj++) {  
dot.duplicateMovieClip(“dot”+nNum,nNum);  
mc=\_root[“dot”+nNum];  
mc.\_x=gridX_ii;  
mc.\_y=gridY_jj;  
nNum++;  
}  
}

Just took out the nNum = 0;

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:08pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/14 "2002-09-19T18:08:00Z")

</div>

lol, that makes no sense whatsoever!!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:10pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/15 "2002-09-19T18:10:21Z")

</div>

My post or the fact the I just took out the nNum = 0?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:19pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/16 "2002-09-19T18:19:01Z")

</div>

Aha! Common problem when you use the drawing API…

Hint: Someone recently asked me why I created my empty clips at negative depths… Well that’s why.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:21pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/17 "2002-09-19T18:21:17Z")

</div>

I think because when you say nNum++ you mean, 1, ie. 1 more tha 0 - which is root, but if you specifically say nNum = 0, then load the first dup into 0 - it will load over the first. Just a guess…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:22pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/18 "2002-09-19T18:22:31Z")

</div>

Hey? You weren’t here when I was typing my post. How’d you sneek in?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:23pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/19 "2002-09-19T18:23:17Z")

</div>

![](http://flex.funkyolive.com/im/crash.gif)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:27pm UTC](https://forum.kirupa.com/t/creating-empty-mc-and-grids/5694/20 "2002-09-19T18:27:50Z")

</div>

😛

But that nNum thing is strange…
