ActionScript 2.0 :: Drawing API - Draw Rectangle By Dragging Mouse On Canvas?

May 10, 2005

I need to to incorporate a functionality where the user can use his mouse to draw a rectangle by dragging his mouse over the canvas - much like the Rectangle Drawing Tool in the Flash Authoring environment. The requirement is something like a rubberband tool where the user can define a portion of a map by drawing a rectangle over it. The coordinates needs to be captured. Can anyone help me with the actionscript.

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Drawing API - Draw Rectangle By Dragging Mouse On Canvas

May 10, 2005

I need to to incorporate a functionality where the user can use his mouse to draw a rectangle by dragging his mouse over the canvas - much like the Rectangle Drawing Tool in the Flash Authoring environment. The requirement is something like a rubberband tool where the user can define a portion of a map by drawing a rectangle over it. The coordinates needs to be captured.

View 1 Replies

ActionScript 3.0 :: ScrollPane Component - Draw A Rectangle On A Movie Clip(board_mc) By Dragging Mouse Over It

Mar 15, 2010

I need t draw a rectangle on a movie clip(board_mc) by dragging mouse over it......It works fine till here but I want to put the movie clip(board_mc) in scrollpane.
but after doing so the code doesnot work....can u plz guide me how to make this code work after placing the movie clip (board_mc) in scrollpane(say board_scp).

[Code]...

View 5 Replies

ActionScript 3.0 :: Drawing Rectangle With Mouse?

Nov 21, 2011

I'm trying to draw a rectangle with my mouse using actionscript. I found a script online for elispes. I used that and it worked just fine. But when I change it to a rectangle, it doesn't work.

Code:
var color:Number;
stage.addEventListener(MouseEvent.MOUSE_DOWN, startDrawing);
stage.addEventListener(MouseEvent.MOUSE_UP, stopDrawing);

[Code]....

View 1 Replies

ActionScript 3.0 :: Program To Draw When Mouse Is Down And Dragging?

Nov 27, 2011

I have written this code and i cannot figure out why my browser will freeze when i open it's html file:

