Others Archive

Using lineStyle to draw stroke without affecting the size of the holder container

Have you ever tried to use the graphics class to draw a rectangle with a lineStyle (stroke) and then set bigger width and height values for the container that holds the graphic? If so, you probably noticed that there is a size difference between a rectangle with lineStyle and a rectangle without lineStyle.

If you trace the width and height values of the container, everything seems to be fine. Only if you run and look at the SWF you’ll notice a visual difference between those two (Image below)

ActionScript Code:

import flash.display.Sprite;

var rectangle:Sprite = new Sprite();
var rectangleLineStyle:Sprite = new Sprite();

with(rectangle)
{
	graphics.beginFill(0x333333);
	graphics.drawRect(0,0,50,50);
	graphics.endFill();
}

with(rectangleLineStyle)
{
	graphics.beginFill(0xd5e7ed);
	graphics.lineStyle(3, 0xff0000, 1, false, LineScaleMode.NONE);
	graphics.drawRect(0,0,50,50);
	graphics.endFill();
}

addChild(rectangle);
addChild(rectangleLineStyle);

rectangle.width = rectangle.height = 200;
rectangleLineStyle.width = rectangleLineStyle.height = 200;

Both rectangles have the same width and height. Notice how the one with lineStyle is much smaller?

I’m not sure what the problem is, but there seems to be a fix (kind of).

Through some trial and error I found that if you use CapsStyle.ROUND and JointStyle.MITER like so, the problem disappears:

graphics.lineStyle(3, 0xff0000, 1, false,  LineScaleMode.NONE,
					   CapsStyle.ROUND,
					   JointStyle.MITER);

However, it’s not perfect. If you have a much smaller rectangle, let’s say you create:
drawRect(0,0,10,10);
Instead of:
drawRect(0,0,50,50);
Then you will still notice a bit of a difference.

If you want to make a rectangle with lineStyle that can be scaled and you want to get rid of this problem completely, an easy fix wold be make the rectangle bigger and scale it down instead of making it smaller and scale it up. In this scenario, the visual rectangle seems to maintain the real width and height values.

Photos from Abobe Flex Camp Timisoara, Romania

Yesterday I was in Timisoara attending to a conference hosted by Adobe Romania. I saw a lot of great things and some interesting projects done by romanian developers. Here I have uploaded some pictures from this event ;)

After this event we (Me, Costi, Biro and his girlfriend) got out for a walk in Timisoara so we can make see the city and take some pictures. Thank you Biro for being our guide! ;)

The best TED ever – Lennart Green: Close-up card magic

This is a very funny episode and one of the best TED episodes I’ve seen :D

The bags

I found this somewhere on tumblr, it was a gif animation. This is a very interesting idea. I really love it. But it seems to work better with this mouse over effect :D

Caught In The Act

This video made me lough so hard!! :lol:

Tree

I’m starting to like this type of animation/photography
I did this one in the NetBridge team building last weekend.

New flickr slideshow

The new flickr flash slideshow dose have an embedding feature… it’s great because you can easily place your flickr images on your blog/website and you can view them in full screen as well :D
Here are some of my images:

New flash forum

Last week I started a Romanian Flash forum with some friends and now I believe it’s ready to grow and get bigger because there are some Flash lovers here in Romania.
If you are from Romania or if you speak the language and you love Flash, please join us ;)

Video on Flickr

I just found out that you can upload videos to flickr if you have a pro account…
A lot of people said it’s a bad idea and that they don’t want video on flickr, but if you ask me, it’s a very great idea ;)
The only problem is that you have a 90 seconds limit or 150 MB :D

Here you have a video example done by me at Graffiti demo in Onesti, Romania:

Links Menu System

This is a XML based links menu system that I used in some projects of mine. You can easily add links or category titles to the list.

xml based links system

You can download the source files from here