
Deepanjan Das
I started as a Graphic Designer long back in the year 2000.
I always had an inclination towards animation. With that urge to learn
animation, took up flash and picked up the animation techniques in 2 months.
From then I was actually in love with this software technology. I have been
using Flash in my web development since version 4. As ActionScript became more
and more powerful, I started picking up bit by bit and in due course of time, changed
my vision from animation to flash based developments. Over the years I have
been working purely on ActionScript and thus eliminating the use of timelines.
These days I am busy with developing enterprise level desktop application in
AIR, online games and complex Rich Internet Applications. Over the years I have
got immense support from various online communities and forums. I wish to
contribute and share some of my coding experiences with a hope to help someone
out there. You can reach me via my blog.
|| Om Manasamarthadata Shri Aniruddhaya Namah ||
I have added a video and placed 3 buttons, Record, Stop and Play.
On clicking on the Record button, the recording of the page starts. Once you click on stop, it stops recording.
Then click on Play button to see the recorded version. You may have other things/animations on stage for recording too, I have just tried with an flv.
The recording play is basically bytesArray of an FLV created on run-time. You can save it to your server by passing this binary data to any back-end technology – ASP.Net or PHP, etc.
//Main.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"<span> </span>
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="955" height="600"
addedToStage="onInit();"
frameRate="24" >
<pre> <fx:Script>
<![CDATA[
import com.dd.screencapture.ScreenCapture;
import com.dd.screencapture.SimpleFlvWriter;
private var screenCapture:ScreenCapture;
private function onInit():void
{
screenCapture = ScreenCapture.getInstance();
screenCapture.source = stage;
screenCapture.fps = 12;
screenCapture.size( 400, 300 );
screenCapture.x = 400;
screenCapture.y = 250;
stage.addChild( screenCapture );
}
private function startRecord( event:MouseEvent ):void
{
screenCapture.record();
}
private function stopRecord( event:MouseEvent ):void
{
screenCapture.stop();
}
private function playVideo( event:MouseEvent ):void
{
screenCapture.play();
}
]]>
</fx:Script>
<s:VideoDisplay width="400" height="300" source="assets/myVideo.flv" />
<mx:HBox >
<s:Button label="Record" click="startRecord( event );" />
<s:Button label="Stop" click="stopRecord( event );" />
<s:Button label="Play" click="playVideo( event );" />
</mx:HBox>
</s:Application>
Place this swc in library of the flex project. You may also use this for ActionScript 3.0 projects as well.
Kindly note that this requires Flash Player 10.1 to run properly. No audio capabilities here.
Interestingly, you can save the screen capture as FLV format by using this piece of code below:
var saveFile:FileReference = new FileReference();
saveFile.save( screenCapture.data, "video.flv" );//screenCapture is the ScreenCapture instance created in the above code block.
Resources used: http://www.zeropointnine.com/blog/simpleflvwriteras-as3-class-to-create-flvs/
The links shows how to save BitmapData to an FLV in binary format and
then save to dish using Adobe AIR, using FileStream. I have taken the
part of writing the binary data for FLV and playing that FLV as stream
on run-time.
Cheers :)
Spread The Word
6 Responses to "Screen capture with ActionScript" 
|
said this on 05 May 2011 7:16:29 AM CDT
Will this work only in Fl
In A |
|
said this on 05 May 2011 10:10:41 AM CDT
Thanks Vinayak,
I think Though not sure. Y Let me know it it Be DD |
|
said this on 18 Apr 2012 6:06:59 AM CDT
Hi,
its really awesome I only wanted to recor thanks a |
|
said this on 26 Apr 2012 9:28:43 PM CDT
<?xml version="1.0" encod
<mx:Window <mx:Script> i private ohSnap private fun var ohSnap var fil } </mx:Script <mx:TabNavigator wi <mx:Box width="100%" <mx:App <mx:Tog <mx </mx:ToggleBu </mx:Appl <mx:TextArea </mx:Box> < <mx:Button <mx:Can source="@ < </mx:TabNa </mx:Wind |
|
said this on 26 Apr 2012 9:31:14 PM CDT
<?xml version="1.0" encod
<mx:Window <mx:Script> i private ohSnap private fun var ohSnap var fil } </mx:Script <mx:TabNavigator wi <mx:Box width="100%" <mx:App <mx:Tog <mx </mx:ToggleBu </mx:Appl <mx:TextArea </mx:Box> < <mx:Button <mx:Canvas id="cvMa <!--<mx:Imag <mx:Labe </m </mx:TabNavi </mx:Window |
|
said this on 21 Nov 2012 3:07:57 AM CDT
Its really helpful, parti
|


Author/Admin)