-|-Masked-|-drawing-|-line-|-
Hi.. This is a draw-code, that makes so u can draw lines..
I want to draw in an area, and outside the area I don't can draw.
I need help to do this.
ActionScript Code:
var thickness = 1; //Thickness of line
var lcolour = "0x000000"; //Colour of line
var scolour = "0x999999"; //Colour of fill
var linjealpha = 100; //Transparency of the linje
var mDown = false;
var startx, starty, endx, endy;
//Gets the starting point when mouse is clicked
this.paper1.onMouseDown = function() {
var id:Number = _root.getNextHighestDepth()
linje = _root.createEmptyMovieClip("linje_" + id, id)
mDown = true;
startx = _xmouse;
starty = _ymouse;
};
//When mouse is released stop drawing linje
this.paper1.onMouseUp = function() {
mDown = false;
};
//Do all the commands
this.onEnterFrame = function() {
//Get the mouse coordinates
endx = _xmouse;
endy = _ymouse;
//Destroy current linje to prepare for new one
//Draw the linje if mouse is down
if (mDown) {
linje.clear();
linje.lineStyle(thickness, lcolour, linjealpha);
linje.moveTo(startx, starty);
linje.lineTo(endx, endy);
}
};
stop();
Ultrashock Forums > Flash > ActionScript
Posted on: 2005-01-29
View Complete Forum Thread with Replies
Sponsored Links:
[F8] Drawing BitmapData With Masked Video
Hello. I am relatively new to flash and I only have a limited understanding of the language. Anyway, this is what I am trying to do:
I have a video which is masked. I want to take a snapshot of the mask. If this is not possible, the next best would be to unmask the video and just take a snapshot of the region the mask would be. Is there a way for me to do the latter? I have tried using the BitmapData draw() method on my mask, but it only returns a blank image of proper size, which I attribute to the fact that it is masked.
I am so confused!
View Replies !
View Related
Masked Line
Hi again.
Can I do a mask for the lines? Or a area where I can draw, and outside the area I can not draw.. Understand what I mean?
<{([FLASH: MX 2004])}>
Code:
var thickness = 1; //Thickness of line
var lcolour = "0x000000"; //Colour of line
var scolour = "0x999999"; //Colour of fill
var linjealpha = 100; //Transparency of the linje
var mDown = false;
var startx, starty, endx, endy;
//Gets the starting point when mouse is clicked
this.onMouseDown = function() {
var id:Number = _root.getNextHighestDepth()
linje = _root.createEmptyMovieClip("linje_" + id, id)
mDown = true;
startx = _xmouse;
starty = _ymouse;
};
//When mouse is released stop drawing linje
this.onMouseUp = function() {
mDown = false;
};
//Do all the commands
this.onEnterFrame = function() {
//Get the mouse coordinates
endx = _xmouse;
endy = _ymouse;
//Destroy current linje to prepare for new one
//Draw the linje if mouse is down
if (mDown) {
linje.clear();
//linje.beginFill(scolour, linjealpha);
linje.lineStyle(thickness, lcolour, linjealpha);
linje.moveTo(startx, starty);
//linje.lineTo(endx, starty);
linje.lineTo(endx, endy);
//linje.lineTo(startx, endy);
//linje.lineTo(startx, starty);
//linje.endFill();
}
};
stop();
View Replies !
View Related
Masked Line
Hi again.
Can I do a mask for the lines? Or a area where I can draw, and outside the area I can not draw.. Understand what I mean?
<{([FLASH: MX 2004])}>
Code:
var thickness = 1; //Thickness of line
var lcolour = "0x000000"; //Colour of line
var scolour = "0x999999"; //Colour of fill
var linjealpha = 100; //Transparency of the linje
var mDown = false;
var startx, starty, endx, endy;
//Gets the starting point when mouse is clicked
this.onMouseDown = function() {
var id:Number = _root.getNextHighestDepth()
linje = _root.createEmptyMovieClip("linje_" + id, id)
mDown = true;
startx = _xmouse;
starty = _ymouse;
};
//When mouse is released stop drawing linje
this.onMouseUp = function() {
mDown = false;
};
//Do all the commands
this.onEnterFrame = function() {
//Get the mouse coordinates
endx = _xmouse;
endy = _ymouse;
//Destroy current linje to prepare for new one
//Draw the linje if mouse is down
if (mDown) {
linje.clear();
//linje.beginFill(scolour, linjealpha);
linje.lineStyle(thickness, lcolour, linjealpha);
linje.moveTo(startx, starty);
//linje.lineTo(endx, starty);
linje.lineTo(endx, endy);
//linje.lineTo(startx, endy);
//linje.lineTo(startx, starty);
//linje.endFill();
}
};
stop();
View Replies !
View Related
Flash Drawing Board With Erase Function, Erase Line By Line
Hello!
Im building a pretty simple drawing board in flash, i got this code from this forum and it works fine (there is more to it but this is the drawing part)
Code:
var clip:Shape = new Shape();
bana.addEventListener(MouseEvent.MOUSE_DOWN,_handleMouseEvent);
bana.addEventListener(MouseEvent.MOUSE_UP,_handleMouseEvent);
function _handleMouseEvent(e:MouseEvent):void{
switch(String(e.type)){
case "mouseDown":
bana.addEventListener(MouseEvent.MOUSE_MOVE, _handleMouseEvent);
bana.addChild(clip);
clip.graphics.lineStyle(1.5,colorPicker.selectedColor);
clip.graphics.moveTo(mouseX,mouseY);
break;
case "mouseUp":
bana.removeEventListener(MouseEvent.MOUSE_MOVE, _handleMouseEvent);
break;
case "mouseMove":
clip.graphics.lineTo(mouseX,mouseY);
}
}
This works fine. But i want to be able to erase the drawings, step by step this is ths tricky part, ive looked everywhere(ok not everywhere) but in a whole lot of places but the only thing i found is how i could delete everything with removeChild and that in not what i want.
Maybe i need to change the function abowe? Please help me to get in the right direction. What should i read about /look at?
Do you have som sample code, no one is happier than me.
Regards
Fredrik
(sorry for my bad english, please ask if you dont understand)
View Replies !
View Related
[MX04] "Drawing" Line Effect Using Drawing API
So i've got a basic drawing using the drawing API ala:
myLine = this.createEmptyMovieClip("newLine", 1);
myLine.lineStyle(3, 0x000000, 100);
myLine.moveTo(0,0);
myLine.lineTo(100,0);
myLine.lineTo(100,100);...etc
Now is there a way to have flash animate the drawing of the lines like a map from an Indiana Jones movie?
Thanks!
View Replies !
View Related
Drawing A Line?
How can I draw a line from point a to b. For example, I want a way to dynamically draw lines....
Ie.
x=1;
y=7;
drawLine(x,y);
Is there a function that does this kind of thing for me? I want it so that the line's x and y can change... and when they change...so does the line.
Tahnx for any help you can give.
-Ryan
View Replies !
View Related
Drawing A Line?
This seems obvious, but i'm hung up on it.
I have two objects and would like a line connecting them. I have been tryign to do this for a while, but dont know how i would go about doing this.
thx
Justin.
View Replies !
View Related
Line Drawing Itself
How do you make a line apear to be drawn infront of the users eyes? What i want is a line to 'draw' a logo on the intro for a site. Ive contemplated using complex masks but there must be an easier way!
-Adam-
View Replies !
View Related
Line Drawing
I don't know ho to explain this. Can I do a line drawing that would start with a blank screen and then a line would draw a simple black and white picture that would be used as the background. I guess it would be like a single dot that moves along and leaves a line in it's trail. Kind of like a snail leaves its trail.
Is this making sense?
View Replies !
View Related
Drawing A Line
Hi there,
I use MX 2004. Learning actionscript I drew a simple line from one point to another:
createEmptyMovieClip("line", 1);
with (line){
lineStyle(2,0x0000FF, 100);
moveTo(100, 100);
lineTo(200, 200);
}
Could please someone tell me how can I make this line slowly draws from one point to another point and how to set the time control over it? Thank you very much in advance!
View Replies !
View Related
Drawing A Line
Hi everyone
I need a little help!
I'd like to draw a random "ink" line using actionscript and I don't know how. The line must have a circle in one of its points, must be in constant random movement and must be a button.... any ideas??? please, help me! Thanks a lot!
View Replies !
View Related
Drawing A Line Please Help Me
Hi everyone
I need a little help!
I'd like to draw a random "ink" line using actionscript and I don't know how. The line must have a circle in one of its points, must be in constant random movement and must be a button.... any ideas??? please, help me! Thanks a lot!
View Replies !
View Related
Line Drawing Itself
Hello,
I'm trying to create an animation of a line drawing itself as a cursive letter. I've tried masking and motion paths but neither have worked so far. Any other ideas?
Thanks!
View Replies !
View Related
Drawing A Line From A To B
I am doing an application where You should drawing lines between number starting with 1 to 2, 2 to 3 and so on. Like in many childrencolurbooks.
I havenīt used the Movie.lineTo-code before so I donīt know how to attach it in this. My idea is when You click on number 2 a line would be drawn from 1 to 2. and so on.
This is how far I got with the code. And I guess itīs totally wrong since it doesnīt work.
-----
_root.star1.onPress=function(){
_root.star.createEmptyMovieClip("star1a",1);
_root.star.star1a.lineStyle(3,0xFF0000);
_root.star.star1a.lineTo(50,100);
}
-------
View Replies !
View Related
Line Drawing..
RIght guys, lol. I want to do a drawin' in flash, but I want to make it so, it shows the drawing bein' done ..
So, say I draw a frog, all in one line. I want to be able to create a little motion clip.. Where the movie shows the frog bein' drawn. Is this possible? If so, some tips would be useful!
Many thanks,
Paul
View Replies !
View Related
Line Drawing With AS2
I am trying to create a "virtual piece of equipment" where users can thread material throught the machine. I have got this far with the code...
var firstDraw:Boolean = flase;
this.lineStyle(5,0x990000,100);
this.onMouseDown = function():Void {
if (firstDraw) {
this.lineTo(_xmouse,_ymouse);
} else {
this.moveTo(_xmouse,_ymouse);
firstDraw = !firstDraw;
}
};
What do I need to do or change with this so that I can stop the line function with a keystoke and return to normal mouse use while still having the line be visible?
View Replies !
View Related
Drawing A Line
Hello everyone,
Im pretty new to action script, but what Im looking for is to draw a line as if you were drawing it with a pencil out about 25 frames. If anyone could help me with this I would really appreciate it.
thanks
View Replies !
View Related
Line Drawing
How do you draw a line on the stage when the mouse is pressed and when the mouse is released it ends the line? Also, is it possable to determin the speed of the mouse when the line is being drawn, then trace it in the output pannel? Thanks in Advance!
-Nick D.
View Replies !
View Related
Drawing A Line
I am having problems drawing a line (straight/curved) inside a movie. Ive tried shape tweening but have not been successful.
the effect i want to make is that a line starts from a point (in the movies begining) and starts to make a web. Shape tweening was giving strange results - more of transformations.
View Replies !
View Related
Line Drawing
hai,
i need your help
at present i am developing some simple componets for game
on that i have one problem
ie. there is 2 parallel row of images
user have to draw a line(stright line only) from one picture to other picture(like connecting two picture which are all in parallel)
user can possible to delete a particular line which is conneted earlier (some thing like undo, reddo)
so i need to store the each and every action of drawing
shall i use array to store those values
i want urgent reply
so please help me
thanks for your time
View Replies !
View Related
Line Drawing
With reference to attacahed file sample.zip I require the following animation with Script.
I require the following Inputs about how to achieve the following:
The animation dotted line(Parabolic) from point to blink dot as shown in my attachment sample.zip
I have achieved the animation manually .I require the animation with Script.
Help would be very much appreciated ...Very Urgent...
View Replies !
View Related
Drawing A Line
I am having problems drawing a line (straight/curved) inside a movie. Ive tried shape tweening but have not been successful.
the effect i want to make is that a line starts from a point (in the movies begining) and starts to make a web. Shape tweening was giving strange results - more of transformations.
View Replies !
View Related
Line Drawing
hai,
i need your help
at present i am developing some simple componets for game
on that i have one problem
ie. there is 2 parallel row of images
user have to draw a line(stright line only) from one picture to other picture(like connecting two picture which are all in parallel)
user can possible to delete a particular line which is conneted earlier (some thing like undo, reddo)
so i need to store the each and every action of drawing
shall i use array to store those values
i want urgent reply
so please help me
thanks for your time
View Replies !
View Related
Line Drawing
With reference to attacahed file sample.zip I require the following animation with Script.
I require the following Inputs about how to achieve the following:
The animation dotted line(Parabolic) from point to blink dot as shown in my attachment sample.zip
I have achieved the animation manually .I require the animation with Script.
Help would be very much appreciated ...Very Urgent...
View Replies !
View Related
Drawing Like A Box Or Line Or Whatever
i have a question on how to draw something on flash...
for example, some sites have it where it seems like its actually drawing right then... if you're still confused umm....e.g. it has a graphic of a pen, and it is writing letters on the webpage.
all i can do is to show the entire letter at a time...
this is very hard to say with words so follow this link
www.highctr.com ( i think this site is very well made ) then click on enter, then click on profile...on the left side, it shows a flame thing writing something...that is what i am talking about
i am wondering how you can make something like that without the sparks, just how to make something like that writing.
thank you
View Replies !
View Related
Drawing A Simple Line.....
..... or is it?
I'm attempting to draw a simple vector line between 2 points on the stage. Is this possible?
At present we have a line movie that we duplicate, resize and rotate but this isn't really working for us. In director this is easy using primitive shape/line functions but I'm not sure if Flash has the equivolent actionscript.
If anybody has any ideas I would be most grateful.
Danke
Michael
View Replies !
View Related
Drawing A Line---BoneHead---
I can not figure out how to square edges up when using the line tool in Flash 5. Although I am a newbie it seems their would be a line/stroke cap selection panel as in adobe illustrator. My problem is simply EVERY line I make in flash 5 has rounded ends. Am I a bonehead or just S.O.L.?
Would appriciate help, will except opinions.
web
View Replies !
View Related
Help: Drawing A Line Between Two Points.
I need some help, please.
I have to do a flash-based application that collects data via forms. After the data is collected I calculate the results using a script.
Now for the tricky part: The result has to be displayed in a multidimensional coordinate system. I got values for diferent points that have to be connected by lines.
How do I draw lines between the points?
View Replies !
View Related
Drawing (for Example) A Line By A Function
hi to all!
i'm a beginner in using action scripts for flash but i was convinced that it should be possible to draw for example a simple line by hand over x- and y-cooridiante of two points to a function. same with drawing a rectangle or similair objects.
for the moment i have solved it like this:
1. defining a little point as a movieclip
2. call a function with coordinates x1,y1,x2,y2
3. the function calculates numerous points from (x1/y1) to (x2/y2), duplicates the movieclip and then set the movieclip-properties for _x and _y to the right position
in my opinion that's very complicated and to slowely in execution.
Does anybody know a more simple way.
View Replies !
View Related
Drawing A Line Between 2 Points And More
I am developing a website where I want to link buttons
and sub buttons and sub sub buttons....etc etc
the problem is all the tutorial only teach you how to link two objects but not more than that...
have a look here for a better understanding
http://www.go-academy.com/temp/test.html
I hope to link button_01 with button_02 and button_03;
and also link button_01 with button_02 with button_03
I would greatly appretiate it if someone could help me out
or point me to a helpful source.
View Replies !
View Related
Interactive Line Drawing
I am looking for a fla to download or script or tutorial how to do interactive line drawing. For example you create a movie where the user can use something like a pen tool and make a drawing and fill in colors.
Any ideas or does anybody know of something like this?
View Replies !
View Related
Help Drawing A Simple Line
Hi all... I need some help drawing a line with actionscript.
I have points A,B and C,D -- and I need to draw a line between them. Is this as simple as I think?
I'm using flash 5, but if it's much easier in MX then I'll switch.
Thanks!
andy
View Replies !
View Related
MX - Dynamic Line Drawing
Hello all...
I have a script that let the user plot points and then a line is drawn between each consecutive point. Unfortunatly I can get dynamic movie clip names working with the drawing methods...
Like this
//set up variables
pointCounter = 0;
xArray = new Array();
yArray = new Array();
function addpoint () {
//get mouse points
mouseX = _xmouse;
mouseY = _ymouse;
//debug
trace("*************************");
trace("mouse x pos: " add mouseX);
trace("mouse y pos: " add mouseY);
trace("counter:" add pointCounter);
//add a new point
duplicateMovieClip(point, "point" add pointCounter, pointCounter);
setProperty("point" add pointCounter, _x, mouseX);
SetProperty("point" add pointCounter, _y, mouseY);
//place point co-ordinates into the array
xArray[pointCounter] = mouseX
yArray[pointCounter] = mouseY
//do this for all points except the first
if (pointCounter != 0) {
this.createEmptyMovieClip("mc" add pointCounter, 1 + pointCounter);
setProperty("mc" add pointCounter, lineStyle, (1, 0x000000));
"mc" add pointCounter.lineStyle(1, 0x000000);
// draw the line based on handle locations
"mc" add pointCounter.moveTo(xArray[pointCounter - 1], yArray[pointCounter - 1]);
"mc" add pointCounter.lineTo(xArray[pointCounter], yArray[pointCounter]);
}
//increment point counter
pointCounter++;
}
This script is called from an onMouseDown action of a big button.
Anyone got any idea how to use dynamically created movieclip names with dot notaion, cos my method just doesn't work...
Thanks.
View Replies !
View Related
Line Drawing With Actionscript
hi there
i saw that i can draw lines with actionscripts lineto
i want to make an animated gui that is drawn out of only one point
i suggest i need a kind of timer/delay function to draw little steps.
but how can i built up round edges or circles
does someone have any suggestions ?
by the way, is there any possibility ,to set the hotspot of a movieclip with actionscript after the object was drawn. , e.g: normally when i rotate, everything is rotating around 0,0
thanx jakob
View Replies !
View Related
Drawing A Line With ActionScripting
Can you draw a line with actionScripting... that goes to a certain point then changes directions and continues to draw...then the line stops but is still visible, then have text of What is your first name ? then a new line that goes to a certain point and change directions and stops at a certain point ?
I am using flash MX
I have never tried this before... so hopefully... I have thought of something to do... that actually can be done ?
View Replies !
View Related
Drawing A Line With Actioscript
this is what i want to do. have a start point and end point and let actionscript draw the line. But i would like to be able to see the line being drawn like a motion tween. ive seen some sites do it in their intros drawing company logos, etc.
any help would be greatly appreciated
View Replies !
View Related
|