Tiago's Weblog Code & Technology Aficionado – Come for the Flash, stay for more!

2Dec/092

Zinc – Saving images

It was obvious that I had to write a few more lines about Zinc in the near future, but somehow this topic didn't leave me alone at all, and no, I'm not writing about Zinc because I like it, I'm writing this because I don't want that other people fall into the traps I fell while using it. Do I like Zinc? Yes & No, it's a very weird situation, it's useful, it would be even more useful if they would do their job right, but I already wrote about it here. So let's leave this discussion out of here.

So let's begin from the ground up, your goal is to resize and save the newly resized files back again into a jpeg. Sounds easy?
It should be but it isn't!!

First of all I have to tell you that I began my project with Zinc 3.0 which supports bytearrays, it was really cool to work with it, as I was able to use the JPEGEncoder class that anyway writes bytearrays.

Tagged as: , Continue reading
24Aug/092

AS3 – textfield setSelection()

Have you tried to set selection on atextfield after a validation procedure? Have you noticed that it doesn't work quite right? Here's the quick solution for that:

Normally you would use the yourTextField.setSelection(startIndex, endIndex); method, but like I said before that doesn't really work very well.

You just need to set the focus to the textfield and then set the selection:

Example: (assuming you have a textfield called "tf")

....
tf.stage.focus = tf;
tf.setSelection(0, tf.length);
...

And that's how you solve the textfield.setSelection() problem

Tagged as: 2 Comments