In my previous Flash post, I already touched on the subject of a major reason why you might still prefer the expensive Adobe Flash IDE over FlashDevelop: it’s the integrated vector editor. Vector graphics give you the major advantage of begin scalable with little to no quality loss. Try to print out any graphic you see on the web and you will notice it’s blocky. Not so with vector based graphics. They are inherently easily scalable, in both directions, smaller and bigger.
Most of what you create in the Adobe Flash IDE, are vector graphics. Using bitmaps is not really encouraged, and with reason. If you looked closely at the two applets in the previous post, you might have noticed that the quality of the crosshair picture in the last one is not very good. That’s because it is based on a bitmap. The circle one however, looks perfect.
So if FlashDevelop doesn’t let you create vector graphics, how are you going to do it? It’s easy: use the previously mentioned Inkscape. It lets you create SVG graphics, Scalable Vector Graphics. Like this one. This is the bitmap representation (most browsers don’t natively support the format):
Ones you got the SVG file, it’s really easy to embed it. Put it in the library directory and use the same type of embed code as you would do for bitmaps. Then change the type of the embedded object from Bitmap to Sprite. That’s it, you’re done. You should have this piece of code:
That’s all dandy, but there are a few issues to keep in mind:
For some reason, it’s impossible in FlashDevelop to right click on your SVG and “add to library”. So you can’t double click to insert the embed tags automatically. But if you type it by hand, it works perfectly.
It appears that the gradient functionality is not working as it should. If you look at the bitmap, or open the SVG in Inkscape, you’ll see that I have added a gradient, but it does not show in Flash. I’ll have to look into that one day.
I would suggest that you change the document size in Inkscape to be as small as possible. Either that, or put object in top left corner. This will make sure that object is correctly positioned when you load it in your Flash applet.
To finish, here’s a 400% zoomed image of the same star, once as PNG and once SVG:
You’ll see that the right image has a smooth edge, with properly applied anti-aliasing. The little bit of anti-aliasing you see on the left image, was created by Inkscape when I exported the bitmap. This effect might not be very profound for this little example, but if you are going to be zooming and rotating image a lot in your Flash applet, it will make a huge difference.
I know this is an old thread, but I tried the right click magic in FlashDevelop and nothing happened, so for a second I thought it's not possible to embed svg resources. I did some tests with Inkscape and besides the gradients I also have found transparency a bit problematic: some transparent objects are rendered as bitmaps and while most objects resize well, those end up jaggy.
I'm not sure why the right clicking stopped working, I'll have to look into that. In the meantime, I suppose manually writing the embed tag will work, although it can be a bit tricky.
As far as the comparison pictures are concerned, in hindsight, I must admit that it isn't the best comparison available and didn't really turn out the way I wanted it to. I did a 400% zoom in a bitmap editor of 2 screenshots to show how both were handled differently (one has nice anti-aliasing, the other doesn't). I think I'll make a little Flash applet to show the difference. That will be much clearer.
How to use vector graphics in FlashDevelop – SVG in Flash
In my previous Flash post, I already touched on the subject of a major reason why you might still prefer the expensive Adobe Flash IDE over FlashDevelop: it’s the integrated vector editor. Vector graphics give you the major advantage of begin scalable with little to no quality loss. Try to print out any graphic you see on the web and you will notice it’s blocky. Not so with vector based graphics. They are inherently easily scalable, in both directions, smaller and bigger.
Most of what you create in the Adobe Flash IDE, are vector graphics. Using bitmaps is not really encouraged, and with reason. If you looked closely at the two applets in the previous post, you might have noticed that the quality of the crosshair picture in the last one is not very good. That’s because it is based on a bitmap. The circle one however, looks perfect.
So if FlashDevelop doesn’t let you create vector graphics, how are you going to do it? It’s easy: use the previously mentioned Inkscape. It lets you create SVG graphics, Scalable Vector Graphics. Like this one. This is the bitmap representation (most browsers don’t natively support the format):
Ones you got the SVG file, it’s really easy to embed it. Put it in the library directory and use the same type of embed code as you would do for bitmaps. Then change the type of the embedded object from Bitmap to Sprite. That’s it, you’re done. You should have this piece of code:
And compiled, this is what it looks like:
That’s all dandy, but there are a few issues to keep in mind:
To finish, here’s a 400% zoomed image of the same star, once as PNG and once SVG:
You’ll see that the right image has a smooth edge, with properly applied anti-aliasing. The little bit of anti-aliasing you see on the left image, was created by Inkscape when I exported the bitmap. This effect might not be very profound for this little example, but if you are going to be zooming and rotating image a lot in your Flash applet, it will make a huge difference.