beginFill () endFill ()

In my tutorial about drawing in MX here : www.kirupa.com/developer/…gboard.asp , I tried to make forms with a fill, but couldn’t. What I did was the following (look at the code) :

 _root.onMouseDown = function(){
&nbsp &nbsp &nbsp &nbsp line.beginFill (0xFF0000) ;
//      etc...

and then :
_root.onMouseUp = function(){
&nbsp &nbsp &nbsp &nbsp line.endFill () ;
//      etc...

It doesn’t work (actually it does some interesting things if you press long enough…).

Any ideas ??

pom 0]

// paste this post into a one frame empty fla:
_root.createEmptyMovieClip(“line”, 1);
_root.aHolder = [];
this.onMouseDown = function() {
line.Xstart = _xmouse;
line.Ystart = _ymouse;
line.lineStyle(2, 0x000000, 100);
line.moveTo(_xmouse, _ymouse);
this.onMouseMove = function() {
_root.aPos = [_xmouse, _ymouse];
_root.aHolder.unshift(_root.aPos);
line.lineTo(_root.aPos[0] , _root.aPos[1]);
updateAfterEvent();
};
};
_root.onMouseUp = function() {
line.lineTo(line.Xstart, line.Ystart);
fDrawFilled(_root.aHolder);
this.onMouseMove = null;
_root.aHolder = [];
};
function fDrawFilled(aArray) {
aTemp = [];
aTemp = aTemp.concat(aArray);
line.clear();
line.lineStyle(2, 0x000000, 100);
line.beginFill(0x00ff00, 100);
line.moveTo(aTemp[0] [0] , aTemp[0] [1]);
for (ii=1; ii<aTemp.length; ii++) {
line.lineTo(aTemp[ii][0] , aTemp[ii][1]);
}
line.endFill();
}

// clears the screen when you release the mouse, but that’s not necessary.
// :slight_smile:
// jeremy

Thanks Sinf, I’ll have to check that.

By the way, I edited your post because there were 0] all around your arrays. Darn Ezboard.

pom 0]

thanks, i must have forgotten to turn all those fun things off.
:slight_smile:
jeremy