blog
2010 July Archive at Jozef Chúťka's blog
July 29, 2010
connection NetConnection NetGroup NetStream port RTMFP
RTMFP Connection Tester
Having problems connecting RTMFP? Use this application to test NetConnection, NetStream, NetGroup connection and publishing status. For success connection, opened UDP ports in range 1024..65535 required. Run two instances to test NetGroup neighboring.
July 28, 2010
NetConnection NetGroup NetStream post send UNIPacket UNIPacketHeader
UNIPacket – Standardize NetGroup, NetStream Raw Messages

UNIPacket and UNIPacketHeader classes is my attempt to standardize communication within NetStream and NetGroup communication. While both Net* classes enables you to send any raw data between two instances of flash, you should carefully handle incomming messages. Imagine you are willing to send additional info with your message (sender, id etc.). That is where UNIPacket classes comes into scene, both are very simple and able to selfcreate from incomming object.
UNIPacket contains only two variables: header:UNIPacketHeader and data:* (holds the actual data being sent).
UNIPacketHeader is dynamic class with prepared variables: id:uint (numeric identificator of message), hash:String (string identificator of message), sender:String (use for sender identification).
July 27, 2010
click getSize MouseEvent select SelectableButton SimpleButton toggle
Quick Tip: SimpleButton to SelectableButton
sk.yoz.ui.SelectableButton class may be handy for you if you decided to drop framework and make your own lightweight components. It extends SimpleButton (basic ActionScript 3 component) and ads selected state and toggle functionality by switching states on click event. You may want to extend it for selectedUpState, selectedOverState, selectedDownState, feel free to do that.
usage:
import sk.yoz.ui.SelectableButton;
// any graphics here
var upState:DisplayObject;
var overState:DisplayObject;
var downState:DisplayObject
var hitTestState:DisplayObject;
// changes selected state on mouse click
var toggle:Boolean = true;
var button:SelectableButton;
button = SelectableButton(upState, overState, downState, hitTestState, toggle);
// toggle select button without user interaction
button.selected = true;July 26, 2010
broadcast channel conferences live Microphone onStream P2P webcamera
onStream – The Broadcasting Machine

onStream – The Broadcasting Machine is the name of my latest flash project. Slogan says: “Broadcast LIVE video to your friends or the whole world from a computer or mobile. Watch other people broadcasting their webcamera, conferences, shows or movies.” With this flash application you can broadcast your webcamera, tv card, desktop or movies (read the section “What can be broadcasted?”). With different broadcasting settings you can broadcast to unlimited number of viewers as well as make private videochats. Based on your connection speed, choose appropriate quality for your broadcasts from 320×160 px webcamera resolution with 11kHz sound sampling up to high definition broadcasts.
The application is located on http://onstream.yoz.sk and there also exist a facebook application http://apps.facebook.com/onstream/. You can also publish and run the application from facebook newsfeed stream.
July 21, 2010
Neverending Facebook API changes
Believe it or not, facebook changed part of its api again. Since today, authorizing for iframe applications does not work the same way it used to. Previously it was enough to redirect:
https://graph.facebook.com/oauth/authorize
?client_id=268718683475
&redirect_uri=http://apps.facebook.com/blogoauthgraph/
&scope=publish_stream,user_photos,user_photo_video_tags… where facebook authorized your app and redirects back to the:
http://apps.facebook.com/blogoauthgraph/
?session=123456...… where session was valid access_token.
July 19, 2010
attachAudio attachCamera Camera Microphone NetConnection NetGroup NetStatusEvent NetStream
Quick Tip: Working with NetStream
While working on my brand new P2P project I have come to some issues and solutions, that may help you with your projects. First thing, the NetStatusEvent codes. You may expect that codes are dispatched by the instance of the class they beigins with (e.g. “NetStream.Connect.Success” dispatched by NetStream), but in fact, this does not happen (“NetStream.Connect.Success” is dispatched by NetConnection). I bellieve its not a bug but a feature by flash player developer team. To make this work as expected you may do the following:
netConnection.addEventListener(type, onNetStatus);
function onNetConnectionNetStatus(event:NetStatusEvent):void
{
switch(event.info.code){
case "NetStream.Connect.Success":
event.info.stream.dispatchEvent(event);
break;
...
}
}July 12, 2010
Unable to Embed Font When Targeting Flash Player 10.1
I am just so stuck on this one. Is anyone able to embed font and use it in TextField when targeting Flash player 10.1 using flex 4.1 SDK? My code is very simple:
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFormat;
public class Test1 extends Sprite
{
[Embed(source="arial.ttf", fontName="Arial", mimeType='application/x-font')]
public static const FONT_ARIAL:Class;
public function Test1()
{
var tf:TextField = new TextField();
tf.text = "Hallo";
tf.embedFonts = true;
tf.defaultTextFormat = new TextFormat("Arial", 10);
addChild(tf);
}
}
}font file (.ttf) can be downloaded here. When I try to export the movie I see nothing but white. Actualy it seems like no matter what sdk nor flash player version I target, it still does not render text 🙁 what is going on flashplayer?
Mistery solved!, you have to set defaultTextFormat before text. Credits goes to Martin.
Where to go from here:
Loading Fonts at Runtime with latest Flex 4 SDK
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).