After 2 and bit years, it's time to say goodbye to Insights to betterment. I'm not going to stop blogging (you can't get rid of me that easily). Instead I will be moving my blogging to the site I created to support my book www.abhinavmehta.com.
My new blog URL is http://www.abhinavmehta.com
Thank you to everyone that has kept reading this site and has kept me blogging here over these years.
Saturday, September 25, 2010
Wednesday, March 31, 2010
Solutions: newfolder.exe & regsvr.exe viruses
I want to tell you a story, two days back i got affected by this virus very badly as it eat up all my empty hard disk space of around 700 MB .
I was surprised that my most reliable friend Kaspersky, for the first time failed me in this war against viruses but then again avg and bitdiffender also failed against it. This virus is know popularly as regsvr.exe virus, or as new folder.exe virus and most people identify this one by seeing autorun.inf file on their pen drives, But trend micro identified it as WORM_DELF.FKZ. It is spreading mostly using pen drives as the medium.
Well, so here is the story of how i was able to kill the monster and reclaim my hard disk space.
Manual Process of removal
I prefer manual process simply because it gives me option to learn new things in the process.
So let’s start the process off reclaiming the turf that virus took over from us.
1. Cut The Supply Line
a. Search for autorun.inf file. It is a read only file so you will have to change it to normal by right clicking the file , selecting the properties and un-check the read only option
b. Open the file in notepad and delete everything and save the file.
c. Now change the file status back to read only mode so that the virus could not get access again.
d.
e. Click start->run and type msconfig and click ok
f. Go to startup tab look for regsvr and uncheck the option click OK.
g. Click on Exit without Restart, cause there are still few things we need to do before we can restart the PC.
h. Now go to control panel -> scheduled tasks, and delete the At1 task listed their.
2. Open The Gates Of Castle
a. Click on start -> run and type gpedit.msc and click Ok.
b.
c. If you are Windows XP Home Edition user you might not have gpedit.msc in that case download and install it from Windows XP Home Edition: gpedit.msc and then follow these steps.
d. Go to users configuration->Administrative templates->system
e. Find “prevent access to registry editing tools” and change the option to disable.
f.
g. Once you do this you have registry access back.
3. Launch The Attack At Heart Of Castle
a. Click on start->run and type regedit and click ok
b. Go to edit->find and start the search for regsvr.exe,
c.
d. Delete all the occurrence of regsvr.exe; remember to take a backup before deleting. KEEP IN MIND regsvr32.exe is not to be deleted. Delete regsvr.exe occurrences only.
e. At one ore two places you will find it after explorer.exe in theses cases only delete the regsvr.exe part and not the whole part. E.g. Shell = “Explorer.exe regsvr.exe” the just delete the regsvr.exe and leave the explorer.exe
4. Seek And Destroy the enemy soldiers, no one should be left behind
a. Click on start->search->for files and folders.
b. Their click all files and folders
c. Type “*.exe” as filename to search for
d. Click on ‘when was it modified ‘ option and select the specify date option
e. Type from date as 1/31/2008 and also type To date as 1/31/2008
f.
g. Now hit search and wait for all the exe’s to show up.
h. Once search is over select all the exe files and shift+delete the files, caution must be taken so that you don’t delete the legitimate exe file that you have installed on 31st January.
i. Also selecting lot of files together might make your computer unresponsive so delete them in small bunches.
j. Also find and delete regsvr.exe, svchost .exe( notice an extra space between the svchost and .exe)
5. Time For Celebrations
1. Now do a cold reboot (ie press the reboot button instead) and you are done.
I hope this information helps you win your own battle against this virus. Soon all antivirus programs will be able to automatically detect and clean this virus.
I was surprised that my most reliable friend Kaspersky, for the first time failed me in this war against viruses but then again avg and bitdiffender also failed against it. This virus is know popularly as regsvr.exe virus, or as new folder.exe virus and most people identify this one by seeing autorun.inf file on their pen drives, But trend micro identified it as WORM_DELF.FKZ. It is spreading mostly using pen drives as the medium.
Well, so here is the story of how i was able to kill the monster and reclaim my hard disk space.
Manual Process of removal
I prefer manual process simply because it gives me option to learn new things in the process.
So let’s start the process off reclaiming the turf that virus took over from us.
1. Cut The Supply Line
a. Search for autorun.inf file. It is a read only file so you will have to change it to normal by right clicking the file , selecting the properties and un-check the read only option
b. Open the file in notepad and delete everything and save the file.
c. Now change the file status back to read only mode so that the virus could not get access again.
d.
e. Click start->run and type msconfig and click ok
f. Go to startup tab look for regsvr and uncheck the option click OK.
g. Click on Exit without Restart, cause there are still few things we need to do before we can restart the PC.
h. Now go to control panel -> scheduled tasks, and delete the At1 task listed their.
2. Open The Gates Of Castle
a. Click on start -> run and type gpedit.msc and click Ok.
b.
c. If you are Windows XP Home Edition user you might not have gpedit.msc in that case download and install it from Windows XP Home Edition: gpedit.msc and then follow these steps.
d. Go to users configuration->Administrative templates->system
e. Find “prevent access to registry editing tools” and change the option to disable.
f.
g. Once you do this you have registry access back.
3. Launch The Attack At Heart Of Castle
a. Click on start->run and type regedit and click ok
b. Go to edit->find and start the search for regsvr.exe,
c.
d. Delete all the occurrence of regsvr.exe; remember to take a backup before deleting. KEEP IN MIND regsvr32.exe is not to be deleted. Delete regsvr.exe occurrences only.
e. At one ore two places you will find it after explorer.exe in theses cases only delete the regsvr.exe part and not the whole part. E.g. Shell = “Explorer.exe regsvr.exe” the just delete the regsvr.exe and leave the explorer.exe
4. Seek And Destroy the enemy soldiers, no one should be left behind
a. Click on start->search->for files and folders.
b. Their click all files and folders
c. Type “*.exe” as filename to search for
d. Click on ‘when was it modified ‘ option and select the specify date option
e. Type from date as 1/31/2008 and also type To date as 1/31/2008
f.
g. Now hit search and wait for all the exe’s to show up.
h. Once search is over select all the exe files and shift+delete the files, caution must be taken so that you don’t delete the legitimate exe file that you have installed on 31st January.
i. Also selecting lot of files together might make your computer unresponsive so delete them in small bunches.
j. Also find and delete regsvr.exe, svchost .exe( notice an extra space between the svchost and .exe)
5. Time For Celebrations
1. Now do a cold reboot (ie press the reboot button instead) and you are done.
I hope this information helps you win your own battle against this virus. Soon all antivirus programs will be able to automatically detect and clean this virus.
Thursday, March 11, 2010
ActionScript3: Changing mouse pointer
Simple example shows how to change Mouse-Pointer in Action-Script3
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.ui.Mouse;
public class SwitchOutPointer extends Sprite
{
private var circleMouse:Sprite;
private var squareMouse:Sprite;
private var currentMouse:Sprite;
private var useSquareField:Sprite;
private var useCircleField:Sprite;
public function SwitchOutPointer()
{
super();
useSquareField = new Sprite();
useSquareField.graphics.beginFill(0xFAAAAF, 1);
useSquareField.graphics.drawRect(0, 0, 100, 100);
useSquareField.graphics.endFill();
useSquareField.name = "square";
useSquareField.x = 200;
useCircleField = new Sprite();
useCircleField.graphics.beginFill(0x543454, 1);
useCircleField.graphics.drawRect(0, 0, 100, 100);
useCircleField.name = "circle";
useCircleField.graphics.endFill();
addChild(useCircleField);
addChild(useSquareField);
//here I add my event listeners to the respective sprites
useCircleField.addEventListener(MouseEvent.ROLL_OVER, useCircle);
useSquareField.addEventListener(MouseEvent.ROLL_OVER, useSquare);
useCircleField.addEventListener(MouseEvent.ROLL_OUT, showMouse);
useSquareField.addEventListener(MouseEvent.ROLL_OUT, showMouse);
//now I'm creating the object thats going to replace
//my mouse when we're over certain sprites
circleMouse = new Sprite();
circleMouse.graphics.beginFill(0x00ff00, 1);
circleMouse.graphics.drawCircle(0, 0, 5);
circleMouse.graphics.endFill();
currentMouse = new Sprite();
squareMouse = new Sprite();
squareMouse.graphics.beginFill(0xff0000, 1);
squareMouse.graphics.drawRect(0, 0, 10, 10);
squareMouse.graphics.endFill();
//now I want to listen to ALL mouse movement events
//so that I can reposition the mouse
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, moveNewMouse);
}
/* move whatever mouse is the current mouse to the mouse's stage
* position. note how I offset the position slightly this is because
* the rollOff event of the useSquareField and useCircleField will be
* fired if the circleMouse or squareMouse object is in between the
* mouse and the useSquareField or useCircleField object. */
private function moveNewMouse(mouseEvent:MouseEvent):void
{
currentMouse.x = mouseEvent.stageX + 5;
currentMouse.y = mouseEvent.stageY + 5;
mouseEvent.updateAfterEvent();
}
private function useSquare(mouseEvent:MouseEvent):void
{
Mouse.hide();
addChild(squareMouse);
currentMouse = squareMouse;
}
private function useCircle(mouseEvent:MouseEvent):void
{
Mouse.hide();
addChild(circleMouse);
currentMouse = circleMouse;
}
/* if we roll off, then go ahead and remove respective icon
* for the mouse using the target property to figure out which
* one it was and show the normal mouse icon. */
private function showMouse(mouseEvent:MouseEvent):void
{
if((mouseEvent.target as Sprite) == useSquareField)
{
removeChild(squareMouse);
}
else {
removeChild(circleMouse);
}
currentMouse = new Sprite();
Mouse.show();
}
}
}
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.ui.Mouse;
public class SwitchOutPointer extends Sprite
{
private var circleMouse:Sprite;
private var squareMouse:Sprite;
private var currentMouse:Sprite;
private var useSquareField:Sprite;
private var useCircleField:Sprite;
public function SwitchOutPointer()
{
super();
useSquareField = new Sprite();
useSquareField.graphics.beginFill(0xFAAAAF, 1);
useSquareField.graphics.drawRect(0, 0, 100, 100);
useSquareField.graphics.endFill();
useSquareField.name = "square";
useSquareField.x = 200;
useCircleField = new Sprite();
useCircleField.graphics.beginFill(0x543454, 1);
useCircleField.graphics.drawRect(0, 0, 100, 100);
useCircleField.name = "circle";
useCircleField.graphics.endFill();
addChild(useCircleField);
addChild(useSquareField);
//here I add my event listeners to the respective sprites
useCircleField.addEventListener(MouseEvent.ROLL_OVER, useCircle);
useSquareField.addEventListener(MouseEvent.ROLL_OVER, useSquare);
useCircleField.addEventListener(MouseEvent.ROLL_OUT, showMouse);
useSquareField.addEventListener(MouseEvent.ROLL_OUT, showMouse);
//now I'm creating the object thats going to replace
//my mouse when we're over certain sprites
circleMouse = new Sprite();
circleMouse.graphics.beginFill(0x00ff00, 1);
circleMouse.graphics.drawCircle(0, 0, 5);
circleMouse.graphics.endFill();
currentMouse = new Sprite();
squareMouse = new Sprite();
squareMouse.graphics.beginFill(0xff0000, 1);
squareMouse.graphics.drawRect(0, 0, 10, 10);
squareMouse.graphics.endFill();
//now I want to listen to ALL mouse movement events
//so that I can reposition the mouse
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, moveNewMouse);
}
/* move whatever mouse is the current mouse to the mouse's stage
* position. note how I offset the position slightly this is because
* the rollOff event of the useSquareField and useCircleField will be
* fired if the circleMouse or squareMouse object is in between the
* mouse and the useSquareField or useCircleField object. */
private function moveNewMouse(mouseEvent:MouseEvent):void
{
currentMouse.x = mouseEvent.stageX + 5;
currentMouse.y = mouseEvent.stageY + 5;
mouseEvent.updateAfterEvent();
}
private function useSquare(mouseEvent:MouseEvent):void
{
Mouse.hide();
addChild(squareMouse);
currentMouse = squareMouse;
}
private function useCircle(mouseEvent:MouseEvent):void
{
Mouse.hide();
addChild(circleMouse);
currentMouse = circleMouse;
}
/* if we roll off, then go ahead and remove respective icon
* for the mouse using the target property to figure out which
* one it was and show the normal mouse icon. */
private function showMouse(mouseEvent:MouseEvent):void
{
if((mouseEvent.target as Sprite) == useSquareField)
{
removeChild(squareMouse);
}
else {
removeChild(circleMouse);
}
currentMouse = new Sprite();
Mouse.show();
}
}
}
Wednesday, March 10, 2010
AS#: MouseEvents (Basics)
Basic sample code, to illustrate how MouseEvent works in flash-player.
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class MouseEventExample extends Sprite
{
public function MouseEventExample () {
var listner:Sprite = new Sprite();
listner.graphics.beginFill(0x0000ff, 1);
listner.graphics.drawRect(0, 0, 200, 200);
listner.graphics.endFill();
listner.doubleClickEnabled = true;
addChild(listner);
listner.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler)
listner.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler)
listner.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler)
listner.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler)
listner.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler)
listner.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler)
listner.addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler)
}
private function mouseDownHandler(mouseEvent:MouseEvent):void {
trace("mouseDownHandler");
}
private function mouseMoveHandler(mouseEvent:MouseEvent):void {
trace("mouseMoveHandler");
}
private function mouseOutHandler(mouseEvent:MouseEvent):void {
trace("mouseOutHandler");
}
private function mouseUpHandler(mouseEvent:MouseEvent):void {
trace("mouseUpHandler");
}
private function mouseWheelHandler(mouseEvent:MouseEvent):void {
trace("mouseWheelHandler");
}
private function mouseOverHandler(mouseEvent:MouseEvent):void {
trace("mouseOverHandler");
}
private function doubleClickHandler(mouseEvent:MouseEvent):void {
trace("doubleClickHandler");
}
public override function toString():String {
return "";
}
}
}
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
public class MouseEventExample extends Sprite
{
public function MouseEventExample () {
var listner:Sprite = new Sprite();
listner.graphics.beginFill(0x0000ff, 1);
listner.graphics.drawRect(0, 0, 200, 200);
listner.graphics.endFill();
listner.doubleClickEnabled = true;
addChild(listner);
listner.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler)
listner.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler)
listner.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler)
listner.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler)
listner.addEventListener(MouseEvent.MOUSE_WHEEL, mouseWheelHandler)
listner.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler)
listner.addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler)
}
private function mouseDownHandler(mouseEvent:MouseEvent):void {
trace("mouseDownHandler");
}
private function mouseMoveHandler(mouseEvent:MouseEvent):void {
trace("mouseMoveHandler");
}
private function mouseOutHandler(mouseEvent:MouseEvent):void {
trace("mouseOutHandler");
}
private function mouseUpHandler(mouseEvent:MouseEvent):void {
trace("mouseUpHandler");
}
private function mouseWheelHandler(mouseEvent:MouseEvent):void {
trace("mouseWheelHandler");
}
private function mouseOverHandler(mouseEvent:MouseEvent):void {
trace("mouseOverHandler");
}
private function doubleClickHandler(mouseEvent:MouseEvent):void {
trace("doubleClickHandler");
}
public override function toString():String {
return "";
}
}
}
ActionScript3: EventFlow
Guys welcome back....
The below code will illustrate, how EVENT-FLOW mechanism works in AS3.
Just make two files naming -
EventFlow.as and
Button.as
Copy-paste the below written code, execute the EventFlow.swf, and watch the trace() results in debugger. You will surely get an-practical idea, how the event-flow works in ActionScript3.
EventFlow.as
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
public class EventFlow extends Sprite
{
private var uiContainer:Sprite;
private var buttonContainer:Sprite;
private var uiLabel:TextField;
private var stopButton:Button;
private var playButton:Button;
private var pauseButton:Button;
public function EventFlow () {
uiContainer = new Sprite();
uiContainer.name = "uiContainer";
addChild(uiContainer);
buttonContainer = new Sprite();
buttonContainer.graphics.beginFill(0x666666);
buttonContainer.graphics.drawRect(0, 0, 420, 50);
buttonContainer.name = "buttonContainer";
buttonContainer.y = 20;
uiContainer.addChild(buttonContainer);
uiLabel = new TextField();
uiLabel.name = "uiLabel";
uiLabel.text = "Audio Controls";
uiLabel.width = 80;
uiLabel.height = 15;
uiContainer.addChild(uiLabel);
stopButton = new Button("Stop");
stopButton.x = 10;
stopButton.y = 10;
buttonContainer.addChild(stopButton);
playButton = new Button("Play");
playButton.x = 160;
playButton.y = 10;
buttonContainer.addChild(playButton);
pauseButton = new Button("Pause");
pauseButton.x = 310;
pauseButton.y = 10;
buttonContainer.addChild(pauseButton);
uiContainer.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(event:MouseEvent):void {
trace ("Click Received");
trace ("Event Target: ", DisplayObject(event.target).name);
trace ("Current Target: ", DisplayObject(event.currentTarget).name);
}
public override function toString():String {
return "";
}
}
}
Button.as
package
{
import flash.display.Sprite;
import flash.text.TextField;
public class Button extends Sprite
{
private var labelField:TextField;
public function Button (label:String = "button") {
graphics.beginFill(0x3366CC);
graphics.drawRect(0, 0, 100, 30);
labelField = new TextField();
labelField.mouseEnabled = false;
labelField.selectable = false;
labelField.text = label;
labelField.x = 10;
labelField.y = 10;
labelField.width = 80;
labelField.height = 20;
addChild(labelField);
}
}
}
The below code will illustrate, how EVENT-FLOW mechanism works in AS3.
Just make two files naming -
EventFlow.as and
Button.as
Copy-paste the below written code, execute the EventFlow.swf, and watch the trace() results in debugger. You will surely get an-practical idea, how the event-flow works in ActionScript3.
EventFlow.as
package
{
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
public class EventFlow extends Sprite
{
private var uiContainer:Sprite;
private var buttonContainer:Sprite;
private var uiLabel:TextField;
private var stopButton:Button;
private var playButton:Button;
private var pauseButton:Button;
public function EventFlow () {
uiContainer = new Sprite();
uiContainer.name = "uiContainer";
addChild(uiContainer);
buttonContainer = new Sprite();
buttonContainer.graphics.beginFill(0x666666);
buttonContainer.graphics.drawRect(0, 0, 420, 50);
buttonContainer.name = "buttonContainer";
buttonContainer.y = 20;
uiContainer.addChild(buttonContainer);
uiLabel = new TextField();
uiLabel.name = "uiLabel";
uiLabel.text = "Audio Controls";
uiLabel.width = 80;
uiLabel.height = 15;
uiContainer.addChild(uiLabel);
stopButton = new Button("Stop");
stopButton.x = 10;
stopButton.y = 10;
buttonContainer.addChild(stopButton);
playButton = new Button("Play");
playButton.x = 160;
playButton.y = 10;
buttonContainer.addChild(playButton);
pauseButton = new Button("Pause");
pauseButton.x = 310;
pauseButton.y = 10;
buttonContainer.addChild(pauseButton);
uiContainer.addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(event:MouseEvent):void {
trace ("Click Received");
trace ("Event Target: ", DisplayObject(event.target).name);
trace ("Current Target: ", DisplayObject(event.currentTarget).name);
}
public override function toString():String {
return "";
}
}
}
Button.as
package
{
import flash.display.Sprite;
import flash.text.TextField;
public class Button extends Sprite
{
private var labelField:TextField;
public function Button (label:String = "button") {
graphics.beginFill(0x3366CC);
graphics.drawRect(0, 0, 100, 30);
labelField = new TextField();
labelField.mouseEnabled = false;
labelField.selectable = false;
labelField.text = label;
labelField.x = 10;
labelField.y = 10;
labelField.width = 80;
labelField.height = 20;
addChild(labelField);
}
}
}
ActionScript3: EventDispatcher with simple example
package
{
import flash.display.Sprite;
import flash.events.*;
public class App1 extends Sprite{
public function App1() {
var x:Thermometer = new Thermometer();
x.addEventListener(Thermometer.TEMP_CHANGED, onTempChanged);
trace (" Value: ");
x.temp=10;
}
private function onTempChanged(event:Event):void {
var thermometer:Thermometer = Thermometer(event.target);
trace (thermometer.temp + "F");
}
}
}
import flash.events.*;
class Thermometer extends EventDispatcher
{
private var _temp:Number = 32;
public static const TEMP_CHANGED:String = "temChanged";
public function set temp(newTemp:Number):void {
_temp = newTemp;
trace ("Fired TEMP_CHANGED");
dispatchEvent(new Event(TEMP_CHANGED));
}
public function get temp():Number {
return _temp;
}
public function Thermometer() {
}
}
{
import flash.display.Sprite;
import flash.events.*;
public class App1 extends Sprite{
public function App1() {
var x:Thermometer = new Thermometer();
x.addEventListener(Thermometer.TEMP_CHANGED, onTempChanged);
trace (" Value: ");
x.temp=10;
}
private function onTempChanged(event:Event):void {
var thermometer:Thermometer = Thermometer(event.target);
trace (thermometer.temp + "F");
}
}
}
import flash.events.*;
class Thermometer extends EventDispatcher
{
private var _temp:Number = 32;
public static const TEMP_CHANGED:String = "temChanged";
public function set temp(newTemp:Number):void {
_temp = newTemp;
trace ("Fired TEMP_CHANGED");
dispatchEvent(new Event(TEMP_CHANGED));
}
public function get temp():Number {
return _temp;
}
public function Thermometer() {
}
}
Nuts and bolts to ActionScript3: Bouncing Ball
package
{
import flash.display.Sprite;
import flash.events.*;
public class App1 extends Sprite
{
private var ballOne:Sprite;
private var ballTwo:Sprite;
private var direction:int =1;
public function App1 () {
ballOne = new Sprite();
ballOne.graphics.beginFill(0xff0000, 1);
ballOne.graphics.drawCircle(0, 0, 30);
ballOne.graphics.endFill();
ballTwo = new Sprite();
ballTwo.graphics.beginFill(0xff0000, 1);
ballTwo.graphics.drawCircle(0, 0, 30);
ballTwo.graphics.endFill();
addChild(ballOne);
addChild(ballTwo);
ballOne.x = 300;
ballTwo.x = 200;
ballOne.y = 5;
ballTwo.y = 5;
ballOne.addEventListener(Event.ENTER_FRAME, bounce);
ballTwo.addEventListener(Event.ENTER_FRAME, bounce);
}
private function bounce(event:Event):void {
var target:Sprite = event.target as Sprite;
try {
if (target.y == 400) {
direction = -10;
}
if (target.y == 40) {
direction = 10;
}
if (target.y < 500 && target.y > 0) {
trace (target.y + " : " + direction);
target.y += direction;
}
}
catch (err:Error) {
trace ("opppps...");
}
}
public override function toString():String {
return "";
}
}
}
{
import flash.display.Sprite;
import flash.events.*;
public class App1 extends Sprite
{
private var ballOne:Sprite;
private var ballTwo:Sprite;
private var direction:int =1;
public function App1 () {
ballOne = new Sprite();
ballOne.graphics.beginFill(0xff0000, 1);
ballOne.graphics.drawCircle(0, 0, 30);
ballOne.graphics.endFill();
ballTwo = new Sprite();
ballTwo.graphics.beginFill(0xff0000, 1);
ballTwo.graphics.drawCircle(0, 0, 30);
ballTwo.graphics.endFill();
addChild(ballOne);
addChild(ballTwo);
ballOne.x = 300;
ballTwo.x = 200;
ballOne.y = 5;
ballTwo.y = 5;
ballOne.addEventListener(Event.ENTER_FRAME, bounce);
ballTwo.addEventListener(Event.ENTER_FRAME, bounce);
}
private function bounce(event:Event):void {
var target:Sprite = event.target as Sprite;
try {
if (target.y == 400) {
direction = -10;
}
if (target.y == 40) {
direction = 10;
}
if (target.y < 500 && target.y > 0) {
trace (target.y + " : " + direction);
target.y += direction;
}
}
catch (err:Error) {
trace ("opppps...");
}
}
public override function toString():String {
return "";
}
}
}
Wednesday, March 3, 2010
Make your notepad more exciting....!
A Notepad
that writes on it own is for sure a very weird thing but very funny in the same time. And if you change the icon
of the file you create with the Notepad's, and replace the Notepad icon from your friend's computer with this file for sure you will create a great prank.
1. Open Notepad.
2. Copy this script in Notepad:
[PHP]set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run "Notepad"
wscript.sleep 2000
wshshell.AppActivate "Notepad"
WshShell.SendKeys "H"
WScript.Sleep 500
WshShell.SendKeys "ell"
WScript.Sleep 500
WshShell.SendKeys "o "[/PHP]
The little program will make your Notepad type "Hello". You can always make your custom message by replacing the letters between the " " signs with the ones you want.
You can add more lines like the following ones for more letters:
WScript.Sleep 500
WshShell.SendKeys "insert here your letter of group of letters "
3. Now save the file. Go to File->Save as. Type the name of the file with the extension .vbs. For example if you want to choose the name Notepad, type Notepad.vbs. Also be sure that File type is All files not Text file!
The file will look like this.
4. When you doubleclick on it, Notepad will start typing letters.
that writes on it own is for sure a very weird thing but very funny in the same time. And if you change the icon
of the file you create with the Notepad's, and replace the Notepad icon from your friend's computer with this file for sure you will create a great prank.
1. Open Notepad.
2. Copy this script in Notepad:
[PHP]set wshshell = wscript.CreateObject("wscript.shell")
wshshell.run "Notepad"
wscript.sleep 2000
wshshell.AppActivate "Notepad"
WshShell.SendKeys "H"
WScript.Sleep 500
WshShell.SendKeys "ell"
WScript.Sleep 500
WshShell.SendKeys "o "[/PHP]
The little program will make your Notepad type "Hello". You can always make your custom message by replacing the letters between the " " signs with the ones you want.
You can add more lines like the following ones for more letters:
WScript.Sleep 500
WshShell.SendKeys "insert here your letter of group of letters "
3. Now save the file. Go to File->Save as. Type the name of the file with the extension .vbs. For example if you want to choose the name Notepad, type Notepad.vbs. Also be sure that File type is All files not Text file!
The file will look like this.
4. When you doubleclick on it, Notepad will start typing letters.
Sunday, February 21, 2010
51- Few Flex Interview Questions....
Q 1. Types of Binding
Ans: Using the curly braces ({}) syntax
Using ActionScript expressions in curly braces
Using the tag in MXML
Using bindings in ActionScript(BindingUtils)
Q 2. How to create your own event
Ans: Creating a subclass from the Event class
Using the Event metadata tag
Dispatching an event
Q 3. Event Bubbling
Ans: The mechanism through which event objects are passed from the objects that generates an event up through the containership hierarchy
Q 4. Life cycle of Flex Application/Component?
Ans: Preinitialize: The application has been instantiated but has not yet created any child components.
Initialize: The application has created child components but has not yet laid out those components.
creationComplete: The application has been completely instantiated and has laid out all components
Q 5. How you implement MVC in your Application
Ans: Cairngorm is based on the MVC model. It is specifically designed to facilitate complex state and data synchronization between the client and the server, while keeping the programming of the View layer detached from the data implementation.
The role of the View layer in a Cairngorm application is to throw events and bind to data stored in the Model. Components on the View can bind to Value Objects or other properties in the Model (data) layer.
In a Cairngorm Model, related data are stored in Value Objects (VOs), while simple variables can be stored as direct properties of the ModelLocator class. A static reference to the ModelLocator singleton instance is used by the View layers to locate the required data.
The Controller is the most sophisticated part of the Cairngorm architecture. The Controller layer is implemented as a singleton FrontController. The FrontController instance, which receives every View-generated event, dispatches the events to the assigned Command class based on the event's declared type.
The Command class then processes the event by running the Command class' execute() method, which is an ICommand interface method. The event object may include additional data if required by the developer. The execute() method can update the central Model, as well as invoke a Service class which typically involves communication with a remote server. The IResponder interface, which is also implemented by the Command class, includes onResult and onFault methods to handle responses returned from the invoked remote service.
Q 6. Difference btw Java and Flex Getters Setters
Ans: When it comes to getters and setters, Java and AS are quite different, in that getters and setters are part of the core ECMAScript language, whereas in Java, getters and setters are done through a naming convention.
In Java, it is almost never a good idea to make member variables public. If you do decide to make member variables public and then later want to change the interface to use getter/setter functions, you will have to modify all callers of your interfaces, which is onerous at best and in many cases, not possible (expecially when you are creating code that is used by other people).
Meanwhile, in ECMAScript, the externally visible interface doesn’t change when I go from a member variable to a getter/setter and back again. In some sense, the interface hiding is already accomplished in the language. Creating public member variables is “safe” in this sense.
Perhaps this is already obvious to all the AS-heads out there, but it took me a bit of time to get used to the concept.
Q 7. How many events are fired when your focus goes in one text box, you enter some text and then press tab.
Ans: PreinitializeHandler(), initializeHandler(), itemEditBegin, itemEditEnd, creationComplete()
Q 8. How you use styles different ways of using Style sheet
Ans: Using external style sheets, Using local style definitions, Using the StyleManager class ,Using the setStyle() and getStyle() methods, Using inline stylesLoading style sheets at run time
Q 9. How can you use two Styles at the same time
Ans: Using external style sheets and use Inline style commands
Q 10. Try to remember properties of few imp components
Ans:
< id="WeatherService" wsdl="http:/example.com/ws/WeatherService?wsdl" useproxy="false">
< !-- Bind the value of the ZIP code entered in the TextInput control to the ZipCode parameter of the GetWeather operation. -->
< name="GetWeather">
<>{zip.text}
< /mx:request>
< /mx:operation>
Q 11. What is the difference between Flex 2.0 and Flex 3.0
Ans: Enhanced Features like Faster compilation time, SWF file size reduction, Flex/Ajax bridge, Advanced Datagrid, Interactive debugging, Cross-Domain, Versionable, Easy to Use,Security and Code Signing,Failover and Hosting,Cross-Domain RSL, Advanced DatagridDeep Linking, Resource Bundles and Runtime Localization, Flex Component Kit for Flash CS3, Compilation, Language IntelligenceRefactoring, Class Outline,Code Search, Profiler, Module Support, Multiple SDK Support, Skin Importer, Design View Zoom/Pan,Design Mode support for ItemRenderers, Advanced Constraints, CS3 Suite integration, CSS Outline, CSS Design View, Flex 3 SDK Skinning/Style Enhancements
Q 12. How will you call Java method from Flex?
Ans: Using RemoteObject. Explain the process to interviewer
Q 13. What are the config files used for connecting Java and Flex?
Ans:
data-management-config.xml,
messaging-config.xml,
proxy-config.xml,
remoting-config.xml,
services-config.xml
Q 14. What are the channels and their types
Ans: The Channel class is the base message channel class that all channels in the messaging system must extend.
Channels are specific protocol-based conduits for messages sent between MessageAgents and remote destinations. Preconfigured channels are obtained within the framework using the ServerConfig.getChannel() method. You can create a Channel directly using the new operator and add it to a ChannelSet directly
In Flex AMFChannel is used mostly. Action Message Format
Methods
applySettings (),connect(),connectFailed(),connectSuccess(), connectTimeoutHandler()
disconnect(),disconnectFailed(),disconnectSuccess(),flexClientWaitHandler(), getMessageResponder(),internalConnect(),internalDisconnect(),internalSend(),logout()
send(),setCredentials()
Properties
authenticated,channelSets,connected,connectTimeout,endpoint,failoverURIs,protocol,
reconnecting,recordMessageSizes,recordMessageTimes,requestTimeout,uri
Q 15. Give the name of Collection which can be mapped to java and Flex and vice-versa
Ans: java.lang.String String
java.lang.Boolean, boolean Boolean
java.lang.Integer, int int
java.lang.Short, short int
java.lang.Byte, byte[] int
java.lang.Byte[] flash.utils.ByteArray
java.lang.Double, double Number
java.lang.Long, long Number
java.lang.Float, float Number
java.lang.Character, char String
java.lang.Character[], char[] String
java. math.BigInteger String
java.math.BigDecimal String
java.util.Calendar Date
java.util.Date Date
java.util.Collection mx.collections.ArrayCollection(for example, java.util.ArrayList)java.lang.Object[] Arrayjava.util.Map Object (untyped). For example, a java.util.Map[] is converted to an array (of objects).
java.util.Dictionary Object (untyped)
org.w3c.dom.Document XML object
java.lang.Object (other than previously listed types) Typed Object
Objects are serialized by using JavaBean introspection rules and also include public fields. Fields that are static, transient, or nonpublic, as well as bean properties that are nonpublic or static, are excluded.
Q 16. How can you call JavaScript from MXML
Ans: IExternalInterface.call()
Q 17. How can you access a var defined in 1 MXML flex in to another MXML file
Ans: Create 1 object of MXML fiel into another MXML File
Q 18. Is it possible to make httpService Requests synchronous?
Ansvar mytoken:AsyncToken = yourservice.send();
mytoken.addResponder(new ItemResponder(function,errorFunction));
OR
You can create a result handler to your HTTPService.
remoteObjectName.Your method
name.addEventListener("result",HandlerFunction,false,0,true);
Q 19. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
Ans: every SWF file you view runs locally on your machine. This means that a SWF would have HTTP access to all machines behind the company firewall. To prevent this, every server other than the one the SWF is loaded from, needs to have a crossdomain.xml file in its root, listing all domains that have access to that particular server
Q 20. What is the difference between httpService and Data Service?
Basically, Flex allows three types of RPC services: HttpService, WebServices, and RemoteObject Services. In Flex, using the “RemoteObjects specifies named or unnamed sources and connects to an Action Message Format (AMF) gateway, whereas using the HTTPService and WebService use named services or raw URLs and connect to an HTTP proxy using text-based query parameters or XML”. Specifically, HTTPServices use raw HTTP requests, WebServices use the SOAP protocol and RemoteObjects uses AMF3.
Q 21. How do you generate random numbers within a given limit with actionscript?
Ans:var randNum:Number = Math.random()*100;
Q 22. Have you built any components with actionscript? If so explain how you did it?
Ans:
package myComponents{
import mx.controls.Button;
public class MyButton extends Button {
public function MyButton() {
super();
label="Submit";
}}}
Q 23. How do you implement push on a flex applications?
Ans
Messaging systems let separate applications communicate asynchronously as peers by passing packets of data called messages back and forth through a Message Service. A message usually consists of a header and a body. The header contains an identifier and routing information. The body contains application data.
So, you will be building an application that allows you to asynchronously send data through the DS message service to our Flex client application. Here are some key DS messaging terms:
Producer: Producers are applications that create/send messages to the destination.
Consumer: Consumers are applications that receive messages from the destination.
Message Destination: Destinations are the resources used for both publish-subscribe and point-to-point messaging.
Message Channel: The channel is the method for connecting producers and consumers to the destination (using an endpoint).
Message Endpoint: An endpoint is the interface responsible for encoding and decoding data into messages.
Message Adaptor: The adaptor defines the messaging implementation. Options include using the ActionScriptAdapter provided with DS, or an external Java Message Service (JMS) provider.
Q 24. I am going to add images into a tag. How will it resize itself?
Q 25. What is a resource Manager??
Q 26. What are the similarities between java and flex?
Q 27. What is the dynamic keyword used for?
Q 28. How do you implement push with flex data services?
Q 29. What are the methods called when a UI component is intialized?
Q 30. How do you implement drag and drop on components that do not support ondrag and ondrop?
Q 31. Can you write to the file system from flex?
Q 32. What is a drag manager?
Ans: Manages the drag-and-drop operations; for example, its doDrag() method starts the drag operation.
Q 33. How do you call javascript from Flex?
Ans:flash.external.ExternalInterface.call(function_name: String[, arg1, ...]):Object;
Q 34. How do you use a repeater?
Ans:
< id="rp" dataprovider="{dp}">
< height="49" width="50" click="Alert.show(String (event.currentTarget.getRepeaterItem()) + ' pressed')" label="{String (rp.currentItem)}">
< /mx:repeater>
Q 35. What are three ways to skin a component in flex?
Ans: Graphical skins: Images that define the appearance of the skin. These images can JPEG, GIF, or PNG files, or they can be symbols embedded in SWF files. Typically you use drawing software such as Adobe® PhotoShop® or Adobe® Illustrator® to create graphical skins.
Programmatic skins: ActionScript or MXML classes that define a skin. To change the appearance of controls that use programmatic skins, you edit an ActionScript or MXML file. You can use a single class to define multiple skins.
Stateful skins: A type of programmatic skin that uses view states, where each view state corresponds to a state of the component.The definition of the view state controls the look of the skin. Since you can have multiple view states in a component, you can use a single component to define multiple skins.
Q 36. How do you use css styles in flex?
Ans: Using external style sheets, Using local style definitions, Using the StyleManager class ,Using the setStyle() and getStyle() methods, Using inline stylesLoading style sheets at run time.
Q 37. What is the difference between sealed class and dynamic classes?
Ans: Sealed Classes: ActionScript 3.0 introduces the concept of sealed classes. A sealed class possesses only the fixed set of properties and methods that were defined at compile time; additional properties and methods cannot be added. This enables stricter compile-time checking, resulting in more robust programs. It also improves memory usage by not requiring an internal hash table for each object instance. Dynamic classes are also possible using the dynamic keyword. All classes in ActionScript 3.0 are sealed by default, but can be declared to be dynamic with the dynamic keyword.
Dynamic classes A dynamic class defines an object that can be altered at run time by adding or changing properties and methods. A class that is not dynamic, such as the String class, is a sealed class. You cannot add properties or methods to a sealed class at run time.
dynamic class Protean
{ //Use dynamic keyword before the name of class
}
Q 38. What is e4X and XML?
Ans: E4X means "ECMAScript For XML
Using E4X, we can develop code with XML data faster than was possible with previous programming techniques. E4X provides a set of classes and functionality for working with XML data. ActionScript 3.0 includes the following E4X classes: XML, XMLList, QName, and Namespace.
Here is an example of manipulating data with E4X:
var myXML:XML =
<>
< id="'1'">
<>burger
<>3.95
< /item>
< id="'2'">
<>fries
<>1.45
< /item>
< /order>
trace (myXML.item[0].menuName); // Output: burger
trace (myXML.item.(@id==2).menuName); // Output: fries
trace (myXML.item.(menuName=="burger").price); // Output: 3.95
Q 39. What is state? What is the difference between states and ViewStack?
Ans:View Stack is to handle different MXML file eg TAB control, and states is the transition within single MXML file
Q 40. How does item renderer work? How do I add item renderer at runtime?
Q 41.. What keyword allows you to refer to private variables of a class?
Q 42. How polymorphism works on actionscript?
Q 43.. How do you overload functions in actionscript?
Q 44. What is dynamic keyword used for?
Ans: Those Classes which should be extended and changed are called Dynamic classes
Q 45. What are sealed classes?
Ans: Classes whichyou cant extend. ex String
Q 46. What are runtime shared libraries?
Q 47. What is caringhorm? How do you use it? Have you worked with Cairngorms?
Q 48. What keyword allows you to implement abstraction better?
Q 49. What design patterns have you used? In Actionscript and java?
Q 50. What's the difference between Java and AS3 getters and setters? Ans: I have to explicitly call a setter/getter function in Java, while AS3 allows me to Access my setters and getters as though they are variables.
Q 51. Explain the component lifecycle.
Ans: Using the curly braces ({}) syntax
Using ActionScript expressions in curly braces
Using the tag in MXML
Using bindings in ActionScript(BindingUtils)
Q 2. How to create your own event
Ans: Creating a subclass from the Event class
Using the Event metadata tag
Dispatching an event
Q 3. Event Bubbling
Ans: The mechanism through which event objects are passed from the objects that generates an event up through the containership hierarchy
Q 4. Life cycle of Flex Application/Component?
Ans: Preinitialize: The application has been instantiated but has not yet created any child components.
Initialize: The application has created child components but has not yet laid out those components.
creationComplete: The application has been completely instantiated and has laid out all components
Q 5. How you implement MVC in your Application
Ans: Cairngorm is based on the MVC model. It is specifically designed to facilitate complex state and data synchronization between the client and the server, while keeping the programming of the View layer detached from the data implementation.
The role of the View layer in a Cairngorm application is to throw events and bind to data stored in the Model. Components on the View can bind to Value Objects or other properties in the Model (data) layer.
In a Cairngorm Model, related data are stored in Value Objects (VOs), while simple variables can be stored as direct properties of the ModelLocator class. A static reference to the ModelLocator singleton instance is used by the View layers to locate the required data.
The Controller is the most sophisticated part of the Cairngorm architecture. The Controller layer is implemented as a singleton FrontController. The FrontController instance, which receives every View-generated event, dispatches the events to the assigned Command class based on the event's declared type.
The Command class then processes the event by running the Command class' execute() method, which is an ICommand interface method. The event object may include additional data if required by the developer. The execute() method can update the central Model, as well as invoke a Service class which typically involves communication with a remote server. The IResponder interface, which is also implemented by the Command class, includes onResult and onFault methods to handle responses returned from the invoked remote service.
Q 6. Difference btw Java and Flex Getters Setters
Ans: When it comes to getters and setters, Java and AS are quite different, in that getters and setters are part of the core ECMAScript language, whereas in Java, getters and setters are done through a naming convention.
In Java, it is almost never a good idea to make member variables public. If you do decide to make member variables public and then later want to change the interface to use getter/setter functions, you will have to modify all callers of your interfaces, which is onerous at best and in many cases, not possible (expecially when you are creating code that is used by other people).
Meanwhile, in ECMAScript, the externally visible interface doesn’t change when I go from a member variable to a getter/setter and back again. In some sense, the interface hiding is already accomplished in the language. Creating public member variables is “safe” in this sense.
Perhaps this is already obvious to all the AS-heads out there, but it took me a bit of time to get used to the concept.
Q 7. How many events are fired when your focus goes in one text box, you enter some text and then press tab.
Ans: PreinitializeHandler(), initializeHandler(), itemEditBegin, itemEditEnd, creationComplete()
Q 8. How you use styles different ways of using Style sheet
Ans: Using external style sheets, Using local style definitions, Using the StyleManager class ,Using the setStyle() and getStyle() methods, Using inline stylesLoading style sheets at run time
Q 9. How can you use two Styles at the same time
Ans: Using external style sheets and use Inline style commands
Q 10. Try to remember properties of few imp components
Ans:
< id="WeatherService" wsdl="http:/example.com/ws/WeatherService?wsdl" useproxy="false">
< !-- Bind the value of the ZIP code entered in the TextInput control to the ZipCode parameter of the GetWeather operation. -->
< name="GetWeather">
<>{zip.text}
< /mx:request>
< /mx:operation>
Q 11. What is the difference between Flex 2.0 and Flex 3.0
Ans: Enhanced Features like Faster compilation time, SWF file size reduction, Flex/Ajax bridge, Advanced Datagrid, Interactive debugging, Cross-Domain, Versionable, Easy to Use,Security and Code Signing,Failover and Hosting,Cross-Domain RSL, Advanced DatagridDeep Linking, Resource Bundles and Runtime Localization, Flex Component Kit for Flash CS3, Compilation, Language IntelligenceRefactoring, Class Outline,Code Search, Profiler, Module Support, Multiple SDK Support, Skin Importer, Design View Zoom/Pan,Design Mode support for ItemRenderers, Advanced Constraints, CS3 Suite integration, CSS Outline, CSS Design View, Flex 3 SDK Skinning/Style Enhancements
Q 12. How will you call Java method from Flex?
Ans: Using RemoteObject. Explain the process to interviewer
Q 13. What are the config files used for connecting Java and Flex?
Ans:
data-management-config.xml,
messaging-config.xml,
proxy-config.xml,
remoting-config.xml,
services-config.xml
Q 14. What are the channels and their types
Ans: The Channel class is the base message channel class that all channels in the messaging system must extend.
Channels are specific protocol-based conduits for messages sent between MessageAgents and remote destinations. Preconfigured channels are obtained within the framework using the ServerConfig.getChannel() method. You can create a Channel directly using the new operator and add it to a ChannelSet directly
In Flex AMFChannel is used mostly. Action Message Format
Methods
applySettings (),connect(),connectFailed(),connectSuccess(), connectTimeoutHandler()
disconnect(),disconnectFailed(),disconnectSuccess(),flexClientWaitHandler(), getMessageResponder(),internalConnect(),internalDisconnect(),internalSend(),logout()
send(),setCredentials()
Properties
authenticated,channelSets,connected,connectTimeout,endpoint,failoverURIs,protocol,
reconnecting,recordMessageSizes,recordMessageTimes,requestTimeout,uri
Q 15. Give the name of Collection which can be mapped to java and Flex and vice-versa
Ans: java.lang.String String
java.lang.Boolean, boolean Boolean
java.lang.Integer, int int
java.lang.Short, short int
java.lang.Byte, byte[] int
java.lang.Byte[] flash.utils.ByteArray
java.lang.Double, double Number
java.lang.Long, long Number
java.lang.Float, float Number
java.lang.Character, char String
java.lang.Character[], char[] String
java. math.BigInteger String
java.math.BigDecimal String
java.util.Calendar Date
java.util.Date Date
java.util.Collection mx.collections.ArrayCollection(for example, java.util.ArrayList)java.lang.Object[] Arrayjava.util.Map Object (untyped). For example, a java.util.Map[] is converted to an array (of objects).
java.util.Dictionary Object (untyped)
org.w3c.dom.Document XML object
java.lang.Object (other than previously listed types) Typed Object
Objects are serialized by using JavaBean introspection rules and also include public fields. Fields that are static, transient, or nonpublic, as well as bean properties that are nonpublic or static, are excluded.
Q 16. How can you call JavaScript from MXML
Ans: IExternalInterface.call()
Q 17. How can you access a var defined in 1 MXML flex in to another MXML file
Ans: Create 1 object of MXML fiel into another MXML File
Q 18. Is it possible to make httpService Requests synchronous?
Ansvar mytoken:AsyncToken = yourservice.send();
mytoken.addResponder(new ItemResponder(function,errorFunction));
OR
You can create a result handler to your HTTPService.
remoteObjectName.Your method
name.addEventListener("result",HandlerFunction,false,0,true);
Q 19. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
Ans: every SWF file you view runs locally on your machine. This means that a SWF would have HTTP access to all machines behind the company firewall. To prevent this, every server other than the one the SWF is loaded from, needs to have a crossdomain.xml file in its root, listing all domains that have access to that particular server
Q 20. What is the difference between httpService and Data Service?
Basically, Flex allows three types of RPC services: HttpService, WebServices, and RemoteObject Services. In Flex, using the “RemoteObjects specifies named or unnamed sources and connects to an Action Message Format (AMF) gateway, whereas using the HTTPService and WebService use named services or raw URLs and connect to an HTTP proxy using text-based query parameters or XML”. Specifically, HTTPServices use raw HTTP requests, WebServices use the SOAP protocol and RemoteObjects uses AMF3.
Q 21. How do you generate random numbers within a given limit with actionscript?
Ans:var randNum:Number = Math.random()*100;
Q 22. Have you built any components with actionscript? If so explain how you did it?
Ans:
package myComponents{
import mx.controls.Button;
public class MyButton extends Button {
public function MyButton() {
super();
label="Submit";
}}}
Q 23. How do you implement push on a flex applications?
Ans
Messaging systems let separate applications communicate asynchronously as peers by passing packets of data called messages back and forth through a Message Service. A message usually consists of a header and a body. The header contains an identifier and routing information. The body contains application data.
So, you will be building an application that allows you to asynchronously send data through the DS message service to our Flex client application. Here are some key DS messaging terms:
Producer: Producers are applications that create/send messages to the destination.
Consumer: Consumers are applications that receive messages from the destination.
Message Destination: Destinations are the resources used for both publish-subscribe and point-to-point messaging.
Message Channel: The channel is the method for connecting producers and consumers to the destination (using an endpoint).
Message Endpoint: An endpoint is the interface responsible for encoding and decoding data into messages.
Message Adaptor: The adaptor defines the messaging implementation. Options include using the ActionScriptAdapter provided with DS, or an external Java Message Service (JMS) provider.
Q 24. I am going to add images into a tag. How will it resize itself?
Q 25. What is a resource Manager??
Q 26. What are the similarities between java and flex?
Q 27. What is the dynamic keyword used for?
Q 28. How do you implement push with flex data services?
Q 29. What are the methods called when a UI component is intialized?
Q 30. How do you implement drag and drop on components that do not support ondrag and ondrop?
Q 31. Can you write to the file system from flex?
Q 32. What is a drag manager?
Ans: Manages the drag-and-drop operations; for example, its doDrag() method starts the drag operation.
Q 33. How do you call javascript from Flex?
Ans:flash.external.ExternalInterface.call(function_name: String[, arg1, ...]):Object;
Q 34. How do you use a repeater?
Ans:
< id="rp" dataprovider="{dp}">
< height="49" width="50" click="Alert.show(String (event.currentTarget.getRepeaterItem()) + ' pressed')" label="{String (rp.currentItem)}">
< /mx:repeater>
Q 35. What are three ways to skin a component in flex?
Ans: Graphical skins: Images that define the appearance of the skin. These images can JPEG, GIF, or PNG files, or they can be symbols embedded in SWF files. Typically you use drawing software such as Adobe® PhotoShop® or Adobe® Illustrator® to create graphical skins.
Programmatic skins: ActionScript or MXML classes that define a skin. To change the appearance of controls that use programmatic skins, you edit an ActionScript or MXML file. You can use a single class to define multiple skins.
Stateful skins: A type of programmatic skin that uses view states, where each view state corresponds to a state of the component.The definition of the view state controls the look of the skin. Since you can have multiple view states in a component, you can use a single component to define multiple skins.
Q 36. How do you use css styles in flex?
Ans: Using external style sheets, Using local style definitions, Using the StyleManager class ,Using the setStyle() and getStyle() methods, Using inline stylesLoading style sheets at run time.
Q 37. What is the difference between sealed class and dynamic classes?
Ans: Sealed Classes: ActionScript 3.0 introduces the concept of sealed classes. A sealed class possesses only the fixed set of properties and methods that were defined at compile time; additional properties and methods cannot be added. This enables stricter compile-time checking, resulting in more robust programs. It also improves memory usage by not requiring an internal hash table for each object instance. Dynamic classes are also possible using the dynamic keyword. All classes in ActionScript 3.0 are sealed by default, but can be declared to be dynamic with the dynamic keyword.
Dynamic classes A dynamic class defines an object that can be altered at run time by adding or changing properties and methods. A class that is not dynamic, such as the String class, is a sealed class. You cannot add properties or methods to a sealed class at run time.
dynamic class Protean
{ //Use dynamic keyword before the name of class
}
Q 38. What is e4X and XML?
Ans: E4X means "ECMAScript For XML
Using E4X, we can develop code with XML data faster than was possible with previous programming techniques. E4X provides a set of classes and functionality for working with XML data. ActionScript 3.0 includes the following E4X classes: XML, XMLList, QName, and Namespace.
Here is an example of manipulating data with E4X:
var myXML:XML =
<>
< id="'1'">
<>burger
<>3.95
< /item>
< id="'2'">
<>fries
<>1.45
< /item>
< /order>
trace (myXML.item[0].menuName); // Output: burger
trace (myXML.item.(@id==2).menuName); // Output: fries
trace (myXML.item.(menuName=="burger").price); // Output: 3.95
Q 39. What is state? What is the difference between states and ViewStack?
Ans:View Stack is to handle different MXML file eg TAB control, and states is the transition within single MXML file
Q 40. How does item renderer work? How do I add item renderer at runtime?
Q 41.. What keyword allows you to refer to private variables of a class?
Q 42. How polymorphism works on actionscript?
Q 43.. How do you overload functions in actionscript?
Q 44. What is dynamic keyword used for?
Ans: Those Classes which should be extended and changed are called Dynamic classes
Q 45. What are sealed classes?
Ans: Classes whichyou cant extend. ex String
Q 46. What are runtime shared libraries?
Q 47. What is caringhorm? How do you use it? Have you worked with Cairngorms?
Q 48. What keyword allows you to implement abstraction better?
Q 49. What design patterns have you used? In Actionscript and java?
Q 50. What's the difference between Java and AS3 getters and setters? Ans: I have to explicitly call a setter/getter function in Java, while AS3 allows me to Access my setters and getters as though they are variables.
Q 51. Explain the component lifecycle.
Subscribe to:
Posts (Atom)