Blog.

Welcome to my blog.
This is the place where I share my thoughts,
sometimes in English and sometimes in Czech.
Feel free to comment, I love to read comments!

Weekly Digest for June 6th

Weekly Digest for May 30th

Weekly Digest for May 23rd

Weekly Digest for May 16th

Weekly Digest for May 9th

Dummy Tween Plugin

A somewhat different approach to periodical calling of a method. This time with TweenLite/TweenMax by Greensock

As I said before, last few months I’ve been working for Falanxia.com, where I help to develop social games in Flash (and more platforms coming). I was not very happy with the way how to periodically call a method:

var timer:Timer = new Timer(10, 100); // call a method 100 times with 10 ms delay)
timer.addEventListener(TimerEvent.TIMER, method);
timer.start();

Is there a shorter approach to do the same thing? While we already use TweenLite/TweenMax a lot, I thought there has to be a plugin which should handle this task (no, I don’t need TweenLite.delayedCall(). Well, nope, there’s not. But sure it can be handled this way:

var tweenObj:Object = {pass:0};
TweenLite.to(tweenObj, 1, {ease:Liner.easeNone, onUpdate:method}); // 100 * 10 ms = 1 second

IMHO this way is a bit cumbersome and you need to create an Object to be tweened. I came up with a simple TweenLite plugin to do the job:

/*
 * Falanxia Utilitaris.
 *
 * Copyright (c) 2010 Falanxia (http://falanxia.com)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.falanxia.utilitaris.plugins {
    import com.greensock.*;
    import com.greensock.plugins.*;



    /**
     * Dummy tween plugin.
     *
     * @author Vaclav Vancura @ Falanxia a.s. vaclav@falanxia.com
     * @author Falanxia (falanxia.com, @falanxia)
     * @since 1.0
     */
    public class DummyTweenPlugin extends TweenPlugin {


        public static const API:Number = 1.0;

        protected var _target:Object;



        /**
         * Constructor.
         */
        public function DummyTweenPlugin() {
            super();
            this.propName = "dummy";
            this.overwriteProps = ["dummy"];
        }



        /**
         * Tween initialization.
         * Gets called when any tween of the special property begins. Store any initial values
         * and/or variables that will be used in the "changeFactor" setter when this method runs.
         * @param target Target object of the TweenLite instance using this plugin
         * @param value The value that is passed in through the special property in the tween.
         * @param tween The TweenLite or TweenMax instance using this plugin.
         * @return If the initialization failed, it returns false. Otherwise true. It may fail if, for example, the plugin requires that the target be a DisplayObject or has some other unmet criteria in which case the plugin is skipped and a normal property tween is used inside TweenLite
         */
        override public function onInitTween(target:Object, value:*, tween:TweenLite):Boolean {
            return true;
        }
    }
}

How to use it?

TweenPlugin.activate([DummyTweenPlugin]); // first you need to activate the plugin, but only once in the whole app
TweenLite.to(this, 1.0, {dummy:{}, onUpdate:method});

This way there’s no need to create an Object variable. I think it’s a bit simpler. Actually this article took much more time to write than to code the DummyTweenPlugin.

Weekly Digest for May 2nd

