blog
2009 October Archive at Jozef Chúťka's blog
October 30, 2009
Best online photo editing and painting tools
Flash player offers so much today, that you are able to create online tools with same functionality as desktop software. For example in drawing / painting / photo editing category there already are free online tools like Photoshop. You do not need to download and install gigabytes and pay expensive software just to make your album photos look better or to create a better background for your website…
If you are looking for simpler drawing tools check this list.
October 29, 2009
bug debug player firewall Flex mm.cfg port PreloadSwf profiler web browser
Flex 3 profiling not working (update)
The profiler is a part of the Flex Builder IDE, that listens for messages from the profiler agent. The profiler agent is a swf launched in parallel to your main swf. It is located in your Flex workspace at .metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf. Your IDE gets this agent to start by editing your mm.cfg and adding a “PreloadSwf” line. The agent uses the flash.sampler.* API to gather data on your main swf, and sends it to the IDE using TCP on a preconvened port. This port is 9999 by default, you can change it in Preferences/Flex/Profiler/Connections.
If you can not get your profiler working, there are few methods you should try:
close all other tabs
install debug player
change browser
change port
disable firewall / antivirus
define PreloadSwf path
localhost / 127.0.0.1
allocate console
ultimate methods (what worked for me)
October 27, 2009
Bindable binding commitProperties event invalidateProperties PROPERTY_CHANGE PropertyChangeEvent
Quick tip: invalidating properties on bindables changed
By default, flex bindable properties fires event PropertyChangeEvent.PROPERTY_CHANGE. Sure, those events can be listened thus you can play with them. This can be useful when you have a lot of bindable properties in your classes and you do not want to make getter and setter for each just to be able to catch the moment of update:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal"
creationComplete="creationCompleteHandler()">
<mx:Script>
<![CDATA[
import mx.events.PropertyChangeEvent;
[Bindable] private var bVar:uint = 0;
[Bindable] private var btnLabel:String = "";
private function creationCompleteHandler():void
{
addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, propertyChangedHandler);
}
private function propertyChangedHandler(event:PropertyChangeEvent):void
{
if(event.property == "bVar")
invalidateProperties();
}
override protected function commitProperties():void
{
super.commitProperties();
btnLabel = bVar.toString();
}
]]>
</mx:Script>
<mx:Button click="bVar++" label="{btnLabel}"/>
</mx:Application>
October 27, 2009
ActionScript asset Class css embed image mxml
Quick tip: embedding in Flex
In Flex application, you can embed your assets into 3 places: ActionScript, MXML, CSS. To embed into ActionScript use following syntax:
[Embed(source="assets/image.png")]
public var imageClass:Class;
[Embed(source="assets/library.swf", symbol="symbol1")]
public var symbol1Class:Class;
// flash library symbol alternative
[Embed(source="assets/library.swf#symbol2")]
public var symbol2Class:Class;
To embed into MXML use:
<mx:Image source="@Embed('assets/image.png')"/>
<mx:Image source="@Embed('assets/library.swf', symbol='symbol1')"/>
<mx:Image source="@Embed('assets/library.swf#symbol2')"/>
<mx:Button skin="{null}"/>
To embed asset into CSS file use syntax:
Button
{
upSkin: Embed(source="assets/image.png");
overSkin: Embed(source="assets/library.swf", symbol="symbol1");
downSkin: Embed(source="assets/library.swf#symbol2");
selectedUpSkin:ClassReference(null);
}
@font-face
{
font-family: Copacetix;
src: url("assets/copacetix.ttf");
unicode-range:
U+0020-U+0040, /* Punctuation, Numbers */
U+0041-U+005A, /* Upper-Case A-Z */
U+005B-U+0060, /* Punctuation and Symbols */
U+0061-U+007A, /* Lower-Case a-z */
U+007B-U+007E; /* Punctuation and Symbols */
}
Embedding font to .as (.mxml):
[Embed(source="../arial.ttf", fontFamily="myArial")]
public static const FONT_ARIAL:Class;
public static const FONT_ARIAL_NAME:String = "myArial";
[Embed(source="../fonts.swf", fontName="myCourier", fontWeight="bold|normal") ]
public static const FONT_COURIER:Class;
Font.registerFont(FONT_COURIER);
public function Test()
{
var format:TextFormat = new TextFormat();
format.font = FONT_ARIAL_NAME;
var tf:TextField = new TextField();
tf.embedFonts = true;
tf.defaultTextFormat = format;
}Read more about embedding assets into ActionScript best practices here. Read basics about embedding here.
October 26, 2009
ApplicationDomain Class Error IFlexDisplayObject Loader LoaderContext URLRequest
Flex Error #1034: Type Coercion Failed: Cannot Convert *** to mx.core.IFlexDisplayObject
When you keep getting:
Flex Error #1034: Type Coercion Failed: Cannot Convert *** to mx.core.IFlexDisplayObject… after using getDefinition() method, in my case:
// url = "../some.swf"
var request:URLRequest = new URLRequest(url);
var context:LoaderContext = new LoaderContext();
context.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, assetsComplete);
loader.load(request, context);
...
// assetsComplete()
var applicationDomain:ApplicationDomain = assetsLoader.contentLoaderInfo.applicationDomain;
var assetsClass:Class = applicationDomain.getDefinition("Assets") as Class;
...
The problem is, in fact, the security not coercion! Try move your .swf (the one that is beeing loaded) into the same directory where master .swf file is located.
October 24, 2009
ActionScript as3crypto BigDecimal BigInteger bit shifting Facebook facebook api FacebookUtils GetPhoto MathContext
Facebook profile album aid
In search of best practice to get your facebook default profile (archive) album I came to the official facebook api wiki page. It states there that it is possible to calculate aid (album id) from your uid (user id) by simple formula:
(uid << 32) + (-3 & 0xFFFFFFFF)Well, it may seem simple, but notice 32 bit left shifting in first part! By this operation on uid, you go far beyond integer max value and flash will not give you correct results. So how to do that?
October 23, 2009
code embed EmbedCode generate html object
EmbedCode class to generate html code

