# Code Movie Clips

**URL:** <https://forum.kirupa.com/t/code-movie-clips/117884>\
**Category:** Uncategorized\
**Created:** [July 31, 2004, 10:08am UTC](https://forum.kirupa.com/t/code-movie-clips/117884 "2004-07-31T10:08:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [July 31, 2004, 10:08am UTC](https://forum.kirupa.com/t/code-movie-clips/117884/1 "2004-07-31T10:08:39Z")

</div>

[font=Arial][font=Verdana]Hi, I know the title may be a little confusing, but I was wondering wether I can code a movie clip itself. What I mean is actually place all the objects inside a movie clip (lines, images, text areas, etc) trew code. I’m still new to flash, and so don’t know exacttly how it works. What I come out so far is the follows, but to say the truth nothing is happening:[/font]

[font=Courier New][color=slategray]// Creating the new Window[/color][/font]  
[font=Courier New][color=navy]createMovieClip[/color]([color=blue]“Window”[/color], 1);[/font]  
[font=Courier New]Window.[color=navy]createTextField[/color]([color=blue]“txtMessageArea”[/color], 1000, 20,20,100,20);[/font]  
[font=Courier New]Window.[color=navy]createEmptyMovieClip/color[/font]  
[font=Courier New][color=slategray]// Putting Objects in container[/color][/font]  
[font=Courier New][color=navy]with/color{[/font]  
[font=Courier New][color=navy] beginFill[/color]([color=blue]“000”[/color], 100);[/font]  
[font=Courier New][color=navy] moveTo/color;[/font]  
[font=Courier New][color=navy] lineTo/color;[/font]  
[font=Courier New][color=navy] endFill/color;[/font]  
[font=Courier New]}[/font]  
[font=Courier New]Window.[color=navy]\_x[/color] = 100;[/font]  
[/font][font=Courier New]Window.[color=navy]\_y[/color] = 100;[/font]  
[font=Courier New]Window.[color=navy]show();[/color][/font]

Does anybody know how to do it, or were I can find any information??

Thanks to all in advance!

---

<div class="post-metadata">

**Author:** ![Voetsjoeba](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@Voetsjoeba](https://forum.kirupa.com/u/Voetsjoeba)\
**Post date:** [July 31, 2004, 10:41am UTC](https://forum.kirupa.com/t/code-movie-clips/117884/2 "2004-07-31T10:41:51Z")

</div>

```auto

this.createEmptyMovieClip("Window", 1);
Window.createTextField("txtMessageArea", 1000, 20, 20, 100, 20);
Window.createEmptyMovieClip("container", 2);
// Putting Objects in container
with (Window.container) {
	lineStyle(0,0x000000,100)
	moveTo(0, 0);
	lineTo(25, 0);
}
Window._x = 100;
Window._y = 100;

```

1. It’s createEmptyMovieClip, not createMovieClip.
2. beginFill only works with a closed shape - since you haven’t set a lineStyle and your shape wasn’t closed anyway, beginFill doesn’t work.
3. show isn’t a method of MovieClip, it’s a method of Mouse.

---

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [July 31, 2004, 11:00am UTC](https://forum.kirupa.com/t/code-movie-clips/117884/3 "2004-07-31T11:00:25Z")

</div>

Thanks for the informatio, I’m trying it immediatlly 🙂

Thanks Again.  
Sim

---

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [August 3, 2004, 8:06pm UTC](https://forum.kirupa.com/t/code-movie-clips/117884/4 "2004-08-03T20:06:37Z")

</div>

Hi it’s me again!!

I continued on this thread because the problem is very similar. I want to create a filled shape and i placed the following code:

[color=slategray]— Global Varibles containing width (both of them are set to 200) —[/color]  
[font=Courier New][color=navy]var[/color] frameWidth:Number;[/font]  
[font=Courier New][color=navy]var[/color] frameHeight:Number;[/font]

[color=slategray]— The code that is giving the problem (object is not filled) —[/color]  
[font=Courier New]frame.[color=navy]createEmptyMovieClip[/color]([color=blue]“TopBar”[/color], 2);

[color=navy]with/color{[indent][color=navy]lineStyle/color;[color=navy]beginFill[/color](200, 100);  
[color=navy]moveTo[/color](0, 0);[color=navy]lineTo[/color]([color=navy]this[/color].frameWidth - 20,0);  
[color=navy]moveTo[/color](0, 0);[color=navy]lineTo[/color](0, 20);  
[color=navy]moveTo[/color](0, 20);[color=navy]lineTo[/color]([color=navy]this[/color].frameWidth - 20, 20);  
[color=navy]moveTo[/color]([color=navy]this[/color].frameWidth - 20, 0);[color=navy]lineTo[/color]([color=navy]this[/color].frameWidth - 20, 20);  
[color=navy]endFill/color;  
[/indent] [/font][font=Courier New]}[/font]

The coding seems to work since the square is created, however it is not filled with the desired colour. Does any body know why?

thanks in advance!

---

<div class="post-metadata">

**Author:** ![Voetsjoeba](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@Voetsjoeba](https://forum.kirupa.com/u/Voetsjoeba)\
**Post date:** [August 3, 2004, 8:35pm UTC](https://forum.kirupa.com/t/code-movie-clips/117884/5 "2004-08-03T20:35:42Z")

</div>

Try drawing the square without the moveTo’s. You can continue drawing from where the last lineTo ended.

---

<div class="post-metadata">

**Author:** ![Sim085](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@Sim085](https://forum.kirupa.com/u/Sim085)\
**Post date:** [August 3, 2004, 10:22pm UTC](https://forum.kirupa.com/t/code-movie-clips/117884/6 "2004-08-03T22:22:23Z")

</div>

Yes that’s it 🙂  
I removed the the moveTo, and it worked

Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![Voetsjoeba](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@Voetsjoeba](https://forum.kirupa.com/u/Voetsjoeba)\
**Post date:** [August 4, 2004, 8:17am UTC](https://forum.kirupa.com/t/code-movie-clips/117884/7 "2004-08-04T08:17:48Z")

</div>

You’re welcome 🙂