delicious (feed #3)
Shared 34 links.
twitter (feed #2)
How many people ever lived #infographics. Nuts. http://bit.ly/4tLWrR [vancura]
vimeo (feed #4)
twitter (feed #2)
Homebrew scanner captures 2.5D photos: http://j.mp/amR0Oe (via @petapixel, @Coleran) -> @jimmac, @imagiag [vancura]
delicious (feed #3)
Shared 32 links.
twitter (feed #2)
Transmit 4.0: http://✪df.ws/f57 (via @daringfireball) [vancura]
twitter (feed #2)
HP Buying Palm for $1.2 Billion – http://bit.ly/bOB8us (via @gizmodo) [vancura]
lastfm (feed #6)
delicious (feed #3)
Shared 44 links.
delicious (feed #3)
Shared 2 links.

Weekly Digest for April 25th

twitter (feed #2)
Adobe Flash Player 10.1 RC2 LIVE!!!! http://bit.ly/U5Jvy #FlashPlayer (via @mencio, @thibault_imbert) [vancura]
twitter (feed #2)
Photograph of Steve Jobs’s Office taken earlier today: http://✪df.ws/f2u (via @daringfireball) [vancura]
delicious (feed #3)
Shared 2 links.
twitter (feed #2)
Ultrathin Silk-Based Electronics Make Better Brain Implants http://shar.es/mviMI [vancura]
twitter (feed #2)
The Size of Empty: comparison of #AS3 data types consumption: http://bit.ly/9RXUxY [vancura]
twitter (feed #2)
#Infographics of the day: A flowchart for deciding what typeface to use… http://bit.ly/cEMd4r (via @Coleran) [vancura]
twitter (feed #2)
Testing Facebook like button on my blog, please, do me a favor, click one of them so I know it works :] http://vaclav.vancura.org/blog [vancura]
twitter (feed #2)
Nobel prize nomination on Chemistry to Mexico’s president Calderon: he took a country and turned it into shit (via @paw & @migueldeicaza) [vancura]
twitter (feed #2)
twitter (feed #2)
#Intellij Idea 9.0.2 has major problems formatting code. If you don’t want to loose parts of code, don’t install it. #FAIL! [vancura]
twitter (feed #2)
Never thought Guns’n'Roses could be so good: November Rain guitar solo on the end is simply incredible (and thats the only song I can bear) [vancura]
vimeo (feed #4)
googlereader (feed #8)
twitter (feed #2)
Unity 3.0 Feature Preview – Snapping & Marquee Selection: http://bit.ly/aJhpto #unity3d (via @unity3d) [vancura]
vimeo (feed #4)
delicious (feed #3)
The Neapolitan Chapel of Sansevero is one of the most enigmatic chapels in Europe, if only because its creator, Raimondo di S…
twitter (feed #2)
Once again I feel I need to unfollow few guys spamming 4sq msgs, till they find twitter repost is priceless. [vancura]

Weekly Digest for April 18th

delicious (feed #3)
twitter (feed #2)
RT @paul_irish & @mrdoob: How well does your browser support HTML5? http://html5test.com [vancura]
twitter (feed #2)
CS5 Design premium, US $1899, UK $2729 (144%), DE $3714 (196%). Buy now. http://bit.ly/aPG5r3 [vancura]
twitter (feed #2)
Buy #CS5 now! The last version on OSX! [vancura]
googlereader (feed #8)
twitter (feed #2)
RT @viticci: BREAKING: Opera for iPhone Approved! http://mcstr.net/cu9s5D (via @robinraszka) [vancura]
twitter (feed #2)
I want a new MBP! Now! RT @viticci, @robinraszka: The Apple Store is down! http://store.apple.com [vancura]
twitter (feed #2)
New site, new work http://www.moresoon.org (via @MoreSoonLtd) [vancura]
twitter (feed #2)
twitter (feed #2)
[cz] Za obviněními církve z pedofilie stojí Židé, šokoval italský biskup. Cernoprdelnici se nezmeni. http://bit.ly/94zIEw [vancura]
googlereader (feed #8)
vimeo (feed #4)
Liked 3 videos.
twitter (feed #2)
[cz] Krasna zkratka p. kamarada Vladi, slibujici prubeh noci na psytrance festivalu: "Otevrem si vecer pivo a budem koukat na vychod slunce" [vancura]
twitter (feed #2)
Takže konec legrace a nyní jen seriózně, ano? Když se teď ty tvíty ukládají v kongresové knihovně, Washington, DC. (via @machal) [vancura]
twitter (feed #2)
David Helgason updates us all on the #unity3d and #iphone situation: http://bit.ly/cLR5un (via @unity3d) [vancura]
twitter (feed #2)
There’s a cool new Iron Man 2/Dr. Pepper game that’s been released on the web, it’s made with #unity3d! http://bit.ly/aQbLuX (via @unity3d) [vancura]
twitter (feed #2)
The Daily Petri Dish http://bit.ly/b2XKap (via @pigcore) [vancura]
delicious (feed #3)
Unity3D can work with meshes created in external 3D editors, but geometry can also be created with code. And not only geometr…
twitter (feed #2)
Adobe’s poor explanation for the CS5 icon, splash screen, and more: http://bit.ly/cyB3Oa (via @adambetts) (via @spiralstairs) [vancura]
googlereader (feed #8)
twitter (feed #2)
[cz] @kairra Tak slamena vdovo, nechcete zitra prijit do Crossu na loutkove divadlo? [vancura]
twitter (feed #2)
#Infographics of the day: Who owns the most servers? http://bit.ly/9tcu45 [vancura]
twitter (feed #2)
Hledáme grafiky na jednorázovou zakázku pro Facebook hru naší sestry Falanxie. Pokud máte zájem, pište na <a href="mailto:jakub@falanxia.com”>jakub@falanxia.com. Dík! Please RT [vancura]
vimeo (feed #4)
twitter (feed #2)
The Latest Improvements to the WebKit Web Inspector: http://✪df.ws/f22 (via @daringfireball) [vancura]
twitter (feed #2)
I just became the mayor of hating your FourSquare tweets. (via @SteveAndrews & @aprilchild) [vancura]
twitter (feed #2)
delicious (feed #3)
googlereader (feed #8)
googlereader (feed #8)
twitter (feed #2)
RT @UnitZeroOne: Everyone STOP! There’s an island which is disruptive to airtraffic, and black smoke is escaping from it… Lost is a re … [vancura]
vimeo (feed #4)
delicious (feed #3)
main(k){float i,j,r,x,y=-16;while(puts(""),y++

Weekly Digest for April 11th

delicious (feed #3)
Shared 12 links.
twitter (feed #2)
Laboratory output n°71 ParticleYou by Simppa.fi: http://www.simppa.fi/blog/particleyou/ [vancura]
twitter (feed #2)
[cz] @viktorbezdek: To ja bohuzel #daldoskace kazdej den, nehlede na to kdy jdu spat. Porid si deti :] [vancura]
googlereader (feed #8)
twitter (feed #2)
RT @mashable UK Passes Controversial “Digital Economy Bill” http://bit.ly/dp9THN (I also dig #debill hashtag) [vancura]
delicious (feed #3)
googlereader (feed #8)
flickr (feed #5)
Shared 2 photos.
twitter (feed #2)
Yeah. We are fucked. Flash, Unity3D, you name it. Now what? http://bit.ly/aJE5sL [vancura]
twitter (feed #2)
i wonder how unity3d is viewed in this new light. you could definitely interpret that as unity = no go. (via @bit101). Fuck is what I say. [vancura]
twitter (feed #2)
Fuck fuck fuckity fuck. Now I am pretty pissed off. Fuck Apple. [vancura]
twitter (feed #2)
Anybody interested in #Unity3D case (re non-ObjC code on #iPhone), follow this thread: http://bit.ly/9SgosV [vancura]
twitter (feed #2)
Somebody has to write to <a href="mailto:sjobs@apple.com”>sjobs@apple.com about this case. I won’t, I had to open a bottle of wine to calm down a bit :] [vancura]
twitter (feed #2)
"This could mean that they could kill all ad networks but their iAd!" Steve made a long way since his LSD experience. http://bit.ly/cV3r3i [vancura]
twitter (feed #2)
Ha! Fast rounding by two: stageWidth = value >> 1 << 1; [vancura]
googlereader (feed #8)
twitter (feed #2)
RT @daringfireball: ★ Why Apple Changed Section 3.3.1: http://✪df.ws/ezd [vancura]
twitter (feed #2)
Because you’ll never be clean enough. Never. http://bit.ly/cR3KNe [vancura]