blog
Flash / Flex ArchiveJozef Chúťka's blog — blog.yoz.sk/category/flash-flex/page/5/
July 2, 2010
drawing images onBoard paint spray
onBoard 2.0 – Massive Collaborative Painting & Drawing

onBoard is a Collaborative (multi-user) painting and drawing application created in flash and php. Anyone can paint, draw, insert images and see other users paint live (feature comming soon). It has been 9 month since I released version 1.0, now there is a new version. A lot of things is changed in 2.0. The most important is UI change, this is my approach to write my first touch-device-ready flash app. I have also rewriten the whole app to pure ActionScript 3.0 (no flex framework used anymore), in order to gain crucial improvements in speed and weight. Every piece of code is optimized for speed. After all the changes, I have been able to keep fps at the rate of 30 in full hd fullscreen resolution (tested in flash debug player v 10.0), with memory consumption only around 30Mb (most of it is bitmapData).
June 30, 2010
Quick Tip: Chrome & Flash Debug Player
Having issues with installing latest debug player into Chrome? Go to about:plugins, deactivate the bundled Shockwave Flash (path ends with … Chrome\Application\5.0.375.86\gcswf32.dll) and install the desired flash player version.
I did not know why did my Flash Builder suddenly stopped communicating with flash debugger yesterday (June 30, 2010), today I have discovered latest news from Google Chrome.
June 29, 2010
Quick Tip: uint To 6 Digit RGB Hex
Shortest possible, simple / no looping method of getting hex string from color is:
var color:uint = 0x00ff00;
var hex:String = color.toString(16);
trace("00000".substr(0, 6 - hex.length) + hex);
// output 00ff00
trace("#00000".substr(0, 7 - hex.length) + hex);
// output #00ff00June 28, 2010
anaglyphs cyan depth map matrixes pixel bender red
Anaglyphs With Pixel Bender & Depth Map

Pixel Bender and displacement maps were so much fun to develop that my next experiment led me to create some more advanced effects. Do you know anaglyphs? Anaglyph images are used to provide a stereoscopic 3D effect, when viewed with 2 color glasses. There are multiple types of glasses (colors), but the most comon is red-cyan combination. So, I have created this simple pixel bender kernel that makes anaglyph images based on original image and its depth map (just like those used in displacement maps)
June 24, 2010
flash builder Flex Builder upgrade
Switching Flex Builder To Flash Builder Issues

Finally I managed to switch from Flex Builder 3 to Flash Builder. Altought, most of the workspaces, projects and casual things were running after switch just fine, there were some issues that made me mad. Some of them I was able to fix, some keep fuss me. I decided to write this post so it may help someone with dealing the same issues…
June 22, 2010
callback Callbacks Facebook facebook api FacebookOAuthGraph
Extending FacebookOAuthGraph Class

While The Facebook Graph API article becomes pretty popular and a lot of developers keep asking me to publish some practices I use, I managed to create this blog post. Here is a list o some functions you may want to extend FacebookOAuthGraph Class with.
June 17, 2010
Quick tip: Fastest ActionScript PNGEncoder
Here are some benchmark tests for current available PNGEncoders. Sync encoding tested on 2 real bitmap images (500x300px, 256x256px) on Intel Core 2 Duo @ 2.80GHz, win XP:
encoder / image 500x333 px 256x256 px
by.blooddy.crypto.image.PNG24Encoder 78ms 125ms
dsk.PNGEncoder 140ms 141ms
net.kaourantin.PNGEnc 188ms 187ms
mx.graphics.codec.PNGEncoder 203ms 172ms
com.adobe.images.PNGEncoder 219ms 172ms
org.aswing.image.png.AsPngEncoder 234ms 172ms
ru.inspirit.encoders.png.PNGEncoder 391ms 203msby.blooddy.crypto.image.PNG24Encoder worked fastest for me.
June 17, 2010
Quick tip: Ports Required For RTMFP
In order to be able to use P2P communication within flash apps, you need to have opened UDP ports in range 1024..65535. First, to connect stratus server, you need UDP ports 1935 and 10000..10100, then the communication between peers (Flash Players and AIR) goes through random UDP port in range 1024..65535. In detail:
UDP port 1935 and ports 10000+ are used by the Stratus servers. the UDP ports used on client computers could be any port from 1024..65535. in order to just connect to the Stratus servers, you must be able to send and receive UDP packets with any UDP port on your client computer (source port for outgoing, destination port for incoming) and port 1935 and ports 10000+ on the Stratus server computers (destination port for outgoing, source port for incoming). *just* connecting to Stratus isn’t useful, though, since all it can do is help you to connect directly to other clients running Flash Player or AIR. other client computers, just like your client computer, will be using a random UDP port in the range 1024..65535. therefore, in order to communicate P2P with other client computers using RTMFP, you must do one of the two following things: 1) allow all UDP with a source or destination port from 1024..65535. 2) have a “stateful firewall” that allows bidirectional UDP connections to and from any UDP ports in the range 1024 through 65535 inclusive as long as a first packet is sent outbound through the firewall. this is commonly called “allowing outbound UDP”. sending the first packet outbound through your firewall to allow return packets is commonly called “UDP hole punching”. searching on these terms should give you more information. in general, a firewall that blocks UDP will block RTMFP communication.
Read more about PORT NUMBER of RTMFP.
June 11, 2010
buffer Callbacks event execute store
Callbacks Class To Store Your Wishes In Time

Things are much easier when they works synchronously, you just ask for what you want and thats it, but with flash you always have to count on with asynchrony. For example you are waiting on some requests to complete or 3rd party to log you on etc. The issue is, you know you want to execute something, with custom properties, but you have to do that just after some asynchronous event dispatched. E.g. you want to update status with some message, but you need to connect to facebook first. Here comes the handy Callbacks class. What it does is, it stores your wishes and executes when things are prepared.
June 10, 2010
hitTestPoint localToGlobal Point
Quick tip: always use global position for hitTestPoint()
Just for the record and myself (I should read all the documentation, also the long sentences :-) … Make sure you always check hitTestPoint() against global coordinates of some point.
// we are somewhere deep in myObject.myObject2.myInnerObject
var point:Point;
var someMovingObject:DisplayObject;
var hitShape:DisplayObject;
point = localToGlobal(new Point(someMovingObject.x, someMovingObject.y));
point = someMovingObject.localToGlobal(new Point());
// both give us same results,
// 2nd method is faster in loops while it can use predefined zero point
hitShape.hitTestPoint(point.x, point.y, true);Even hitShape object is not directly on a stage (but on myInnerObject), you have to use global points for testing hits.