Skip to main content

Posts

Showing posts from 2011

How to make an invisible folder on Windows?

Follow the steps to make a completely invisible folder. Step-1 : Create new directory, by default that is named as ' New Folder '. Step-2 : Press F2 to rename it as blank. Step-3 : Press Alt+255 . Step-4 : Press Enter . Step-5 : Right click the unnamed folder. Step-6 : Click on the ' Properties ' option in the popup menu. Step-7 : Select the ' Customize ' option tab in the Properties window. Step-8 : Click on the ' Change Icon... ' button. Step-9 : Search and select any blank icon, then press ' OK ' button. Step-10 : Press ' Apply ' button to apply changes then press ' OK ' button to finalize it.

App: Project Artificial Intelligence (P.A.I.)

This is a basic chatbot program, that has been launched to evolve itself with time. It is basically made to chat via mobile-sms. While this app uses the same core  to communicate on web. Technical details : Body : the flex 4 has been used to create the user interface for front-end. Brain : the php 5 has been used as server-side language for back-end. Memory : the xml has been used as database. Application - PAI :

AS3: Basic navigation class

Here is basic code for making a navigation class. The navigation here in is based on a counter. By taking the reference of a counter the class can be extended to achieve any type of navigation. CODE package { /** * @file CNavigator.as * @author Abhishek Kumar */ public class CNavigator { public var _Proceed:Function; private var counter:int; private var minRange:int; private var maxRange:int; public function CNavigator(min:int, max:int) { trace('CNavigator -> constructor'); minRange = min; maxRange = max; counter = 0; } public function navLeft():void { trace('CNavigator -> navLeft'); if (counter > minRange) { counter--; _Proceed(counter); } } public function navRight():void { trace('CNavigator -> navRight'); if (counter < maxRange) { counter++; _Proceed(counte

AS3: How to load child swf in parent swf at run-time

Here is a class to load single or multiple external/child swf files in the main/parent swf at run-time. CODE package { import flash.display.Sprite; import flash.display.Loader; import flash.display.MovieClip; import flash.net.URLRequest; import flash.events.Event; import flash.events.IEventDispatcher; import flash.events.ProgressEvent; import flash.events.SecurityErrorEvent; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; /** * @file CSwfLoader.as * @author Abhishek Kumar */ public class CSwfLoader { public var _Proceed:Function; private var swfLoader:Loader; private var swfRequest:URLRequest; private var swfPathList:Array; private var swfList:Array = []; private var swfTemp:MovieClip; private var swfCount:int; public function CSwfLoader() { swfLoader = new Loader(); swfRequest = new URLRequest(); } public function

AS3: How to load XML in swf at run-time ... Alternate version

We can load xml file into swf at run-time by using following class. Here is an alternate version of xml loading class that I'd presented in my previous post [ AS3: How to load XML in swf at run-time ]. CODE package { import flash.display.Sprite; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.Event; import flash.events.IEventDispatcher; import flash.events.ProgressEvent; import flash.events.SecurityErrorEvent; import flash.events.HTTPStatusEvent; import flash.events.IOErrorEvent; /** * @file CXmlLoader.as * @author Abhishek Kumar */ public class CXmlLoader extends Sprite { public var _Proceed:Function; public function CXmlLoader () { trace ("CXmlLoader -> constructor"); } public function retrieve (iXml:String):void { var loader:URLLoader = new URLLoader(); configureListeners (loader); var request:URLRequest = new URLRequest(iXml); try { loader.load (request); } catch

Batch File - Bulk File Remover

Have you ever faced a problem, where you need delete a particular type of files from your directory. Well I faced that while creating a zip file of a directory. The directory was downloaded from Visual Source Safe (VSS), and people who had worked with it knows that it puts an extra file that is named vssver.scc in each and every folders and sub-folders of the directory. As it was really cumbersome method to open and delete each and every folders. So I've developed a batch file for doing this. Code : attrib /s -r *.scc del /s *.scc Steps to create the batch file : Create a file with filename: del_scc.bat Open it in notepad. Copy and paste the above code in it. Save the file. Move the file to the required location, i.e., the directory from which you want to remove .scc files. Run the file by double-clicking on it. Understand the code : The first line will change the property of all the files whose extension is .scc by converting it from read-only to writable file.

App: Gil_TextEditor

I was working on an e-learning project for Gujarat government. The whole content of the project was in Gujarati language. Since nobody in our team had Gujarati background, so it'd become hard to understand or modify the content. The content team, those who were creating the xml files from the requirement documents, were facing lots of time & difficulty while Gujarati content creation process. So I'd developed this tool for making the content developer's life easier. Firstly, I'd analysed the problem, which were: Manual content creation for XML takes a lot of time. Symbols & Gujarati-text is being manually encoded that is error prone and time taking. Manual encoding requires debugging many times to ensure correctness of encoded text. Then, I looked for the worth of doing this, which were: to speed-up the XML development  and debugging  to increase accuracy to ease the encoding of symbols Finally, I had to convince my supervisor that how it fits

AS3: A class to control 'About ...' movieclip

It is well known fact that, each and every software or program has atleast About <software_name> dialogue box. Similarly if an application is made-up in flash, it should have an About ... dialogue-box. I usually prefer to show it over top of the application as a message box with a faded or dark background. To achieve this in flash, there is an  About ...  movieclip. It should be of size that covers the whole stage. There are 2 movieclips inside  About ...  movieclip: shows message related to  About ...  content fades or darkens the are behind  About ...  content By default this  About ...  movieclip will remain hidden. And on certain predefined mouse-click it'll show up. But after that as soon as user will click on the dark background area, the  About ...  will disappear. So this functionality requires only on movieclip inside the  About ...  movieclip to be linked with mouse-click event, which is the bas or background movieclip. CODE package { imp

AS3: A class to control button behavior & states

Here is a CButtonControl.as  class that'll control the behavior of a movieclip (made in flash) and make it work like a button. The movieclip should have atleast 4 frames with labels as: up over down disable These labelled frames will work as different states of the button. CODE package { import flash.display.MovieClip; import flash.events.Event; import flash.events.MouseEvent; /** * @file CButtonControl.as * @author Abhishek Kumar */ public class CButtonControl { private var Container:MovieClip = null; public var proceed:Function; private var objekt:Object = {}; public function CButtonControl(iReference:MovieClip) { Container = iReference; initializeAssets(); } private function initializeAssets():void { objekt.id = -1; Container.visible = true; Container.mouseChildren = false; Container.gotoAndStop('disable'); } public function in

AS3: Transmute namespace instead of removing it in XML

There are lot many articles and solutions available on web related to the xml namespace . Few guide us over how to handle namespace in xml via as3 while rest have provided solution by removing xmlns tag from the xml. But I think, there is better way than removing or filtering the namespace. The solution that I use is very clever one. You might have noticed that to put namespace in xml colon character is used. So keeping this property in mind, I have developed a function to replace all the colons from namespaces only with the underscore character. The code uses regular expression to search the colon character in only namespace. And then replace it with the underscore character. This way all the namespaces are still available and accessible but in the form of attributes. And this is the advantage of converting it into a attributes. /** * @method transmuter * @author Abhishek Kumar */ private function transmuter(data:String):String { var modified:String = d

Batch File - Bulk Renamer ... Advanced

This post is the continuation of my last post, i.e., Batch File - Bulk Renamer ; related to systematically renaming all the files in a folder. The problem I noticed with my previous code is that, either it works with the particular type of file (aka same extension) or in absence of file-extensions it renames this batch file also. So I thought to introduce a condition in this so as to skip this batch file while renaming other files. Here is the code for that, .:C.O.D.E:. @echo off&set /a cnt=1 for %%a in (*) do call :PROCESS "%%a" goto :EOF :PROCESS IF not %1=="bulk_renamer.bat" (rename %1 "IMG_%cnt%.jpg") set /a cnt+=1 Note : This code would rename all the files present in the folder except bulk_renamer.bat Help : Refer to my previous post for the steps to create or modify the script. Link : http://akzcool.blogspot.com/2010/11/batch-file-bulk-renamer.html

AS3: To determine the angle between two given coordinates

Here is a sample code to determine the angle between two given coordinates. In other words, to calculate the angle of an object with respect to the origin. This could be used to determine current angle of mouse-pointer with some pre-defined origin. In which case the movieclip attached to the mouse-pointer can always point towards it's origin. Many examples of this logic can be seen on web. One of the popular example is; a female face with moving eyes that follows the user's mouse-pointer movement, so that the eyes always look towards the mouse-pointer. Sample Code: package { import flash.geom.Point; /** * @file Connecteur.as * @author Abhishek Kumar */ public class Connecteur { private var originCoordinate:Point; private var currentCoordinate:Point; private function setOriginCoordinate():void { originCoordinate = new Point(Source.x, Source.y); } private function setCurrentCoordinate():void {

TTFEdit - TrueTypes font editor

TTFEdit is a GPL editor for TrueType fonts. TrueType is a standard used by modern operating systems like Mac OS X, Windows XP and Linux. There are two different TrueType specifications: from Apple (original author of this technology) and from Microsoft. Mac OS X and Windows XP use own font rendering engines, there is also FreeType library used by Linux. On these three systems the same font will generally look different. TTFEdit tries to produce TTF files compatible with all mentioned systems. Download link: http://sourceforge.net/projects/ttfedit/files/ttfedit-1.0a/1.0/ttfedit-1.0a-bin.zip/download Hosted at SourceForge: http://sourceforge.net/projects/ttfedit/

App: Capture Image via Webcam

This is an online image capturing tool that I'd created originally for my father when he was facing problem while capturing snaps from in-built webcam of his new laptop. He asked me to tell him the correct steps to do so. Since I was describing the steps over phone, it didn't worked. So I thought to make something versatile & easy-to-use tool for him and finally this tool got developed. Here is that image capturing webapp tool: Note: You'll be asked for the webcam access via Adobe Flash Player Setting popup. Here you need to click 'Allow' button. It's screen-shot is given below:

AS3: Minimum code required to load XML at run-time

Minimum code required to load XML at run-time is given below: SOURCE CODE var urlLoader:URLLoader = new URLLoader(); urlLoader.addEventListener (Event.COMPLETE, onEventComplete); urlLoader.load (new URLRequest('Database.xml')); function onEventComplete (e:Event):void { var Xml:XML = new XML(URLLoader(e.target).data); trace (Xml); }

AS3: How to load XML in swf at run-time

We can load xml file into swf at run-time by using following class. SOURCE CODE package { import flash.display.Sprite; import flash.events.*; import flash.net.*; /** * @file CLoader.as * @author Abhishek Kumar */ public class CLoader extends Sprite { private var oDispatcher:CDispatcher; public function CLoader() { oDispatcher = CDispatcher.getInstance(); } public function retrieve(iXml:String):void { var loader:URLLoader = new URLLoader(); configureListeners(loader); var request:URLRequest = new URLRequest(iXml); try { loader.load(request); } catch (error:Error) { trace("Loading failed!"); } } private function configureListeners(dispatcher:IEventDispatcher):void { dispatcher.addEventListener(Event.COMPLETE, completeHandler); dispatcher.addEventListener(Event.OPEN, openHandler); dispatcher.add

AS3: How to create custom event dispatcher class

We can create custom event dispatcher class as given below: SOURCE CODE package { import flash.events.EventDispatcher; import flash.events.Event; /** * @file CDispatcher.as * @author Abhishek Kumar */ public class CDispatcher extends EventDispatcher { public static var ACTION:String = "action"; public static var ERROR:String = "error"; private static var instance:CDispatcher = new CDispatcher(); public function CDispatcher() { if (instance) throw new Error("Error: Instantiation failed!"); } public static function getInstance():CDispatcher { return instance; } public function dispatch(e:String, o:Object=null):void { dispatchEvent(new CEvent(e, o)); } } } USAGE import CDispatcher; import CEvent; var oDispatcher:CDispatcher = CDispatcher.getInstance(); oDispatcher.addEventListener (CDispatcher.ACTION, actionHandler); oDispatcher.addEventListener (CDi

AS3: How to create custom event class with extra parameters

We can create a custom event class with extra properties to pass data with it. The source code is given below. SOURCE CODE package { import flash.events.Event; /** * @file CEvent.as * @author Abhishek Kumar */ public class CEvent extends Event { public static const CUSTOM_EVENT: String = "custom_event"; public var data:Object; public function CEvent(type:String, data:Object, bubbles:Boolean=false, cancelable:Boolean=false) { super(type, bubbles, cancelable); this.data = data; } override public function clone():Event { return new CEvent(type, data, bubbles, cancelable); } } } -- Note: Here we can dispatch event as show below: dispatchEvent(new CEvent(CEvent.CUSTOM_EVENT, objekt));