ActionScript 2.0 :: Draw Rectangle Within Flash Movie By Clicking
Oct 10, 2005I want to be able to draw a rectangle within my flash movie by clicking one point and dragging the cursor to another.
View 3 RepliesI want to be able to draw a rectangle within my flash movie by clicking one point and dragging the cursor to another.
View 3 RepliesI 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 RepliesI 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]...
I'm having a little difficulty getting to grips with the getBounds() Movie Clip function. I assumed the getbounds() method simply got the boundary coordinates for the movie Clip, that one could use to draw a rectangle. This is what I'm trying to do;I'm trying to get a movie clips coordinate bounds, and use the min and max values of x and y to draw rectangle around the object. Simple right? But in my case, I'm getting some unexpected results. I wonder does ther registration point of the object determine the coordinate values? Also are the coordinate values local to the clip instance or global to the stage?
[Code]...
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 RepliesIm probably overlooking something simple, but when I try to draw a rectangle Flash is automatically applying a corner radius. I've tried resetting the options in the Properties Inspector, which resets to the default, but soon as a draw a shape it goes right back to a random radius.
View 4 Replies[code]...
Basically this is not working. I used this question to improve - still nothing.Why doesn't this Flex App draw a simple rectangle?
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 RepliesI 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
the code is straightforward and my Intention should be clear. Still i can get this to work:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
[Code].....
I'm trying to draw a filled rectangle with no border. Here's the code for my test project:
ActionScript Code:
myMC = this.createEmptyMovieClip("", this.getNexthighestDepth()-1);
myMC._x = 0;
[Code].....
If you take a look at the coordinates, this was suppose to draw a 180x22. Well, it looks lika it draws a 180x22 rectangle, but only if the zoom is at 100%. If I zoom in on the flash player, there are two problems:
1) the line, as it is scaled, goes over the shape edge. Basically, as the border line has 1 pixel, Flash starts do draw it half pixel up and half pixel left; 2) the rectangle is in fact a 179x21 pixels, instead of the 180x22.
I'm sending an example project on an attachment. In this example I have 2 vertical rectangles which act as buttons:
1) the first button draws the rectangle step-by-step;
2) the second button cycles through 3 different styles:
2.1) line with 1 pixel, normal border rescale. This is the style at start;
2.2) no line;
2.3) line with 1 pixel, no border rescale.
The background is a checker texture, with 1 pixel per square. This gives you a perfect look on how the line is drawn.
The drawing instructions are executed on the yellow movieclip, which serves as reference, considering that it has the desired dimensions (180x22). *
If you zoom a couple of times you'll be able to see the problems I'm experiencing.
All you have to do is to click the first vertical button several times to draw the lines, to press the second vertical button to reset the draw and to change the border style, and finally to look at the draw with some zoom in, in order to see it in detail.
So, what can I do in order to draw a perfect rectangle, meaning that the border will not go outside the shape (it would be nice that when the border is rescaled, it does it inside the boundaries of the shape) and the rectangle has right dimensions (why am I missing one pixel in each direction?).
* By the way, is there a way to draw in a movieclip using the lineTo in such a way that the drawing is on the topside instead of the bottomside? I had to make the yellow rectangle partially transparent in order to see my drawing.
How would I draw a rectangle on the stage with 40% alpha? using bitmaps, bitmapdata, and copypixels?
View 2 RepliesI'm learning ActionScript 3.0 and I made a small app to draw rectangles on stage. Now I want to drag&drop them around. I want to be able to click on an object, without triggering the stage.addEventListener(MouseEvent.MOUSE_DOWN, clickEvent); but when I click on an object, it also triggers that event. How can I save the click on object from triggering that event on stage?
Here's the code:
Main.as
package {
import flash.display.Sprite;
import flash.events.*;
public class main extends Sprite {
var startX, startY, endX, endY: Number;
function main() {
[Code] .....
Is there a way to apply styling to the line of a rectangle that is drawn using AS3? So instead of the solid stroke, can I apply a dotted or a dashed one?
View 3 RepliesI 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 Repliesis it possible to draw a rectangle specifying which corners should be rounded and which not in a simple manner?
View 3 RepliesI try draw one pixel width rectangle in a sprite. And add some tween on it to make some effect. But I find use the code below can't create exactly one pixel white rect. I created I want to create
[Code]....
Draw rectangle with dashed border in flex ?
View 3 RepliesIs it possible to draw a rectangle dynamically using 'lineTo()' and have it fill with a gradient that is 100% alpha on one side and 0% on the other?
View 2 RepliesMy idea was to create a method for drawing rectangle with rounded corners, but while being able to specify which of the four corners (any, all, none,etc.) you wanted to round. The method below does the trick, but for some reason my corners don't match the same curves that I get using the same radius with drawRoundRect(). In other words, if I call my method (and set all four corners to be rounded) and compare that with the same call to drawRoundRect() the actual curves of the corners are slightly different.
HTML Code:
public function drawComplexRoundedRect(startX:int,startY:int,rectWidth:int,rectHeight:int,radius:int,canvas:Sprite,roundTopLeft:Boolean=false,roundTopRight:Boolean=false,roundBottomLeft:Boolean=false,roundBottomRight:Boolean=false):void{
if(roundTopLeft){
canvas.graphics.moveTo(startX,(startY+radius));
[Code] .....
Then compare
HTML Code:
var canvas:Sprite = new Sprite;
drawComplexRoundedRect(0,0,200,200,25,canvas,true,true,true,true);
with
HTML Code:
var canvas:Sprite = new Sprite;
canvas.drawRoundRect(0,0,200,200,25);
and you will see the two rectangles are not identical.
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 RepliesHere's my latest attempt at rendering a dynamic rectange (w/ width, height, border_width, border_color & background_color) I'm trying to render a dashed border, and can't seem to get the code right...
I've reworked my logic about five times, and can get the dashes to render right (almost) but the fill color disappears. It's rendered using actionscript. You can see the issues if you change the border width... Anyone mind taking a look to see what I'm doing wrong? It seems like the moveTo function isn't behaving right when I get to the end of each line.
[Code]...
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 RepliesI have the following code to create a Sprite with a rectangle in it:
container = new Sprite();
container.graphics.beginFill(0x00CCFF, .5);
container.graphics.lineStyle(1, 0x00CCFF);[code].......
The only thing is, I'd like the registration point to be in the middle (not the top left corner). Is there a way to set up the registration point in the middle of the rectangle, but still have the position of the rectangle be correct?
i.e. not moved over so that the top left corner of the rectangle is in the "middle" of where I want the rectangle to be...
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 RepliesI need to display a word, inside a ractangle with black background, passed to a flash movie through flashvars. Something like: And the rectangle itself should be right aligned to the right margin of the flash movie and 100px from top. I tried two options but in both cases I have problems with defining that different padding inside the rectangle: Option 1:
[Code]...
How do I get an html pop-up window by clicking a button on a Flash movie?Flash CS4 and Actionscript 3
View 1 Repliesam trying to make a script where the user can draw a rectangle on stage... where the size of the rectangle depends on where he leaves the mouse...as a theory i need to store the first mouse click x and y properties... then make an ENTER_FRAME so he can see what he is drawing... then whenever he leaves the mouse "MOUSE_UP" the rectangle remainsall tutorials i find on web are how to make a static rectangle.. what i wanna achieve is to make him see the different rectangles he can create
View 1 Repliesopening flash movie in new window on clicking link in a web page
View 1 RepliesI'm trying to implement a multiple file uploader and expose and API for javascript. Even though I think I can handle urlrequests, I'm having a hard time making a SimpleButton.I want the button to have the size of the movieclip/sprite that I create. I'm trying without luck to make a movieclip of 130px x 30px, and have a simple button that fills the entire area. What I try to do in actionscript:
private var _button:SimpleButton = new SimpleButton();
private var _fileList:FileReferenceList = new FileReferenceList();
private var _buttonShape:Shape;[code].......
I'm using intelij to compile this. how to build it with the SDK alone.