Category Archives: Flash and Actionscript

Which are your favourite features in Flash Player 10?

Just curious:
Which are your favourite features in Flash Player 10?

I find new Text engine very useful in most of the application-development. Text layout engine is powerful enough to solve various use-cases, true bidirectional text support is being one of those.

I like other features too. Hopefully, I would post my views on those as well as text-layout-engine later.

Technorati tags: , , , ,

Available for consultancy, training and development

I am available for consultancy, training and development services. Following is the rough list of things, I can provide consultancy, training or development services for:-

  • ActionScript 1.0, 2.0, 3.0
  • Adobe Flash/Flex
  • Adobe Integrated Runtime (AIR)
  • Training on Adobe RIA technologies
  • Architecture for RIA
  • Web Application Development
  • Design and Architecture
  • Development for LAMP
  • Integration Services for Flex/AIR with existing Web Apps
  • Development Setup for small teams
    • Subversion Version Control
    • Bug Tracking System (Trac, Wiki)
    • Training on Development Life Cycle
    • Backup Strategies
    • Development Sandbox Setup for RIA development

    JFYI! You can check out my linkedin profile to know more about me. I am based in India and have around ten (10) years of experience, during this period I have worked for Macromedia/Adobe, Yahoo!, Mixercast and TIS and worked as independent-consultant, freelancer, trainer and co-founder. I have been working on various technologies/platforms (some listed above).

    I am a programmer who enjoys solving users’ problems whatever it takes (technology is no constrain). Having said that, I am passionate about ActionScript/Flash/Flex/AIR and Web (in general) which happen to be my core competencies.

    PS: Do you think, this is a shameless sales pitch :-)

    Technorati tags: , , , , , , , , , ,,

    iDesktop.tv

    What is iDesktop.tv?
    iDesktop.tv is an incredibly cool dynamic web 2.0 application, with a terrific modern design, that brings you a better way to search and watch YouTube videos. Not only but you can download YouTube videos!
    This is basically adding functionality and experience to what “should be” there. The possibilities of the site reach far beyond that. It gives you the chance to create your own environment for watching video clips, saving them and sharing them with friends.

    I liked the neat and clean interface, which is mostly done in AJAX (=DHTML), Flash Player is used to play videos from YouTube. Entire experience blends well and user-interface is pretty intuitive.
    Features like video downloads in various formats (wmv, mov, mp4, zip, exe, etc) and smart/intelligent playlist creation are cool.
    iDesktop.tv increases the quality of user-experience, makes it easier to navigate, personalize, share and store the videos.
    I thought to spread some words about iDesktop.tv, which is no doubt one of the coolest web-app, done on top of YouTube’s platform and blurs the line between AJAX and Flash, as an user I didn’t notice any difference when AJAX or Flash was in action.
    BTW! This web application is created by the guys behind flashjester, if you are Flash vetran (like me ;-) ), you know what flashjester meant to us in those days, still means a lot to many today.
    Technorati tags: , , , ,

    YouTube announces Upload API, Chromeless Player with JavaScript API and H.264 videos

    YouTube has announced a lot of new features:-

    This is really amazing, we can build kick-ass applications that would use YouTube’s platform for media upload, conversion (trans coding) and delivery, seamlessly.

    I am yet to confirm, how easy it is to load and control YouTube’s player in our Flash/Flex apps? Controlling loaded SWFs is hard, unless it allows cross-site scripting through Security.allowDomain (“loaderdomain.com”). I hope, some day Flash Player would have more Security APIs, which would let us expose a set of interfaces to loaders (SWF loads another swf from different domain).

    In any case, we can overlay iframe/div to show the video. That’s what I am doing for Yahoo! Live Mashup.

    Update (March 12, 2008): YouTube’s chromeless player can be loaded in Flash/Flex applications and can be controlled. That’s what I heard Geoff Stearns, Flash Engineer in YouTube and SWFObject developer, saying in this video.

    Technorati Tags: , , , , , , ,

    I am part of Flash Platform evolution.

    I was at Flex User Group meeting in Bangalore. The room was full of developers, designers and managers interested in Adobe Flash Platform (Flex/Flash/AIR). I was, quietly, noticing things while various thoughts were going on in my mind.

    I have been part of Flash (Platform) ecosystem for around nine years now. I remember old days of were-here, flashkit, flashcoders, flashcomm, flashlounge, indiammug, etc. I got to know some of great guys, who have inspired me in many ways.

    I have seen Flash Platform evolving and probably know reasons why certain things (Royale – Flex, Central, etc) happened. It’s great to see, how businesses and developers/designers are embracing Flash Platform today. It’s great feeling that I belong to the batch who is among the oldest in my country and probably, this planet.

    Those old days were fun, good to be among creative guys with amazing programming skills. We saw some great stuff (3d, chat, games, funky effects, nice apps, forms, etc) with limited capabilities of Flash 4.

    It was amazing feeling, when I saw Flash 5 beta in Macromedia seminar in year 2000. I could see the expressions (wow) on everyone’s face and the excitement after seeing something – Flash 5 (amazing tool, ActionScript 1.0, XMLSocket, XML, Objects, etc).

    Today is a big day, I am again witnessing something (AIR 1.0 release). I am equally excited, as I was during Flash 5 release. Honestly, I was more excited then because things were not that open, you would get to know about a product’s next version during some event or leaked information from few beta-testers, unlike today where prerelease cycles allows us to play with product/tool even before it’s released. But you get this feeling, you are part of product development, which was not there (for everyone).

    I am sure, when I would look back after some years, I would feel more proud and happy for being part of an ecosystem and this community. I believe, success of Flash, Flex and AIR is result of the beliefs of thousands of developers and designers, who were always passionately involved, even in various up-down times. Times when your identity as a developer was questioned, because you were working with Flash, but hey who cares about what someone says, if you are in love with something.

    It was hard to get a project or job with this skill-set, at-least in India. Even today, many companies are blind enough not to see how cool Flash Platfom is, but it’s lot easier now to convince them compared to what it used to be then.

    Many religious and emotional developers, like me, who would fight or do anything to prove that Flash (meant: SWF, Player, ActionScript or technology in general) is the best. I have grown up now, probably different phase of life, I focus on products, ideas, users more now, but I am still in love with ActionScript and Flash Player.

    Thanks to Macromedia/Adobe for listening and interacting us (developers/designers) in all possible ways (blogs, forums, mailing-lists, etc).
    An old link (http://macromedia.com/into) still works. People talking about how Flash changed their lives, I am also somewhere in there :-)

    Should SWF need to be searchable?

    We hear people asking questions, how to make swf (more) searchable? Is SWF searchable?
    Not many people know, most of the search engines index text within swf files. My question is:

    Should SWF need to be searchable?

    I have got different opinion on this entire idea:

    • SWF is *not content* rather an application.
    • To make it searchable, it require special effort, which doesn’t make sense.
      • hardcoded text in swf
      • extra deep-linking workarounds, apart from basic support, to instantiate view-state

    Some questions:

    • Should search-engines index applications?

    • Does desktop-search index desktop-applications (executables)?

    Why do we need to prove swf is a good option? I think, it is. The whole idea of searchability applies to content, and I already said swf should not be seen as content (like html, xml, text, etc).
    I can imagine a few ways to add search support without doing special workarounds, these are known things:

    • As we know, it’s good practice to have support for deep-linking or REST URIs
    • Having that in place, metadata can be injected in html-wrapper or a supporting xml file with all possible deep-links to view-states within Flash/Flex apps (swf)?

    Structure (view metadata – heading, some info, etc) of application can be semantically encoded in html with appropriate deep-links to views in an application.
    What you think about it?
    Technorati tags: , , ,

    Getting Dailymotion Video (FLV) URL

    Some developers asked me, if it is easy to get dailymotion flv URL? I thought, I would post how to do that.

    If you know the dailymotion video-id, believe me it’s very simple to do that. In case, you don’t know how to get dailymotion video-id?  Let me give you some hints, highlighted text is the video-id:-

    Once you have video-id, you can use the following php-script (dailymotion.php.txt) to do either of two things:-

    • Get flv and thumbnail-url
      • http://yourserver/dailymotion.php?video_id=<video_id>&redirect=false
        • Returns: flv=<flv_url>thumbnail=<thumbnail_url>
    • Redirect to dailymotion flv-url directly. It can be used directly from Netstream’s play (<url>) instance method
      • http://yourserver/dailymotion.php?video_id=<video_id>&redirect=true
        • Redirects (HTTP 303) to flv_url.

    <?php
    // PHP code for getting dailymotion flv-path and more info.
    //
    // Author: Abdul Qabiz
    // Jan 22, 2008
    //
    //Params:- Requires dailymotion video_id
    // USAGE:-
    // 1) For information
    // http://server/dailymotion.php?video_id=&redirect=true
    // Above invocation would return:-
    // flv=&thumbnail=
    // Example:-
    // URL: http://server/dailymotion.php?video_id=x44ls3&redirect=false
    //
    // Result:-
    // flv=http://www.dailymotion.com/get/15/320x240/flv/6933315.flv?key=69f63205c80b5b5d188a10e0b7656a421316ee3&previewURL=http://limelight-315.static.dailymotion.com/dyn/preview/320x240/6933315.jpg?20080122041
    //
    // 2) For redirection to flv i.e. video_id to flv
    // http://server/dailymotion.php?video_id=&redirect=true
    // Above invocation would redirect to dailymotion flv URL
    if (isset ($_GET ['video_id']) == FALSE)
    {
    echo "video_id is required";
    exit;
    }
    // Requires dailymotion video_id
    $url = 'http://www.dailymotion.com/swf/' . $_GET['video_id'];
    if (isset($_GET['redirect']) == FALSE)
    {
    $redirect = 'true';
    }
    //Start the Curl session
    $session = curl_init($url);
    curl_setopt($session, CURLOPT_HEADER, true);
    curl_setopt($session, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9');
    curl_setopt($session, CURLOPT_FOLLOWLOCATION, false);
    curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
    // Make the call
    $response = curl_exec($session);
    $error = curl_error($session);
    $result = array( 'header' => '',
    'body' => '',
    'curl_error' => '',
    'http_code' => '',
    'last_url' => '');
    if ( $error != "" )
    {
    $result['curl_error'] = $error;
    }
    else
    {
    $header_size = curl_getinfo($session,CURLINFO_HEADER_SIZE);
    $result['header'] = substr($response, 0, $header_size);
    $result['body'] = substr( $response, $header_size );
    $result['http_code'] = curl_getinfo($session, CURLINFO_HTTP_CODE);
    $result['last_url'] = curl_getinfo($session, CURLINFO_EFFECTIVE_URL);
    list($header,  $result['header']) = explode("\n\n",  $result['header'], 2);
    $matches = array();
    preg_match('/Location:(.*?)\n/', $header, $matches);
    $urlInfo = parse_url(trim(array_pop($matches)));
    //$newUrl = $urlInfo['scheme'] . '://' . $urlInfo['host'] . $urlInfo['path'] . ($urlInfo['query']?'?'.$urlInfo['query']:'');
    parse_str($urlInfo['query'], $output);
    $flvURL = $output ['url'];
    $thumbnailURL = $output['previewURL'];
    if ($redirect == "true")
    {
    header ("Location: ". $flvURL, TRUE, 303);
    }
    else
    {
    echo sprintf ("flv=%s&thumbnail=%s", $flvURL, $thumbnailURL);
    }
    }
    curl_close($session);
    ?>

    Let me tell you, you can do the entire thing on client-side without using any server-side script, though logic remains same. Look at this post and learn what technique to use :-). Another hint, if you are consuming dailymotion rss-feed(s), you don’t need any php script to construct flv-url, you can just replace “80×40″ text by “320×240″ in media:content url.

    As always, please look at the code, change, optimize and fix it to meet your requirements. I wrote it in ten minutes and just as a proof-of-concept, this is no way the best method and php-code can be much better.

    Technorati Tags: , ,

    ECR for Flash Player: Allow Socket connection to HTTP servers without special setup

    This is for Adobe Flash Player team, specially security guys, please allow us (developers) to use Socket API in creative ways, beyond you permit us. Atleast, for same-origin (domain), we don’t need to have special policy file to allow socket-connection over http-port (80) or ssl-port (443)? This is totally doable?
    Please, please tell us why don’t you let us do it now?

    Update (Jan 20, 2008): I filed an enhancement-request in Adobe JIRA bug-base. Vote for this enhancement, if you think it’s useful. You can vote by visiting the following link:

    https://bugs.adobe.com/jira/browse/ASC-3122

    Query-string in SWF URL is not good idea

    Query-string in SWF URL is bad idea because swf would be downloaded again by browser/client instead of being loaded from browser-cache, it happens if URL becomes non-unique due to the presence of changing query-string in different requests.

    Browser does cache data for all URL, unless HTTP response headers (for URL or other resources) instruct not to do caching. If URL is different, browser considers it a new requests and downloads the data again instead of consuming from cache.

    We can try to avoid or optimize such cases. In past, developers have used the other way by having random (non-unique) query-string in SWF or XML/asset URL to force reloading of asset/resource instead of using the ones from browser-cache. Though, they could have done things by setting right HTTP headers.

    I have noticed some websites where swf URL has a query-string i.e. http://yoursite.com/yourapp.swf?var1=somedata, where value of var1 is not constant rather changes? Obvious reason, I want to pass dynamic data most of time hence using query-string instead of hard-coding it in swf itself.

    I also noticed some sites which are using SWFObject and still passing data via query-string instead of flashvars using addVariable (..) instance method of SWFObject.

    Another place, I again noticed something similar, AVM+ application loads AVM- (SWF 8 or less) application, let’s call it legacy-swf, and passes data via query-string, ok, that is understood there is no other way except writing a light-weight wrapper that uses LocalConnection or query-string approach?

    • It might not be worth writing wrapper in case of small-size legacy-swf but depends, if you are serving to thousands of users, every single HTTP request cost something.
    • If legacy-swf is large enough, it’s worth writing a wrapper that loads the legacy-swf. This way at least legacy-swf would be loaded from browser cache in next session instead of being downloaded again from your server.

    This is very basic thing in web-application development, user-experience can be improved by doing these little things. I hope to write some more observations, no matter how stupid/trivial it sounds to me or other programmers. It’s good to post these things in context of flash/flex so beginners, who are not familiar with details of HTTP or other standards, can learn.

    Technorati tags: , , , ,

    Flash Platform (flex/flash/air/actionscript) blogs from India

    I have been maintaining a list of flex/actionscript/air bloggers on flex_india group. I updated the list today and I would be updating it again next week.

    It’s nice to see more developers from India are blogging and sharing their knowledge with everyone. There are ( and always have been) very smart and cool developers in India but generally they maintain a low-profile or too busy with work or shy.

    Check out the following list, I have used the names of bloggers instead of blog-title because it was for me to do so.

    Flex/Flash/AIR bloggers from India

    You can bookmark this link.

    Technorati tags: , , , ,

    ActionScript compiler in ActionScript

    Another interesting project from Metal, he has ported ActionScript compiler (which is part of Tamarin project) to an ActionScript 3.0 library.

    He is still working on it, however, he has posted a demo and current version of code. I am sure, this would be pretty useful. I remember of reading a thread on flexcoders about creating mock-objects in ActionScript 3.0, eval-project might prove useful there.

    Technorati Tags: , ,