Actionscript 3 :: Drawing A Rectangle - The Border Is Partially Off-screen

Jan 10, 2011

I am drawing a rectangle at 0,0 with a line-style-thickness of 4px. It has height 100% and width 50%. The right-hand edge has a border 4px wide, but all 3 other sides are only 2px, suggesting the mid-point of the edge is classed as the border. Why isn't the edge drawn 'inside' the rectangle?

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Draw A Filled Rectangle With No Border?

Mar 25, 2006

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.

View 9 Replies

Actionscript :: Draw Rectangle With Dashed Border In Flex?

Mar 21, 2011

Draw rectangle with dashed border in flex ?

View 3 Replies

ActionScript 3.0 :: Change A Rectangle's Border Color On Hover?

Jun 7, 2010

how can I change or tween the color of a dynamic rectangle's borders ? (created with LineTo)I d'like the color to change when I hover the rectangle...Right now I 've always been to change the global color of the rectangle with it changes the color of the borders too.

View 1 Replies

ActionScript 3.0 :: Changing Border Color Of Rectangle On Mouseover

Oct 24, 2010

I have a rectangle and I want to change its border colour on mouse over, I have found a way to make it work but that redraws the whole rectangle, i am wandering is it possible to only manipulate border colour without redrawing rectangle?

PHP Code:
import flash.display.Sprite;var rect:Shape = new Shape();rect.graphics.lineStyle(3, uint("0x666633"));
rect.graphics.beginFill(uint("231f1c"), 1);
rect.graphics.drawRect(0 , 0 , 60 ,10 );
rect.graphics.endFill();
[Code] .....

View 1 Replies

ActionScript 2.0 :: Rendering A Dynamic Rectangle - Draw A Dashed Border?

Feb 1, 2004

Here'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]...

View 3 Replies

ActionScript 3.0 :: Drawing A Border Inside A Mc?

Mar 23, 2010

Flash draws borders centered on the edge of shapes. Is there an AS3 way to draw a border all inside a shape? I've got an image gallery and I'd like to create a rollover effect with a 4px border growing inside the thumbs. I can do it via timeline, but I'd like to do it via AS.

View 11 Replies

ActionScript 3.0 :: Drawing Border Around Arbitrary Shape?

Feb 12, 2009

Is it possible to draw a border around an arbitrary Shape (or Sprite) dynamically with ActionScript? From the IDE is really easy, just select the line color and click the Shape with the paint tool (S).

View 3 Replies

ActionScript 2.0 :: Dynamic Border Drawing Code?

May 2, 2006

Anyone know if there is some actionscript that could draw a border around a movieclip?

View 3 Replies

ActionScript 3.0 :: Drawing Sprite Border For Xml Driven MCs?

May 22, 2009

I'm having an issue trying to automatically create a Sprite border for movieclips generated by an xml file.

Here is my loop function :

Code:
function callThumbs():void {
for (var i:Number = 0; i < my_total; i++) {
var thumb_url = my_images[i].@THUMB;

[Code]....

All the pictures from the xml file do load, they all have the glowfilter effect but only the first one has border..

View 2 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 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 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

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

ActionScript 2.0 :: Loading JPG Images Into Movie Clips, Then Drawing A Border Around Them?

Aug 26, 2009

i am loading JPG images into movie clips, then drawing a border around them with this code:

Code:
var frameColor:Number = 0xffffff;
var lineThick:Number = 1;[code]..............

i am resizing the movieclips (and thus the contained pictures) down to 160 x 120, but those pixel values didn't work in my lineTo statements. i multiplied them by 3, using 480 and 360 and it works better. however, the behavior isn't consistent. i am attaching a picture so you can see how the border is too tall on some of the images.so, is there a better way to use pixel dimensions with lineTo? does the scaling factor between flash vector units and pixels change between movieclips depending on what content i load into the movie clip?

View 1 Replies

ActionScript 3.0 :: Determine Which Of The Rectangle's 4 Sides The Line Is Drawing Out Of?

Sep 7, 2009

I have a line within a rectangle.The line can draw outwards 360 degrees.I need to determine which of the rectangle's 4 sides the line is drawing out of.

View 1 Replies

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 :: Rectangle / Trapezium - Drawing Bitmap Data Into Shape

Aug 8, 2011

If I draw a rectangle or trapezium, how might I go about drawing bitmap data into that shape? I need to give a slight perspective to a loaded photo. Native 3D rotations seem to leave the bitmap really blurry, and a full 3D engine is too heavy for this project.

View 3 Replies

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

ActionScript 3.0 :: Full Screen Flash Bg Image No Border?

Oct 13, 2009

I have a simple full screen flash site with mc's that are positioned in relation to the stage, and I also have a background image that is bigger than the stage that shrinks and expands when the user resizes the browser, and it doesn't distort.My problem is that when i publish it normally at 100% width/100% height I get a weird acting vertical scrollbars, so I'm forced to publish it at 98% height, which then shrinks my swf file exposing the black background giving my freaking swf an unwanted black border.

View 1 Replies

Flash :: Flex Full Screen Scaling Remove Border?

Mar 30, 2012

I'm writing a standalone windows AIR app and using

contextView.stage.align = StageAlign.TOP;
contextView.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
contextView.stage.scaleMode = StageScaleMode.SHOW_ALL;

Which will scale my app to full screen and show the entire app with no cropping, however may leave borders on the left and right. Which it does I'm wondering if there is a way to remove or at least set the color of those borders, they are currently white. Its a big wide 2" section on the left only in my case.

So I found out how to change the color of it, by doing a backgroundColor="#f3f3f3" on

See attached image below

View 1 Replies

ActionScript 3.0 :: Border In Part Of Screen That When Objects Inside Hit It They Cannot Pass

Jan 24, 2011

How can I make a border in a part of the screen that when objects inside hit it they cannot pass it. for example like flash games have with bubbles that cannot pass the screen border and they just travel in the screen's space.Is it possible to make this with box2d. I haven't worked with this framework.

View 4 Replies

ActionScript 3.0 :: Rectangle Follow Curssor Splash Screen?

Dec 14, 2011

how i can make script like this:splash screen in fullwindow rectangle follow cursor to choose language

View 0 Replies

ActionScript 2.0 :: Make Images Scroll At The Top Of The Screen In That Rectangle Box

May 11, 2005

how i can make a mask so that i can make images scroll at the top of the screen in that rectangle box and the arrows on the left and right scroll the images from side to side.

View 4 Replies







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