EmbedCode class generates html code for your .swf files. You can define url, size, parameters, flashVars and the result is valid standard (<object>, <params>, <embed>) html code, that you can just copy paste into your htmls, blogs, gigya widgets etc.
Application
October 22, 2009
core crash Flash Media Server master
Flash Media Server: Core is no longer active (update)
In a past few weeks I have been working on a middle sized flash project. While its nature is in multi user communication and it was crucial to do that with low latency, our first choice was of course Flash Media Server. I spent few days by programming server side (fms) and few days on optimizing its performance and debugging and finally it was fast enough to get staged live. Server side was just about calling client methods (client -> fms -> client) and some SharedObjects, but no video nor audio streaming was used. My company dedicated super fast server (4 x quadcore Intel(R) Xeon(R) CPU E7440 @ 2.40GHz, 32 GB ram) just for Flash Media Server so we were able to run it on 16 cores. We installed fms v.3.0.1 r123 with valid unlimited licence on it. And went live.
First, we tried default fms configuration and soon after start master.log (and all other logs) started to grow up. The main content of the log was:
2009-10-07 00:03:31 24962 (i)2581223 Core (8684) is no longer active. -
2009-10-07 00:03:31 24962 (w)2581256 Core (8684) _defaultRoot_:_defaultVHost_:::_1 experienced 1 failure[s]! -
2009-10-07 00:03:31 24962 (i)2581221 Core (10772) started, arguments : -adaptor "_defaultRoot_" -vhost "_defaultVHost_" -app -inst -tag "_1" -conf "./conf/Server.xml" -name "_defaultRoot_:_defaultVHost_:::_1". -
October 21, 2009
BPMN diagrams graphs online scheme UML
Online Diagrams Competitors (update)

Online diagrams are nifty little Flash applications that allows users to create and share flowcharts and design diagrams. It is easy to use, and has a number of templates and elements to choose from. Some of them also allows online collaborations and can be used as replace for Visio, that is definitely a cost-effective alternative. The most popular ones are:
gliffy.com – Diagram Software for the rest of us!
lovelycharts.com – Free online diagram software
creately.com – Online Diagramming & Design
Update (Feb 12, 2010): hotgloo.com – The Online Wireframe Application
Update (Nov 17, 2010): lucidchart.com – Online Diagram & Flowchart Software, Collaboration Tool
yuml.me – Diagrams in your blogs
October 20, 2009
embed mp3 music share SoundCloud
SoundCloud – We Move Music
SoundCloud lets you move music fast & easy. The platform takes the daily hassle out of receiving, sending & distributing music for artists, record labels & other music professionals. (SoundCloud)
IMHO very perspective and powerful tool for sharing and embedding music, but the webpage should react faster in some cases. I hope it is just a temporary issue…