# Flash 8 Drawing API

**URL:** <https://forum.kirupa.com/t/flash-8-drawing-api/214131>\
**Category:** flash\
**Created:** [January 25, 2007, 8:01pm UTC](https://forum.kirupa.com/t/flash-8-drawing-api/214131 "2007-01-25T20:01:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martha\_Stewart](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Martha\_Stewart](https://forum.kirupa.com/u/Martha_Stewart)\
**Post date:** [January 25, 2007, 8:01pm UTC](https://forum.kirupa.com/t/flash-8-drawing-api/214131/1 "2007-01-25T20:01:58Z")

</div>

Hey guys/ladies,

quick question, how do you on the main time line, draw a rectangle useing the drawing api at runtime, into a second level movieclip?

I would have just placed the code into the first frame of the windowBg\_mc but due to a filter code i have implemented it appears i need to draw it on the main time line

Another words…

+Main Time Line (code for the drawing of the rectangle is sitting)  
±- Content\_mc  
±-±-windowBg\_mc  
±-±-±-RightFade\_mc  
±-±-±-Container\_mc

This code works if placed on windowBg\_mc timeline:

```auto

    createfader = function(){
    var DarkRight:MovieClip = createEmptyMovieClip("DarkRight_mc", 1);
    DarkRight.beginFill(0x000000, 40);
    DarkRight.lineStyle(1, 0x000000, 100);
    DarkRight.moveTo(190, 0);
    DarkRight.lineTo(772, 0);
    DarkRight.lineTo(772, 1000);
    DarkRight.lineTo(190, 1000);
    DarkRight.endFill();
        trace(this.getInstanceAtDepth(1));

};
createfader();

createcontainer = function(){
    var Contain:MovieClip = createEmptyMovieClip("Container_mc", 2);
    Contain.beginFill(0x000000, 100);
    Contain.moveTo(202, 40);
    Contain.lineTo(750, 40);
    Contain.lineTo(750, 400);
    Contain.lineTo(202, 400);
    Contain.endFill();
    trace(this.getInstanceAtDepth(2));};
createcontainer();

```

Revised code to work on Main Time Line (not working obviously):

```auto

    createfader = function(){
    var DarkRight:MovieClip = createEmptyMovieClip._root.Content_mc.windowBg_mc("DarkRight_mc", 1);
    DarkRight.beginFill(0x000000, 40);
    DarkRight.lineStyle(1, 0x000000, 100);
    DarkRight.moveTo(190, 0);
    DarkRight.lineTo(772, 0);
    DarkRight.lineTo(772, 1000);
    DarkRight.lineTo(190, 1000);
    DarkRight.endFill();
        trace(this.getInstanceAtDepth(1));

};
createfader();

createcontainer = function(){
    var Contain:MovieClip = createEmptyMovieClip._root.Content_mc.windowBg_mc("Container_mc", 2);
    Contain.beginFill(0x000000, 100);
    Contain.moveTo(202, 40);
    Contain.lineTo(750, 40);
    Contain.lineTo(750, 400);
    Contain.lineTo(202, 400);
    Contain.endFill();
    trace(this.getInstanceAtDepth(2));};
createcontainer();

```

Thanks to all for looking,

Martha
