Code Movie Clips

[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!


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.

Thanks for the informatio, I’m trying it immediatlly :slight_smile:

Thanks Again.
Sim

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!

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

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

Thanks a lot :slight_smile:

You’re welcome :slight_smile: