Archive for May, 2010

Record FLV with Screensharing

With AIR 2 Native Process help,  Print.jar helps press PrintScreen and the data from clipboard is used to get Screen Shots  to be written in FLV using FlvWriter.as
The Main Application file used to write FLV using the screen shot images is in this link.
Advertisements

Merge / Combine two ArrayCollections

// ArrayCollection 1
var arrC1:ArrayCollection;
// ArrayCollection 2
var arrC2:ArrayCollection; 
var array1:Array = arrC1.source
var array2:Array = arrC2.source
public function arrayContainsValue(arr:Array, value:Object):Boolean
{
       return (arr.indexOf(value) != -1);
}  
public function createUniqueCopy(a:Array):Array{
       var newArray:Array = new Array();        
       var len:Number = a.length;
       var item:Object;        
       for (var i:uint = 0; i < len; ++i)
       {
               item = a[i];                
               if(arrayContainsValue(newArray, item))
               {
                       continue;
               }
               newArray.push(item);
       }
       return newArray;
}  
var combinedArr:Array = createUniqueCopy(array1.concat(array2) );
var resultArrC:ArrayCollection =new ArrayCollection( combinedArr );

Camstudio video annotation

“unable to detect webcam / video source”

The above is the message i got continuously after trying a lot, so fixed it with Flex by creating a AIR to show the Webcam Video.
Source:

<?xml version="1.0" encoding="utf-8"?> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" maxHeight="150" maxWidth="200" showStatusBar="false" skinClass="assets.DTApplicationSkin" alwaysInFront="true"> <fx:Script> <![CDATA[ private function videoDisplay_creationComplete():void { var camera:Camera = Camera.getCamera(); if (camera) { videoDisplay.attachCamera(camera); } } ]]> </fx:Script> <mx:VideoDisplay id="videoDisplay" creationComplete="videoDisplay_creationComplete();" width="100%" height="100%" horizontalCenter="0" verticalCenter="0"/> </s:WindowedApplication>


The link have the AIR file required. Download

How to Modify SWF without Recompilation

I could n’t access my Laptop last week, but i had some urgent work to do (recompile a old SWF). Here is how i did it.
This post is just a reference and guide based on the Post.
Find the Point which you want to modify using any of the available SWF Decompilers
Decompress the SWF using java.util.zip.DeflaterInputStream : Java Source Code file link
Jar File Download Link
Usage :  java -jar SWFCompress.jar c 'YourSWF.swf'
Download the Nemo440.AIR , to view the hex code.
Notice the exact place of the code to be modified using
The conventions of u30 encrypted Hex code is provided by Adobe.
Download any Free Hex Editors like HxD, to edit the SWF
Find the code part and modify the -decompressed SWF
Compress the decompressed SWF, back to the form, using SWFCompress.jar.
Usage :  java -jar SWFCompress.jar d 'YourSWF.swf'

Now the re compressed SWF is ready to go. Have Fun Cracking, Hacking SWF’s

Project: Swiz DAO

Libraries Used:  Swiz, AS3Signals and FoomongerSwizFramework.
Objective:
To create GenericDAO framework, like IBM Generic DAO (Java /Spring/ Hibernate)
About GenericDAO:
DAO is the Object which manages to perform CRUD Operation and other Common
Operations to be done over a ValueObject ( known as Pojo in Java ).
GenericDAO is a reusable DAO class which can be used generically.
Goal:

In IBM GenericDAO, to add a new DAO, the steps to be done is simply,
  1. Add a valueobject (pojo).
  2. Add a hbm.xml mapping file for the valueobject.
  3. Add the 10-line Spring configuration file for the DAO.
Similarly, in AS3 Project Swiz DAO. We want to attain a similar feet of achievement.
Client Side GenericDAO model:
As we were working on a Client Side language, also we should be managing a persistent object Collection (for every valueObject) .
Usage:
<swiz:Prototype name=”personDAO”
constructorArguments=”{[‘person’,personProcessor]}” type=”{AbstractDAO}”
singleton=”true”/>
Added, How it works in Github: DI Mechanism Link

http://github.com/nsdevaraj/SwizDAO

Generic DAO in AS3

Built an AS3 Project to Work with GenericDAO using Swiz and AS3Signals

The project was inspired by Java Spring Framework:
IBM Generic Dao

The project uses the benefits of DI provided by Swiz 1.0.
The Deferred Instantiation of Swiz builds DAO Object only when [Inject] keyword is used.

Also, uses the latest Spark SkinnableComponent Framework for the View Part with Passive View.

The Source can be downloaded from SwizDAO Git
The below is the code from Swiz Context for a DAO Object:

<swiz:Prototype name=”taskDAO” constructorArguments=”{[‘task’,taskProcessor]}” type=”{AbstractDAO}” singleton=”true”/>

Update Info : https://nsdevaraj.wordpress.com/2010/05/12/project-swiz-dao/