Code:
package
{
import flash.display.*;

[Code]......

View 6 Replies

ActionScript 3.0 :: Draw Rectangle With Mouse Drag?

Jul 27, 2008

I Created an action script code when the mouse Down and Drag I taks the X,Y postion in the first and when the mouse is Up it take the Final X, Final Y and Draw Rectangle

I need to Show the User the Rectangle with the mouse Motion (like when you draw in photoshop ) But in my Code the the Rectangle appears when the mouse up

I attached The Code to the msg

View 3 Replies

ActionScript 3.0 :: Draw Round Rectangle On Mouse Down?

Feb 25, 2009

I am trying to draw Round Rectangle on Mouse Down. The width and height is depending on the new positions of mouse x and y. But it is not working as I wanted it to be.

View 1 Replies

ActionScript 3.0 :: Draw A Rectangle Or Circle Shape With Mouse And Scale By Setting The Point?

May 11, 2009

I want to make an editor like this site. [URL] If you browse this link you will find "Button. If you press this button you will navigate to a editor to design your layout. After draw a rectangle or circle or line you can resize that or can rotate that. When you finish if press the "you will back to the previous page where your desinged layout display. If you press the "" again then you will navigate the editor with the previously designed layout. I want to make a site like this. I want to use the flash cs4 to make the editor. Anybody knows how to draw a rectangle or circle shape with mouse and how to scale by setting the point and how to rotate by setting the rotation point also by using flash cs4 and as3?.

View 3 Replies

Draw Rectangle Should See Little Bold Circle To Indicate A Perfect Rectangle

May 20, 2009

I draw a rectangle i should see a little bold circle to indicate a perfect rectangle, I seemed to lost mine, can somebody please tell me how to get it back!

View 2 Replies

ActionScript 3.0 :: Dragging Within Boundary Of Smaller Rectangle

Mar 31, 2009

I have a simple yet mind boggling problem on my hands,simply put I have a large MC (with its registration point in the center, i need it there), and it sits in a smaller stage (think of it like as if you were panning a map thru a viewer, like google maps) but i need a set of boundaries to prevent it from going haywire. Now i have tried a couple of methods ie [code]The above just manages to stop it but once it reaches that point the drag stops totally.

View 2 Replies

ActionScript 3.0 :: "mouse Off Canvas" - Go To Frame2 When The Cursor Leaves The Canvas

Feb 24, 2011

Basically I want to go to frame2 when the cursor leaves the canvas. The code below contains no errors when tested but it still does not work.

[Code]...

We know that the function gotoAndStop(frame2); works in multiple situations which means the first 3 line is fine. I don't know if the problem is the MOUSE_LEAVE event or this.stage which i suppose is the identifier for the canvas. I sure that there must be an alternative code for the identifier this.stage or the whole code. Any solution on how to fire the given function in the event when the cursor leaves the canvas?

View 2 Replies

ActionScript 3.0 :: Overlapping Canvas Using The Drawing API?

Sep 3, 2008

I'm using the drawing API features to do the following: I created two different squares and want to use them as two different canvas to draw on, they should be on top of each other so for testing purpose I overlap them partially here, but somehow I'm having trouble when trying to draw on the overlapped areas. Has any one encountered this problem or know how to solve it?

View 1 Replies

Flex :: Draw Lines In Canvas?

Dec 13, 2010

I'm trying to draw lines on a canvas object. When the width of the Canvas is less that the width of the line, it draws outside the Canvas over other elements. I read about this problem and I try to resolve using a inner Canvas with a longer height so a scrollbar appears.But I also read that this problem can be correct using a mask but I do not know what is the better way. Which do you recommend?

<mx:Canvas id="panelContentECG" width="100%" height="400" backgroundAlpha="0.5" styleName="miCanvas" borderStyle="solid" cornerRadius="20" borderColor="0xFCFE00" horizontalScrollPolicy="off">

[code].....

View 1 Replies

Flex :: Draw String In Canvas?

Dec 30, 2010

I'm trying to draw a String inside a canvas. The text and the position of the String changes pressing differents bottoms. For doing so, I create TextFields which I added to a sprite which I added to a Canvas:

canvas.rawChildren.addChild(spriteNombres);

The first time everything works fine but when I press the bottoms,it does not refresh and appear the old textfields and the new ones.I cant remove the old ones, I try with removeAllChildren and also trying to delete one by one with removeChildrenAt. I do not know if I'm doing something wrong or maybe this is not the best way.

I also try creating bitmapdata and drawing in the sprite inside a rectangle.

var channelName: TextField = new TextField();
channelName.text = channelNames[displaySequence[channel]];
if (channelName.text != null) {

[Code].....

View 1 Replies

ActionScript 1/2 :: Putting A Layer Over Drawing Canvas - Tile Map?

Sep 15, 2009

I want to make it so that a layer will be above the map when its drawn. Like I want a layer over this, cause im making a menu for the game, but the game is above the layer.

[Code]...

View 1 Replies

Actionscript 3 :: Flash Upload Image To Drawing Canvas

Jul 18, 2011

im trying to create a online business card editor to learn flash again, one of the functionality im trying to achieve is being able to upload an image (jpg,png etc) and place said image onto a drawing canvas and then being able to scale the image and rotate the image and move the image around. can some one direct me to a decent tutorial for this kind of functionality.

View 1 Replies

Drawing - Erase Line In Flex Canvas Drwing?

Dec 8, 2011

I am making a flex whiteboard application where lines are drawn over an image here is the scenario:

1: main canvas holding the background image and drawing canvas
2: user can move image by dragging image
3: user can draw over image, which is actually drawing on canvas over image.

I'm having problem on erasing lines like it eraser in paint. Searched evry where but didnot find a way to erase drawn lines

[Code]...

View 1 Replies

ActionScript 3.0 :: Drawing An Invisible Rectangle?

Mar 15, 2009

I would like to have an invisible drop target so I can dropand item and have it go to another part of the training. However,if I create a rectangle as a sprite and don't fill it in, itdoesn't recognize it as an area apparently because nothing happenswithout a fill color. I tried just a regular rectangle, shape, etc.

View 5 Replies

ActionScript 3.0 :: Dynamic Drawing Of Rectangle?

Jun 10, 2009

I am trying to make a dynamic drawing tool for rectangle like this link : [URL]
 
I was able to make a line tool.

View 3 Replies

ActionScript 2.0 :: Tween Drawing API Rectangle?

Oct 1, 2006

I'm trying to create a rectangular mask - located at x:0, y:173 (1 pixel high ) - that will be stretched (_yscale) to the bottom of the image using the Flash Tween Class. Trouble is, the entire rectangle moves as if if were using "_y" instead of "_yscale". Tweening "_height" doesn't work any better. Can someone spot the problem with this file? If you comment out this line

var mask_tween:Object = new Tween(maskClip, "_yscale", Strong.easeOut, 0, 100, 1, true);

then you will see the correct placement of the mask rectangle. It just doesn't tween/scale properly.

View 3 Replies

ActionScript 3.0 :: Drawing Rectangle X Y Position?

May 18, 2009

public function onMouseDownHandler(e:MouseEvent) {
//trace("mouse down clicked!");

[Code]....

I am drawing a rectangle with the above code in as3 inside a area. Problem is that, when i try to acees the drawn rectangle x and y position it is showing 0,0. if i drag the drawn rectangle and try to access the x and y position then also it is calculating from the 0,0 position. first time when i draw the rectangle it is drawing well by dragging the mouse but why the x and y axis is 0,0; if i try to set the x and y position manually then when i try to draw by dragging , it is not drawing relative with the mouse.

View 2 Replies

Cannot Draw A Transparent Rectangle In Flash CS4

Sep 18, 2009

In Flash CS4, when I draw a rectangle (or circle, or anything) with a color that has 0 alpha, nothing is drawn. Also, if I select a piece of drawing and change the color to 0 alpha, the drawing (e.g. rectangle) disappears!I know I can draw a non-transparent rectangle, convert it to movie clip and set the movie clip's alpha to 0, but I'd like to avoid this.

View 5 Replies

Actionscript :: Draw Rectangle In Flex 4.5.1?

Sep 20, 2011

[code]...

Basically this is not working. I used this question to improve - still nothing.Why doesn't this Flex App draw a simple rectangle?

View 1 Replies

ActionScript 2.0 :: Auto-draw A Rectangle [FMX]?

Aug 26, 2005

i don't know if i'm posting at the right topic but i would like to know if anyone can tell me how to auto draw a rectangle around an image? for example, the image loads and is static then a rectangle is drawn around the image starting from the top left corner and goes around the rectangle back to the start of the image.

View 14 Replies

ActionScript 3.0 :: User Drawing A Line By Dragging A Point

Aug 19, 2010

I've been unable to find info on this because it's tricky to find the correct keywords. I want to allow the user to draw a line so that the application can measure the distance between two points chosen by the user. I could let the user click on one point and then the other but it would be much better if, after clicking the first point, a line would follow the mouse cursor like in most graphic applications. How would you do that? Is there a convenient method for that? Maybe use the MOUSE_MOVE event after the MOUSE_CLICK and continuously draw a line?

View 3 Replies

Flash - Drawing Rectangle Or Resizing Sprite?

May 13, 2011

I have two options and I want to know whats faster. I have a pool of 1000 sprites objects in as3 on screen. When its needed each sprite has to resize itself. I can
1- Make each sprite a simple container to use graphics to draw a rectangle, that is, call a 'spriteInstance.graphics.' ,draw the rectangle and on each 'refresh', I do graphics.clear and redraw the rectangle but with the new size, this for each sprite.
or
2- Create each sprite with a border and on each refresh, resize it
Whats better?

View 1 Replies

ActionScript 3.0 :: Drawing Rectangle Behind Mask Layer

Jun 28, 2010

I have a button that when clicked is supposed to draw a rectangle behind my mask layer but when I try to run it I get this error:
1067: Implicit coercion of a value of type Class to an unrelated type flash.display:BitmapData.

Here is the related ActionScript Code:
fabric_mc.phoenixFab.addEvenetListener(MouseEvent.CLICK, changeFabric);
function changeFabric(event:MouseEvent):void{
this.graphics.beginBitmapFill(phoenixFabric);
this.graphics.drawRect(181, 46, 319, 319);
this.graphics.endFill
}

View 9 Replies

ActionScript 2.0 :: Drawing A Rounded Rectangle At Runtime?

Oct 25, 2005

I've seen a few tutorials on this site that discuss the Drawing API, What I'm wanting to do is draw a rounded rectangle at runtime to a particular size.I initially tried resizing an already-created rectangle, but as the movie clip resized, the radius on the corners got distorted.

View 6 Replies

ActionScript 2.0 :: Drawing And Animating A Rectangle - MX2004

Apr 13, 2006

I want to draw a rectangle (1px border, no fill) and then scale it using ActionScript. If I scale the movieclip, obviously the border scales as well. Is there any way to scale a dynamically created shape in ActionScript?

View 5 Replies

ActionScript 2.0 :: Drawing And Animating A Rectangle - MX2004?

Mar 3, 2009

I want to draw a rectangle (1px border, no fill) and then scale it using ActionScript. If I scale the movieclip, obviously the border scales as well. Is there any way to scale a dynamically created shape in ActionScript?

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved