Draw Box
Hello. I have a flash file that draws a box when the user clicks down on the mouse, adjusting the box to any size they need. Here is the code:
Code:
box._visible = false;
box.onMouseDown = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
this._xscale = this._yscale=0;
this._visible = true;
this.onMouseMove = function() {
this._xscale = _root._xmouse-this._x;
this._yscale = _root._ymouse-this._y;
updateAfterEvent();
};
};
box.onMouseUp = function() {
delete this.onMouseMove;
this._visible = true;
};
This works fine, but I need the user to be able to create multiple boxes. Right now, after drawing a box, then clicking again it erases the existing box. I also need these boxes that are created to attach themselves to a movie clip. I've tried the attachMovie script, but cannot seem to get it to work the way I need it to. Any ideas?
KirupaForum > Flash > Flash 8 (and earlier) > Flash MX 2004
Posted on: 12-27-2005, 12:01 PM
View Complete Forum Thread with Replies
Sponsored Links:
I Can't Draw
I've recently purchased flash 5 and I've pretty much got all of the scripting and what not figured out. But I'm having trouble with !!!!!DRAWING!!!!! it's the stupid mouse I'm not coordinated enough to draw with it. Does anybody out there know any software or hardware compatible with flash that will make it more like REAL drawing? instead of trying to draw with mouse.
Thanks
View Replies !
View Related
Draw
I have a simple line drawing tool.
Click, it places a root, and a line follows the mouse until the mouse is clicked again at the end point.
After the line has been placed and created:
How can I make it so that the user can click on the line, (so I can allow color change, width change, etc.)
any ideas would be wonderful! thanks
View Replies !
View Related
Can't Draw
hello, this is my first time on the forum and somehow I closed the menu bar that allows me to change the color, writing tool, and access of the lasso.Now I can't draw at all, and I was wondering if anybody can tell me how to bring it back up.
-thanks in advance
View Replies !
View Related
Mc Draw
I'm a newbie to this. I really need some help. I'm trying to use mc Draw to make a rectangle. I want it to scale depending on what the user enters in the width and length text box. When they hit enter it draws the rectangle.
Can anyone help? the more I work on this the more confused I get....
Thanks in advance.
View Replies !
View Related
Draw A Arc
Hi,
i have a knob/dail which you can turn by draging a handle. i can get the degrees and the percentage from the dail, as i have a listener setup to monitor its position.
so...
heres what i want to do; using the the degrees var i want to be able to draw out a circle (or rather outline my dial) so if for example the dial is dragged to 180 degrees the arch reaches to 180 degrees.
does this make sense?
cheers,
Gareth
View Replies !
View Related
[CS3, AS2] Draw()
Can someone help me out with this please?
I have a graphic symbol which is on first frame of "framefile.swf".
And, I have the below code on the first frame of my "main.swf"
Code:
stop();
import flash.display.BitmapData;
var newclip = this.createEmptyMovieClip("newclip", 1);
var empt = this.createEmptyMovieClip("empt", 2);
function bmpFunction() {
var bmpdata = new BitmapData(empt._width, empt._height, true, 0x00000000);
bmpdata.draw(empt.frame_tin);
newclip.attachBitmap(bmpdata,newclip.getNextHighestDepth());
newclip._x=500
}
var xxx = new MovieClipLoader();
var ddd = new Object();
xxx.addListener(ddd);
ddd.onLoadInit = function() {
bmpFunction();
};
xxx.loadClip("framefile.swf",empt);
Below is the screenshot of what i get in "main.swf" when its compiled. The image graphic on the left is the graphic which is there on the first frame of "framefile.swf" which appears fine as per the above code. But its the image that you see on the right that has a problem. Its not getting displayed fully. I am just trying to draw the same image again using bitmapdata.
View Replies !
View Related
[CS3] Draw()
Can someone help me out with this please?
I have a graphic symbol which is on first frame of "framefile.swf".
And, I have the below code on the first frame of my "main.swf"
Code:
stop();
import flash.display.BitmapData;
var newclip = this.createEmptyMovieClip("newclip", 1);
var empt = this.createEmptyMovieClip("empt", 2);
function bmpFunction() {
var bmpdata = new BitmapData(empt._width, empt._height, true, 0x00000000);
bmpdata.draw(empt.frame_tin);
newclip.attachBitmap(bmpdata,newclip.getNextHighestDepth());
newclip._x=500
}
var xxx = new MovieClipLoader();
var ddd = new Object();
xxx.addListener(ddd);
ddd.onLoadInit = function() {
bmpFunction();
};
xxx.loadClip("framefile.swf",empt);
Below is the screenshot of what i get in "main.swf" when its compiled. The image graphic on the left is the graphic which is there on the first frame of "framefile.swf" which appears fine as per the above code. But its the image that you see on the right that has a problem. Its not getting displayed fully. I am just trying to draw the same image again using bitmapdata.
View Replies !
View Related
Draw On A SWF
Hey guys
i am trying to make a SWF file so that one can select a pen tool and start drawing on the swf file. Does anybody have an idea how can i do that I dont mind scripting anuthing if that can make it work. Any input is appreciated.
thanks all.
View Replies !
View Related
How To Draw On JPG
Hello
I am totally new to flash actionscript. I have an image in jpg and it has some shapes ,say a ball. I want the user to be able to draw the ball over it. How can I do this in actionscript. I when I have selected a closed contour I want to tell an application running on another computer, probably on webserver that I have selected a particular shape like in this example a ball.
Is this possible in actionscript.
Thanks
View Replies !
View Related
Draw Itself
HELP>>>>>>>>>>>>>>
Does anyone know how make it seem like a shape is drawing itself?
What I really mean is that the effect that makes shapes look like it is filling out the outlines of its shape.
Thank you.
View Replies !
View Related
Draw Itself
HELP>>>>>>>>>>>>>>
Does anyone know how make it seem like a shape is drawing itself?
What I really mean is that the effect that makes shapes look like it is filling out the outlines of its shape.
Thank you.
View Replies !
View Related
How To Draw A Line
Hi !
I would like some pointers as to how to go about drawing a line. Here's what I want to happen :
I would like the user to click and drag from a point A and a line should begin and end at the point B where the user releases the mouse button.
Any help is highly appreciated.
Thanks in advance
Vinod Sharma
View Replies !
View Related
Using Actionscript To Draw
can someone please post some links re: drawing with actionscript using variables and duplicating movie clips....
most of the cool sites (you know who you are!) use this mode of drawing and i would love to find a good tutorial...
thx in advance
View Replies !
View Related
Help: Draw & Fill Using AS
Hi all. I'm tring to figure out how to dynamically draw simple shape, such as a square, with actionscripts then fill them. Idealy I would like to beable to set coordinates for the 4 corners so that I could move a corner to morph the shape using code. I dont need dragability, just need to be able to change and fill the shape using AS.
Can anyone point me in the right direction on how to do this in F5 / MX?
Thanks
View Replies !
View Related
Draw Instance Name From Within Mc
I am using this code on a checkbox component to draw the instance name of the component back so I can put it to use. But it will only work on components that are placed directly on the stage, it wont pull the instance name from any component in a MC. Any suggestions? Thanks for any help.
Here is the code:
Code:
function noteBtn(component){
trace (component);
}
View Replies !
View Related
Draw Speed
Is there away to detect how fast the users pc can draw an image/vector or what ever in flash.
The idea being if the computer is slow I can have some features turned off automatically - _quality = "LOW" for exmaple. and vica verca for better computers.
I tring to make a site that will look good on a lot more computers.
cheers
View Replies !
View Related
Draw Functions
I've been working on a program which will need to have the user draw on the screen, so I've been working with MX draw functions. I'm having difficulty figuring out what the equation they use for the curve is. I've gathered that you give the end points, and that the anchor point determines the direction of the curve, but what exactly would the equation be, given these three points?
Also, I've noticed that when you are actually drawing with flash, it seems to work differently. When you draw a line, each vertice of the line seems to have a seperate anchor point. What is the equation they use for this, and how does it relate to the one used for the curveTo function?
Thanks for your time, any other details about the draw functions would also be appreciated.
View Replies !
View Related
Bug With Draw Commands?
I'm not sure if this is my video card driver or not.
So I could appreciate someone taking a look at this.
Just test the movie and see if the draw commands I'm using
creates the same bug I'm getting here.
The fla is a set of class routines for useing the movie clip
drawing commands. Seems when you use multiple beginFill()
and endFill() commands on the same clip odd things start to happen.
Thanks,
Chris
View Replies !
View Related
Need Someone To Draw For My Shoot Em Up
I need somebody quite good at drawing cartoon style stuff to draw characters/weapons/items/backgrounds for the shooter I plan to make. I know all the actionscript needed to make the game, but I suck at drawing, and I don't want to start without the graphics. If anyone is interested, please email me at tom@wombatman.co.uk
Thanks,
View Replies !
View Related
Draw Circle
Hy guys,
I'm still working on my paint-like program and its going pretty wel. Except when it comes to drawing cirkels. Flash came up with the most difficult way ever to draw a circle! What ever happened to just giving the coordinates of the bounding box of the oval? Or center point and radius for a perfect circle?
I've been working on this for three days now. With no result. I know there's a lot about it on the internet but I just can get it to work. Mostly because of the math.
I hate to ask but I've got no choice. Anyone up to creating this peace of code?
Here's what supposed to happen:
The user clicks on the button for drawing circles (I only need perfect circles so that should make it easier)
When he clicks on the stage, a circle should appear with the mouse position where the user clicked as center point and with the radius equal to the distance between the created center point and the current mouse position (I'm afraid this will need the Math.atan() and the Math.acos() functions). While the user drags, the circel should change size according to the mouse position. As the user releases the mousebutton, the current circle is drawn.
To give you a better idea, here's the code I used for drawing a squaire in the exact same way.
if (_global.action == 3) { // tells that user wants to draw a squaire
_root.xbegin = _root.xpos; //xpos & ypos contain the current mouse position. They are updated on every mousemove event
_root.ybegin = _root.ypos; //xbegin & ybegin are the coordinates where the user cliked (onMouseDown)
_root.draw = "rectangle";
onMouseMove = function () { //each time mouse moves, a new squaire is created
_root.createEmptyMovieClip(["clip"+i],i); //everytime user clicks : i++ to create overlapping MC's
_root["clip"+i].lineStyle(1,0xff0000,100);
GetPos.call(); //To get x & y position of the mouse --> then stored in xpos & ypos
_root["clip"+i].beginFill (0x0000ff)
_root["clip"+i].moveTo(_root.xbegin+11, _root.ybegin+10);
_root["clip"+i].lineTo(_root.xbegin+11, _root.ypos+10);
_root["clip"+i].lineTo(_root.xpos+11, _root.ypos+10);
_root["clip"+i].lineTo(_root.xpos+11, _root.ybegin+10);
_root["clip"+i].lineTo(_root.xbegin+11, _root.ybegin+10);
};
onMouseUp=function(){
if (_global.action == 3) {
loadVariablesNum("submitDisplay.cgi",0,"POST"); //send the data
onMouseMove=null; //stop drawing squaires
onMouseMove = function() {
GetPos.call(); //to restart mousetracking
};
}
}
View Replies !
View Related
Draw On Image...
Hey,
In need of a solution. I am unbale to get my spray can (mc) to draw on an image (a wall mc). my code so far looks like this...
on the frame:
_root.wall.createEmptyMovieClip("line",1);
_root.wall.line.lineStyle(2, 0x000000, 100);
stop(
on my sray can:
on (press)
{
startDrag(can);
_root.wall.line.moveTo(_x, _y);
_root.onMouseMove = function()
{
_root.wall.line.lineTo(_x, _y);
};
}
on (release)
{
stopDrag();
_root.onMouseMove = null;
}
Can I eventually get my spray can to draw on the wall?
thx for any help.
View Replies !
View Related
How To Draw Grass
Does anyone know where I can download a flash file with grass in it or anywhere there is a tutorial to draw grass? I am kind of new with flash and the drawing of it with so many blades, etc. seems too drawn out and plus I find the drawing tool hard to use. Thanks for your help.
View Replies !
View Related
Getting Flash To Draw By Itself
I am trying to get Flash MX to draw a spider web. I have Flash creating a empty movie clip
and I have looked into the commands moveTo and curveTo. But how do you get it to slowly draw? I am also having difficulty figuring out how to place my lines where I want them. Thank you.
View Replies !
View Related
How To Draw Line?
Hi all,
I have a photo, say of a Printer and I draw the Outline of the Printer, with simple Sketches... just Lines.
Now, how would I create an Animation like Someone is "DRAWING" that lines that make up a Printer???
Hope you get that...
Please help me with that... I do not mean a masking effect.. If I want the Individual Lines to be drawn the way they are... how would I do that..
Thanks a lot for any help that you may provide.
Wishy
View Replies !
View Related
What Tool Do You Use To Draw?
What tools do most of you usually use when drawing in Flash? Whenever I use the paintbrush, my line are a little jagged, not nice and smooth like on good animation sites such as homestarrunner.com.
Just wondering what tool is most used. Paintbrush or pencil? If paintbrush how did homestarrunner get their lines so smooth? And if pencil, do you use smooth or ink?
Or do you draw in Photoshop?!
Thanks a lot!
View Replies !
View Related
Using An Animation To Draw...
i'm using flash mx 2004 pro...
i have a pen that i want to write out whatever i tell it too...similar to this ...i'm just taking a different approach to it...
i have an animation of a pen in flash and i would like it to draw a line or make a mark where ever the tip of the pen is... so basically i'm doing something like my_mc.lineTo(pen._x, pen._y) but that's not working...i've created an empty movie clip, set the lineStyle, etc. ...there's just nothing showing up when the animation runs...maybe you can't do it this way, but i would just like to see what others have to say about this...thank you...
View Replies !
View Related
How To Draw Cars
Here it is again... tried to update it and ended up having to trash the thread.
If you already downloaded this free tutorial... this one is almost exactly the same as the first... no point in doing it again.
Let me know if you think it works OK or does it need to have more information.
View Replies !
View Related
Draw Function
i need 2 create a drawing board for my site, where u can change the colours to draw in. i dont want the whole stage 2 be drawn on i need to create an area in a box, can anyone help me please?
View Replies !
View Related
Draw Box Outline
I wanted to create a very simple quick animation.
A box outline will draw, then starting from the middle fill the box with the colour vertically (to top and bottom). A white box then draws at the top for the header and the logo fades in.
Then a few text effects with our products and services to be listed.
Does anyone know of a good tutorial to do something similar to this or broken up into it's areas? I have searched this site and googled but not had any luck finding something along the lines of what I need.
To draw the box I tried startng with a 1px x 1px line and stretching it then tween, but this doesn`t seem to tween.
Thanks folks
View Replies !
View Related
Draw Outline
I have searched and searched and have not found "This is how it is done".
I want to draw an outline of a bitmap before the bitmap appears and then fill in the bitmap.
Example site - http://www.spcan.com/main.html
I have seen to possible ways of doing this but now one really knows.
1. draw the line and then reveal it via a mask
2. draw it via the drawing API.
A tutorial would be nice.
Thanks in advance.
View Replies !
View Related
Draw As Group?
I have Flash Professional 8, and my friend just got it, too. I have an option turned on that draws things as groups automatically. It's great, and he wants to use that option too. But, I can't find that option again! Does anyone know where it is?
View Replies !
View Related
Draw An Image
First of all I am using Flash MX8. I'm not sure how to explain this but im looking to have a sequence where say a hand is drawing an image. If anyone could help it would be much appreciated. Thank You.
View Replies !
View Related
How To Draw U In Flash.
Hi,
I am very much new to Flash animation and started with some VERY basic movement and button effects.
I can make a straigh line move across but When it's comes to giving them turning movement i don't know how to do it.
Can someone please show me HOW TO DRAY 'U'?
Thanks in advance,
Kmria
www.c6h6.net/jsn
View Replies !
View Related
Draw In Flash
I try to draw in Flash MX but it is frustrating to get a shiny bevel look on a button.
I am a experienced Photoshop painter, and thinking of drawing only in Photo-
shop, or Macromedia Freehand, and import this into Flash.
For me its easier to draw vectors in Ps or Freeh. Any advise or experience
welcome. I´m new to this forum, thank´s.
Guido.
View Replies !
View Related
Draw Into Levels
This code is to create a vector item by code, then duplicate that item into different levels, and change its size and color. Can anyone see the problem in this code?
FRAME 1:
---------
orgnX = 150;
orgnY = 150;
shift = 25;
spacer = 50;
halt = 500;
offSet = 2;
var colors = new Array(0x5D0E01, 0xC53200, 0xFE6E0D, 0xFFA329, 0xFBC445);
itt = 0;
var scale = new Array(100, 75, 53, 38, 27);
holder = "holder"+itt
drawFlame = function(){
holder = "holder"+itt
var curve1 = new Array(orgnX-shift, orgnY+(shift*3), orgnX, orgnY+(shift*4));
var curve2 = new Array(orgnX+(shift*2), orgnY+(shift*7), orgnX, orgnY+(shift*8));
var curve3 = new Array(orgnX-(shift*2), orgnY+(shift*9), orgnX, orgnY+(shift*12));
var curve4 = new Array(curve3[0], curve3[1], curve2[2]+spacer, curve2[3]);
var curve5 = new Array(curve2[0]+spacer, curve2[1], curve2[2]+spacer, curve1[3]);
var curve6 = new Array(curve1[0]+shift, curve1[1]+shift, orgnX, orgnY);
_root.createEmptyMovieClip(holder,itt);
holder._xscale = scale[itt];
holder._yscale = scale[itt];
holder.lineStyle(0,0,0);
//begin fill
holder.beginFill(colors[itt],50);
//go to origin
holder.moveTo(orgnX,orgnY);
holder.curveTo(curve1[0],curve1[1],curve1[2],curve1[3]);
holder.curveTo(curve2[0],curve2[1],curve2[2],curve2[3]);
holder.curveTo(curve3[0],curve3[1],curve3[2],curve3[3]);
//RETURN
holder.curveTo(curve4[0],curve4[1],curve4[2],curve4[3]);
holder.curveTo(curve5[0],curve5[1],curve5[2],curve5[3]);
holder.curveTo(curve6[0],curve6[1],curve6[2],curve6[3]);
//finish draw
//close fill area
holder.endFill();
};
FRAME 2:
--------
for (itt=0; itt<5; itt++)
{
drawFlame();
}
View Replies !
View Related
HELP Stop Draw
In my button code, I have set my OnMouseDown to draw a line.
Now I want to trap the esc key so I can stop drawing on the OnMouseDown.
I have spent hrs trying different methods , I am new to actionscript.
Code:
on (press) {
startDrag("",true);
}
on (release) {
stopDrag();
}
on (keyPress "<Space>") {
//set up to start drawing
trace("hello");
createEmptyMovieClip("Line",1);
Line.lineStyle(1,0x000000,100);
Line.moveTo(_xmouse,_ymouse);
//redefine mousedown to draw
onMouseDown=function () {
Line.lineTo(_xmouse,_ymouse);
}
}
View Replies !
View Related
[F8] Need 'Reset Draw API' Help Please
I have a "marker" tool where the user can click it and then write on the stage. They can click it again and it turns it off and clears the lines made. I've also added the a/s to buttons so that when the user navigates through the application it will automatically clear the line and turn the "marker" to off until its activated again. It's working fine.
My question is:
Is there a way to globally set it so that upon any button being clicked it clears the line and turns the "marker" off? Because I'm starting to realize there are a lot of buttons that would need this code and it would take forever to add to them all. I was thinking maybe if the script could recognize anytime the playback head moved on the timeline it would clear the line and turn it off?
Here is the script:
// set the marker boolean value to false
var apiOn = true;
emptyMarker._visible = true;
crayon2._visible = false;
/*CRAYON A/S*/
var crayonActive = false;
crayon.onPress = function()
{
crayonActive = !crayonActive;
if (crayonActive)
{
// 1. SETTING THINGS
_root.createEmptyMovieClip("line", 1);
myColor = new Color(_root.crayon);
myColor.setRGB(0xE31836);
// 2. EVENTS IN _ROOT:
_root.onMouseDown = function()
{
line.moveTo(_xmouse, _ymouse);
line.lineStyle(3, 0xE31836, 100);
this.onMouseMove = function()
{
line.lineTo(_xmouse, _ymouse);
updateAfterEvent();
};
};
_root.onMouseUp = function()
{
this.onMouseMove = null;
};
}
else
{
_root.line.clear();
onMouseDown = null;
myColor = new Color(_root.crayon);
myColor.setRGB(0xA8D7EA);
}
}
Any help/thoughts would be much appreciated!
View Replies !
View Related
|