-
Registered User
Need a little help with being adventurous [converting lines to fills in actionscript]
Hey everyone,
I want to be a little different; well actually, I need to be in order for me to achieve what I want. In the Flash help files, you can 'draw' using ActionScript with commands like lineStyle(), moveTo() and lineTo(), but in all the examples provided, you always draw to a new empty MovieClip. I want to draw straight to the stage using actionscript as you do when you use the draw tools. Is this possible?
Why do I want to do this? Because I want to create a mask layer and when you place a MovieClip on the mask layer, it does not seem to work. If there is a better way of doing what I want, I would like to hear about it.
Thanks for your time, and I would appreciate all replies. Does anyone have any experience with this sort of thing?
Greenham.
Last edited by greenham; 12-22-2005 at 10:09 PM.
-
Registered User
Hello again,
I seem to have overcome my original problem. However, it turns out masks do not work if you only use lines. So, I am now working on finding a command that will convert the lines to fill. Does anyone have any ideas?
-
Uses MX 2004 Pro
Originally Posted by greenham
Hello again,
I seem to have overcome my original problem. However, it turns out masks do not work if you only use lines. So, I am now working on finding a command that will convert the lines to fill. Does anyone have any ideas?
I don't know about a command that converts lines to fills, but masking a movieclip with another movieclip should work.
Code:
this.createEmptyMovieClip("canvas_mc", this.getNextHighestDepth());
this.createEmptyMovieClip("mask_mc", this.getNextHighestDepth());
//
mask_mc.beginFill(0x00ff00);
mask_mc.moveTo(200, 200);
mask_mc.curveTo(300, 200, 300, 100);
mask_mc.curveTo(300, 0, 200, 0);
mask_mc.curveTo(100, 0, 100, 100);
mask_mc.curveTo(100, 200, 200, 200);
mask_mc.endFill();
//set the masking
canvas_mc.setMask("mask_mc");
//
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
this.isDrawing = true;
canvas_mc.lineStyle(2, 0xFF0000, 100);
canvas_mc.moveTo(_xmouse, _ymouse);
};
mouseListener.onMouseMove = function() {
if (this.isDrawing) {
canvas_mc.lineTo(_xmouse, _ymouse);
}
updateAfterEvent();
};
mouseListener.onMouseUp = function() {
this.isDrawing = false;
};
Mouse.addListener(mouseListener);
-
Registered User
Wow, Quixx, this is some impressive code. I don't understand some of it, but I will quickly go read up on those things so I don't have to trouble you again. I don't think this will really do what I want, but when I understand it completely I will know for sure. Thank you so much for taking the time to reply to my thread. Writing out the code alone would have taken a fair amount of time. So, thanks.
Edit:Ok now I get it. This would work in any other instance, but I am still using lines which will not serve as a mask, alone. If you do not understand what I mean you might like to create a mask layer and place only lines on it. Test the file and you will find the guide layer is ineffective, even if the lines are a MovieClip. Or perhaps I am doing somethign incorrectly. I hope I am making sense. If not, I would be more than happy to explain it in more detail.
Thanks again to all those who have helped on the thread so far. I would appreciate any other suggestions you may have.
Last edited by greenham; 12-23-2005 at 12:43 AM.
-
Uses MX 2004 Pro
Oh.... I get what you mean now. I thought you were trying to mask the lines, not use the lines as a mask. Hmm... Not really sure what you could do then. If I come across anything, I'll let you know.
-
Registered User
Thanks man,
I appologise for my poor description above.
I really want to create a mask dynamically (to insure for small file size) that changes each frame. I want to 'write' some text with pen movieclip with the writing being on a separate (masked) layer so the text reveals itself as the pen movieclip moves over it. Perhaps you know of a better way of doing things? I would be really grateful if someone came up with a solution to my problems.
Last edited by greenham; 12-23-2005 at 01:21 AM.
-
Can't Re-Member
maybe some of senocular's drawing classes may be of help to you... http://senocular.com/flash/
although, that stil doesn't help with masking lines.. but you could create movieclips dynamically that are 700 px x 1 px which would act as a 700 px long line that could be used as a mask.. same for vertical lines....
-
Registered User
Thanks madzigian! This looks like a great link. I will take a look around and get back to you
-
Uses MX 2004 Pro
Last edited by Quixx; 12-29-2005 at 02:31 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|