ActionScript 3.0 :: Stop A Function In Drawing ( Painting ) App?
Jan 12, 2011
i have a problem with functions, i'm creating a painting app in flash as3. i want to draw two different style a pen and rectangle.
When i draw pen style in first frame there is no problem, but when i click rectangle style in second frame it is drawing with both style. How can i stop or kill other function?
How do I make both of the not drawing. And How can i undo my last action in drawing?
Fla is in the attachement (CS4 version)
in first frame drawing pen;
Code:
var clip : Shape = new Shape();
addChild (clip);
stage.addEventListener(MouseEvent.MOUSE_DOWN, _handleMouseEvent);
[Code]....
View 5 Replies
Similar Posts:
Jul 20, 2009
I am trying to create an app that lets the user draw on a stage. I can start drawing, but the app doesn't stop drawing. I don't know if this is an Action Script issue or if I have created a structure that just doesn't work. Here is my code:
[Code]....
View 5 Replies
Mar 6, 2006
I'm trying to make a little Flash Movie which randomly displays 3D cubes on the screen.
I've got a scene which consists of an array of shapes, each of which extends a basic shape class.
Then the camera has an array of shapes which it calls a scene.
You call the drawing method like this: camera_x.showScene(myScene);
The problem I have is that if there's more than one item in the scene array only one gets drawn. It's like the biggest thing is hiding all the rest.
View 1 Replies
Jun 14, 2004
This code is from a drawing board, the problem is:
1- When you click outside the drawing area, a dot is drawn (thus you cant click anything except inside drawing area because it will result in undesired dots)
2- When you drag outside the drawing area the dot is drawn (bad), the pencil doesn't draw (good), but if you drag until reaching the drawing area draws (undesired, because it should only draw when you started to drag from inside the drawing area) how to tweak the code or simple add a "deselect" tool option ? That's a link to the fla file ziped, and that's the code of the drawing board: [URL]
Code:
_root.P = 0;
_root.level = 1000;
_root.tmpx = -1;
[code]...
View 6 Replies
Jun 14, 2004
This code is from a drawing board, the problem is:
1- When you click outside the drawing area, a dot is drawn (thus you cant click anything except inside drawing area because it will result in undesired dots)
2- When you drag outside the drawing area the dot is drawn (bad), the pencil doesn't draw (good), but if you drag until reaching the drawing area draws (undesired, because it should only draw when you started to drag from inside the drawing area)[code]...
View 6 Replies
Jul 5, 2004
I made a movieclip with 5 frames inside. Well, outside, when i push a button stop, runs the code: this.movieclip_name.stop(); , but, doesn't stop.Inside these frames there is a enterframe function that call drawing api functions.
View 1 Replies
Jun 20, 2011
var cr:CellRenderer = dgv.getCellRendererAt(0,0) as CellRenderer;
cr.setStyle("upSkin", new CustomCellBackground());
where dgv is DataGrid instance, CustomCellBackground - is my MovieClip which is simple rectangle filled with some color.
View 7 Replies
Nov 9, 2011
I am dynamically creating moviclips.. when I create a movieclip(mc1) this movieclip present a wall(for painting).. On this wall I create several windows(holes) which a present as mask for a wall, so that only the color of the wall is viewed, but the window is transparent..
when I am done with this I have for example 3 walls(mc1, mc2, mc3) with masks included..now on a button action I want to enable each movie clip for painting->painting is done so that you pick a color in a palllete and then click the wall you want to paint.. I do this with this code:
btn_color.onRelease = function(){
for(i=1; i<=stMC; i++) //stMC is nubmer of created mc's
{
[code]....
The code works great for the last movieclip created.. but when painting others it paints the entire wall in chosen color, so it colors the transparent windows(were set as masks as well)..
View 2 Replies
Jan 12, 2011
i have a problem with functions, i'm creating a painting app in flash as3. i want to draw two different style a pen and rectangle.
When i draw pen style in first frame there is no problem, but when i click rectangle style in second frame it is drawing with both style. How can i stop or kill other function?
How do I make both of the not drawing. And How can i undo my last action in drawing?
Fla is in the attachement (CS4 version)
in first frame drawing pen;
Code: Select allvar clip : Shape = new Shape();
addChild (clip);
stage.addEventListener(MouseEvent.MOUSE_DOWN, _handleMouseEvent);
stage.addEventListener(MouseEvent.MOUSE_UP, _handleMouseEvent);
[Code]....
View 1 Replies
Jun 18, 2004
I`trying to create an MC that when browsed two people on two different terminals (2 IPs, on two different continents) can actually draw on the same canvas...
View 8 Replies
Jun 8, 2011
I'm developing a word game for mobile and I'm trying to solve a bug:I have many squares with letters and when the user mouses down (or touches) a letter, the app starts to put together a word. Every letter that is moused over is added to the word and I have a textfield that shows the current word the user is trying to put together.Every letter added to the word (text.change event) I check if this is a word that is available in my dictionary (array of words). If this word is correct and exists, I want to paint the color of the textfield showing the word so the user would know that this is a valid word, even if he doesn't know the word.
My problem is that this code runs and traces correct and in the right moment (the trace "word exists" is being called when I add a letter that makes the word valid. But the painting of the word just happens when the text changes again. This causes the app to make the word blue after adding or removing a letter from a "valid" word, but in this case I want it to happen immediately when the user reaches a valid word.Can the problem be happening because the mouse is down?
Code:
if (dict.wordExists(word))
{
[code]......
View 1 Replies
Jul 9, 2011
I've recently decided to trace over an animation from a cartoon as a reference for my own animation that I am making. Now, my hang up is that I use the line tool for the tracing, and then convert the lines to paint so that I can shape them better to match how the characters from the show look. Where the legs connect to the body the line get gradually thinner from where it started.
I don't have a tablet and trying to do it with the mouse leaves too many lumps. The results are not acceptable, nor efficient. In all, I have about forty frames to optimize my traced lines, to the good looking tapered paint. The show was done in flash, so I know it must be possible in CS5. Aside from the subselection tool (Which horribly warps my lines and is extremely tedious for a frame by frame animation), does anybody know a more efficient way to do this?
View 1 Replies
May 16, 2005
I have in a function a line to be drawn. I want the line to be not solid but like this ------. Can I code for that.line4.lineStyle(2,"0000FF",100);
View 4 Replies
Mar 12, 2004
I need to create a specific drawing sequence that uses multple clicks to arrive at a certain shape.
Basically, I need the user to be able to draw a pie wedge over a bitmap image. The actual drawiing is not the problem right now, what I am struggling with is how to control the action based on how many times the person has clicked.
On the very first click, a temporary line is drawn from the center of the image, and the user can move the mouse around to get the first line where they want.
They click again and the temp line is cleared and the final line is put in place. Then, as they move the mouse off that last end point, I need a new temporary line to automatically generate (this is the second straight side of the wedge). They click a final time and that line locks in place and the wedge completes.
Now, the problem I have is that I am using a switch statement to test the clicks. When the routine starts I've got the var _root.c = 0. Here's the switch:
[AS]switch (_root.c) {
case 0 :
_root.canvasArc.onMouseUp = drawFirstLine;
break;
[Code]....
As you can see I am incrementing _root.c at the end of this. This part works fine (I verified that it is making _root.c = 1), but it seems that by breaking out of the switch statement, it doesn't go back and check anything again, so my case 1 never gets read and the rest of the process can't happen. I tried an if statement and even looped through that with setInterval but that doesn't seem to work either. Is there just a smarter way to do this?
View 3 Replies
May 16, 2005
I have in a function a line to be drawn. I want the line to be not solid but [code]
View 4 Replies
Dec 1, 2010
I'm currently working on a few small paint programs designed to emulate certain famous painters. I'm using a pretty basic AS2 painting program and simply manipulating it to my needs, but have run into a few problems that trial and error have not been able to fix.For two of the programs I would like the up and down arrows of the keyboard to change the size of the brush, which is currently set by the variable ranWidth (one of the other programs uses random widths for the brush).For one of the programs, the left and right arrows will increase or decrease the paint opacity.One of the programs will be a pointillism style drawing program, so instead of drawing a line as it does currently, I'm trying to have it draw a series of dots, without having to click down every time.Third, my color selection right now changes randomly each time the user clicks down. This works fine for some of the programs, but others it really is neccesary to choose a color. I've tried creating buttons with on release functions that would change the color variable but havn't got them to work properly.I know its a bit of a list but I think most of the coding is fairly simple, I'm just new to actionscript and trying to learn the ropes. I've used keys to change items before but am not having any luck.Here is my basic script for one of the painting programs. This one simply draws lines in different colors at random sizes.[code]
View 10 Replies
Jan 24, 2009
If I create a simple Textfield and place it on the stage, it looks good.
If I take the same Textfield, and paint it into a BitmapData (first putting the Textfield into a Sprite so I can paint it), the resulting BitmapData is not the same, pixel for pixel, as the original textfield on the stage.
refer to the attached image for a zoomed in view on the differences in the aliasing.
What can I do to keep the two pixel-for-pixel identical?
Code:
private static function doTest( stg:Stage ):void
{
var tf:TextField = new TextField();
tf.text = "TESTING";
[Code].....
View 1 Replies
Jun 23, 2010
I'm doing a tutorial from Adobe Flash CS4 classroom in a book. They're suggesting the following: "create buttons that allow users to switch between painting ellipses and painting squares". I've created the class files for the cirlcle and the square and I've set two hot keys to switch between painting circles and rectangles(it does not work) Now I'm trying to create the buttons.
package {
import flash.display.MovieClip;
public class Rect extends MovieClip {
public function Rect(w:Number = 40,h:Number = 40, color:Number = 0xff0000) {
graphics.beginFill(color);
[Code] .....
View 1 Replies
Oct 5, 2011
I am trying to implement a house painting application. I've done it so far that I can draw a shape(creates a movie clip) and fill it with any color. But now I don't know how to "make holes"/transparent areas into a certain movie clip for windows or anything that should not be colored so taht the backgorund will be displayed. [URL]
View 5 Replies
Mar 5, 2010
I'm new ActionScript, and programming in general, however I've been doing a lot of tutorials and reading my Flash CS4 Bible, and cruising the forums like crazy trying to figure out how to go about scripting for my project.
Situation: I need to make an interactive flash movie that explains a painting.when you rollover different sections of the painting, I would like the rest of the painting to dim, and for that section to grow. if you are to roll out, it goes back to the first frame and the same thing happens for all of the sections.
If you are to click on any given section, there will be a voiceover, and possibly a little animation that goes along with it. if you either watch the whole thing or click anywhere on the painting, it should go back to frame.I've thought of a few ways to do it, but can't seem to get the scripting right.for now, I'm only worried about the first part because the rest is going to be similar.Frame 1 I have the painting and an invisible button over a section. frames 2-7 is that section growing and the rest of the painting getting dim there is a stop(); on frames 1 and 7
[Code]...
View 5 Replies
Jan 7, 2010
I am making a flash website and I am implementing a fluid layout. In the website I made a drawing program that is supposed to move along with the rest of the elements of the website when the window is resized. Now the problem is not the drawing program itself, ive got that working very well, the problem is when the canvas movieClip onto which the painting is being done is moved when the window is resized, the movie clip does not stay on centre, and the drawing is displaced outside the canvas movieClip and no longer happens on the mouse X and Y.For the sake of simplicity I made a simplified version of the drawing program with the fluid layout code and drawing code. No point in going through 200 lines of code when the problem lies within 10 lines of code.[code]The pink box is the canvas the user is able to draw on. The grey box is used to test the fluid layout code and to give coordinates for the pink box. When the file first loads both the pink and grey boxes are side by side, during the resize event they should stay side by side, however they do not.
View 1 Replies
Feb 8, 2011
I am trying to create a painting application that allows you to export as a jpeg. I have the code for the jpeg encoder, and for the color changing--but I am having trouble combining the two...
This is the jpeg encoder sketching app:
ActionScript Code:
import flash.display.Sprite;
import flash.events.MouseEvent;
import com.adobe.images.JPGEncoder;
[Code]....
It would also be great to be able to clear the canvas_mc by clicking a button..
View 7 Replies
Dec 29, 2011
I'm trying to create a function that draws a polygon with two parameters that are: number of sides and length of sides. You would input a number for side length and a number for the number of sides. Then it would draw the side length, then turn at a angle based on the number of sides, then draw side length again... until it has finished drawing the polygon based on the number of sides that were put in.
View 1 Replies
Sep 8, 2010
i am trying to make a mouse-drawing function which is frame independent (for collision detection).somehow my trigonometry brain part seems to be out of order. fill in the blanks?here is my code so far (simplified):
Code:
mport flash.events.MouseEvent;
import flash.geom.Point;
[code]......
View 0 Replies
Jul 1, 2010
ActionScript Code:
myFunct();
function myFunct()
{
[Code].....
Any way to get this to work without using much more code? This is for a function that checks to see if a user is still logged into a website. I need the check to happen every time the user causes certain functions to run, like create topic, submit new post, etc. I could put the code, which is only a two-liner if/else statement in every function, but it would be nice to just call a single function. But that function would have to be able to cause the function that's calling it to return to get it to cease.
View 5 Replies
Oct 14, 2009
I have a task: I need to place about 100 sprites on one canvas (with prepared grid on it). I need to place them as invisible (circles) stones, on the board, and make visible only on mouseover. The problem I come across is following, I can't place those objects accurately into the nodes on the grid.
[Code]...
View 2 Replies
Nov 9, 2010
i've tried to simulate a pencil tool, for drawing above a imagem, but the drawing is below the picture. How fix it?
[Code]....
View 3 Replies
Jul 22, 2009
Basically I've got a reasonably complex drawing object in a fla and I want to reproduce it in a class definition using the drawing api. However obviously this is a tedious task, so is there some trick or automated method of doing this?
Last time I needed to do this it was a drawing of an arrow and I ended up writing down x,y,width,height values for everything but this one has curves in it which I don't have experience with drawing anyway.
View 2 Replies
Sep 28, 2009
I cannot get this to work. Without the "var drawing", "var drawing being true or false" and the "if statement", it works fine. But I need to add the "var drawing" so that you can only draw if you turn it on by pressing the "draw_btn" button. Note, I do not get an error, the script "apparently" contains no errors. Here is the code:
ActionScript Code:
var drawing = false
_root.createEmptyMovieClip("myLine", 0);
[Code].....
View 3 Replies
Jan 13, 2012
I've created a drawing tool which allows the user to draw on the canvas, the problem is that if I try to draw over a movieclip nothing happens. Is there a way I can allow for the user to draw over movieclips? For example if I had a background of paper?
Here's the code I'm using for it:
// This code is for drawing the lines on the page
//1.
var drawingLine:MovieClip = new MovieClip();
addChildAt(drawingLine,0);
[code]....
View 8 Replies