Schemaphic Systems Blog

Sharing experiences in Flash, Flex and AIR

Flash to HTML5

leave a comment »

Adobe’s newly released “Wallaby” application that aims to expand support for Apple’s line of iOS devices, including the iPhone and iPad, by converting Flash files into HTML5.

Read more of it here.

Advertisements

Written by Deepanjan Das

March 9, 2011 at 8:26 AM

Posted in Flash, General, HTML5

Tagged with

StageVideo – A new way to render video

leave a comment »

Until now, Flash Player used to decode H.264 video data back from the GPU to the CPU and use the CPU to render the video. With the out of Flash Player 10.2, comes the Stage Video feature. It enables the GPU to render the video directly on the display without the overhead incurred as previously. So to get the best performance, use H.264 encoding for the video and Stage Video for displaying the video. Read more

Written by Deepanjan Das

February 23, 2011 at 9:51 PM

Private variables accessible in ActionScript3.0

leave a comment »

While browsing through some blogs I came over this fantastic blog on ActionScript. I bet, you all will like it too.
A new thing I learned today is that a variable declared private can still be accessed from a class by another instance of the same parent class. I am sure you also did not believe me like I did until I tested it myself as well. Check this out.

Written by Deepanjan Das

February 19, 2011 at 10:17 PM

Screen capture with ActionScript

with 63 comments

While working over numerous projects I often had requirements for doing screen capture in AS3.0. Unfortunately I found none in google search, but got some resources which helped me to develop a component for screen capture.

With a hope that this will someone out there, I have posted it here Read the rest of this entry »

Written by Deepanjan Das

February 5, 2011 at 1:31 PM

Duplicate MovieClip in AS3.0

with 4 comments

Like duplicateMovieClip in AS2.0, here is an API to do the same in AS3.0, So just chill 🙂

/**
* usage: var dupMC:MovieClip = duplicateDisplayObject( MC1 );
* @params -  target:DisplayObject - The movieclip to be duplicated.
*            autoAdd:Boolean - default is false, setting it to true will add the new
*            duplicate movieclip to the parent of the to be duplicated movieclip
*/

public function duplicateDisplayObject( target:DisplayObject, autoAdd:Boolean = false ):DisplayObject
{
     // create duplicate
     var targetClass:Class = Object(target).constructor;
     var duplicate:Sprite = new targetClass();

     // duplicate properties
     duplicate.transform = target.transform;
     duplicate.filters = target.filters;
     duplicate.cacheAsBitmap = target.cacheAsBitmap;
     duplicate.opaqueBackground = target.opaqueBackground;
     if ( target.scale9Grid ) {
          var rect:Rectangle = target.scale9Grid;
          duplicate.scale9Grid = rect;
     }

     // add to target parent's display list
     // if autoAdd was provided as true
     if ( autoAdd && target.parent ) {
          target.parent.addChild( duplicate );
     }
     return duplicate;
}

Written by Deepanjan Das

February 1, 2011 at 8:58 AM

Clone Sprite in AS3.0

with one comment

A simple way to clone a sprite:

/**
*  @usage : var newSprite:Sprite= cloneSprite( existingSprite );
*  @params- target:Sprite- existing Sprite which needs to be cloned
*/
public function cloneSprite( target:Sprite ):Sprite
{
     // create clone
     var targetClass:Class = Object( target ).constructor;
     var clone:Sprite = new targetClass();
     return clone;
}

Written by Deepanjan Das

February 1, 2011 at 8:56 AM

Convert DisplayObject to Bitmap

with one comment

This API will return a Bitmap Image of any DisplayObject in Flash AS3.0. This was developed by Avijit Dutta, one of my friends. Hope this helps someone out there:

/**
*  @usage : var bitmap:Bitmap = BitmapUtil.getImage( source, new Rectangle( 0, 0, 100, 100 ) );
*  @params: source - DisplayObject whose Bitmap is required
*                   area - the part of the Object to be converted to an image.
*                    If the whole object is required to be converted then set null.
*/
public static function getImage( source:DisplayObject, area:Rectangle = null ):Bitmap
{
     var bitmapData:BitmapData;
     var matrix:Matrix;

     if ( area != null ) {
           matrix = new Matrix( 1, 0, 0, 1 , Math.abs( area.x ) , Math.abs( area.y ) );

           if ( area.width > 0 && area.height > 0 )
                bitmapData = new BitmapData( area.width, area.height, true, 0x0 );
           else
                bitmapData = new BitmapData( source.width, source.height, true, 0x0 );
     } else {

           bitmapData = new BitmapData( source.width , source.height , true, 0x0 );
     }

     bitmapData.draw( source, matrix, null, null, area, true );

     var bitmap:Bitmap = new Bitmap( bitmapData );
     return bitmap;
}

Written by Deepanjan Das

February 1, 2011 at 8:40 AM