<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- <!DOCTYPE Movie SYSTEM "dtd/RVML.dtd"> -->
<Movie version='6' width='550' height='400' rate='12' backgroundColor='white' compressed='Yes'
    xmlns="http://www.kineticfusion.org/RVML/2.0">
    <Title>
        Dynamic MovieClip Clipping
    </Title>
    <Desc>
        Uses an animated movie clip to mask an underlying polygon. The MovieClip is moved dynamically
        every frame using a MovieClip event handler. A line frame is associated with the clip to indicate
        its shape and position.
    </Desc>
    <Definitions>
        <!-- Polygon test shape -->
        <Shape id="Polygon" bounds="auto">
            <FillStyles>
                <ColorFill index="1"  color="orange" />
            </FillStyles>
            <LineStyles>
                <LineStyle index="1" width="1" color="red" />
            </LineStyles>
            <Edges>
                <SetStyle line="1" mainFill="1"/>
                <!-- A small hexagonal thing -->
                <Polygon points="100,0 150,50, 150,100 100,150 50,150 0, 100 0,50 50, 0" />
            </Edges>
        </Shape>
        <!--Grey Box -->
        <Shape id='greyBoxShape' bounds="auto">
            <LineStyles>
                <LineStyle index="1" width="0.05" color="red"/>
            </LineStyles>
            <FillStyles>
                <ColorFill index="1" color="lightGrey"/>
            </FillStyles>
            <Edges>
                <SetStyle line="1" mainFill="1"/>
                <Rect x="0" y="0" width="100" height="100" />
            </Edges>
        </Shape>
        <!-- Movie clip with box on first frame -->
        <MovieClip id="GreyBoxClip">
            <Timeline>
                <Frame>
                    <Place name="greyBoxShape" depth="1"/>
                </Frame>
            </Timeline>
        </MovieClip>


        <!-- Outline movieclip for movie clip above -->
        <Shape id='outlineBoxShape' bounds="auto">
            <LineStyles>
                <LineStyle index="1" width="0.05" color="red"/>
            </LineStyles>
            <Edges>
                <SetStyle line="1"/>
                <Rect x="0" y="0" width="100" height="100" />
            </Edges>
        </Shape>
        <!-- Movie clip with box on first frame -->
        <MovieClip id="outlineClip">
            <Timeline>
                <Frame>
                    <Place name="outlineBoxShape" depth="1"/>
                </Frame>
            </Timeline>
        </MovieClip>

    </Definitions>
    <Timeline>
        <Frame frameNo='1'>
            <Place name='outlineClip' instanceName="maskOutline" depth='4'/>
            <Place name="GreyBoxClip" depth="5" clipDepth="6">
                <MovieClipActions><![CDATA[
onClipEvent( setParameters )
{
// Initialise direction here
direction = 5;
}
onClipEvent( enterFrame )
{
_root.maskOutline._x += direction;
this._x = this._x +direction;
if ( this._x >350 - this._width || this._x < 0)
    direction = -direction;
}
                ]]></MovieClipActions>
            </Place>
            
            
            <Place name='Polygon' depth='6'>
            </Place>
        </Frame>
    </Timeline>
</Movie>