Blogadda

Blogadda
Visit BlogAdda.com to discover Indian blogs

Wednesday, April 29, 2009

AS questions-Meebo

1. How would you determine the native width and height of the image in pixels in ActionScript?

2. How would you resize the image so that it is displayed 300px high but maintains its original aspect ratio in ActionScript?

3. What is the difference between _root scope and _global scope?

4. What is the difference between _root and _level0?

5. What is the result of this chunk of code and why?

var a = 10;
eval("a = 15");
trace(a);
6. What is the difference between the onmousedown event and the onpress event on the MovieClip class?

7. What is the result of this chunk of code and why?

var o = new Object;
o.i = 6;
with(o) {
delete i;
i = 7;
}
trace(o.i);

Saturday, April 25, 2009

Mind Boggling.-- Programing QUESTIONS

Jotted down few questions which weer asked in an interview. They are just mind boggling man.

Depending on the logic only.............. :)


1---- Write a function whose parameter will be a binary string.... eg.. "01010101101010" etc..

and we have calculate the equivalent hexadecimal number of that binary string...

2------ W a function which will take a password string as its parameter and will return accepted or rejected as its return value based on the following validations

# p/w shud be in between the length of 6-11 letters only..
# p/w shud consists of one number but it shud not in the starting position and ending position.
# it shud have atleast one upper case letter as A-Z.
# it shud not have the repeated sequences.. as aaaaaA1q, aaS1xxaa, Aa112112, etc.,..

3------- W have two tables one big one and one small one and we have to search each element of the small table in the big table.. and the order of the elements shud be same in both tables.. it shud reject theduplicate elements

like big table is a,d,f,,re,r,e,g,t,h,f,d,s,f

small table is d,f,e,t,h

in both tables the order of elemnts is same...

based on these conditions write a function which will return true if possibilities are true anyways it will return false..


Struggling to find answers :)

Friday, April 24, 2009

WEB SERVICES-MASHUPS

The ultimate mashup -- Web services and the semantic Web, Part 1: Use and combine Web services

As Web services grow in popularity, enterprising Web and application developers create new and innovative applications with their data. In addition to single-service applications, developers are creating mashups, applications that combine data from multiple services to create something new. This series chronicles the creation of the ultimate mashup, an application that not only stores data from different mashups but uses semantic technology to enable users to create their own mashups by swapping services, or even by picking and choosing data. It uses Java(TM) programming and a combination of servlets, JSP, software from the open source Jena project, and DB2's new native XML capabilities. In this part, Nicholas Chase introduces the concept of mashups, shows you how they work and how to build a simple version of one.

Learn more:
http://www.ibm.com/developerworks/edu/x-dw-x-ultimashup1.html

Tuesday, April 21, 2009

DUPLICATE CLIP IN AS3

Firstly we need to create duplicate display object

duplicateDisplayObject.as

package {

import flash.display.DisplayObject;
import flash.geom.Rectangle;
import flash.system.Capabilities; // version check for scale9Grid bug

/**
* duplicateDisplayObject
* creates a duplicate of the DisplayObject passed.
* similar to duplicateMovieClip in AVM1. If using Flash 9, make sure
* you export for ActionScript the symbol you are duplicating
* @param target the display object to duplicate
* @param autoAdd if true, adds the duplicate to the display list
* in which target was located
* @return a duplicate instance of target
*/
public function duplicateDisplayObject(target:DisplayObject, autoAdd:Boolean = false):DisplayObject {
var targetClass:Class = Object(target).constructor;
var duplicate:DisplayObject = new targetClass() as DisplayObject;

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


doubleRed.as class

package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Graphics;
import flash.display.Sprite;
import flash.geom.Rectangle;
import flash.geom.ColorTransform;
import flash.display.MovieClip;


public class doubleRed extends Sprite{
public function doubleRed()
{
graphics.beginFill(0x00ff00);
graphics.drawCircle(50,50,15);
graphics.endFill();
}
}
}


After it we just need to make a document class and its done!!!!!!!!!!!!

Saturday, April 18, 2009

Need of Interfaces

Interfaces are used to encode similarities which classes of various types share, but do not necessarily constitute a class relationship. For instance, a human and a parrot can both whistle. However, it would not make sense to represent Humans and Parrots as subclasses of a Whistler class. Rather they would most likely be subclasses of an Animal class (likely with intermediate classes), but both would implement the Whistler interface.

Another use of interfaces is being able to use an object without knowing its type of class, but rather only that it implements a certain interface. For instance, if one were annoyed by a whistling noise, one may not know whether it is a human or a parrot, because all that could be determined is that a whistler is whistling. In a more practical example, a sorting algorithm may expect an object of type Comparable. Thus, it knows that the object's type can somehow be sorted, but it is irrelevant what the type of the object is. The call whistler.whistle() will call the implemented method whistle of object whistler no matter what class it has, provided it implements Whistler.

Friday, April 17, 2009

Image gallery to be made

The size of that application should be of –

  • Size of application will be : Width 341 and Height 368 pixel.
  • Big Image Size: Width 330 and Height 210 pixel.
  • Thumbnail size: Width 72 and Height 60 pixel.
  • Your browser may not support display of this image.This application will show two kinds of images, 1. Big Size Image 2. Small Thumbnails,
    according to the UI bellow.
  • Thumbnails should be in SCROLL PANE component of flash.
  • Images should be loaded from XML file or from array inside flash.
  • If you click on Thumbnail, then bigger images should be changes with fade out effect.
  • Please Use external .as files / Classes to write methods and functions related to this application.
  • Please collect 15 images from Google Images Search according to your choice.

Tuesday, April 14, 2009

One more Flast test question

Code a multiple choice multiple select interactivity based on the below mentioned requirements (Time- 2.5hrs):
  1. All the data (question text, option text, feedback and the number of attempts) should be kept and parsed through XML file.
  2. The number of option texts should be populated and placed on the stage based on the data entered in the XML file.
  3. The submit button will be enabled only when there is at least one option selected.
  4. The incorrect/partial correct feedback will be displayed for the incorrect attempt and correct feedback will be displayed for the correct attempt.
  5. The submit button will toggle to a solution button once all the incorrect attempts are over. Clicking the solution button will display the correct answer.

Sunday, April 12, 2009

FONT EMBEDDING in AS3

FONT EMBEDDING in AS3

// ActionScript 3.0

[Embed(source="assets/ARIAL.TTF", fontFamily="ArialEmbedded")]

var ArialEmbedded:Class;

var arialEmbeddedFont:Font = new ArialEmbedded();


var textFormat:TextFormat = new TextFormat();

textFormat.color = 0xFF0000;
textFormat.font = arialEmbeddedFont.fontName;

textFormat.size = 32;

var textField:TextField = new TextField();

textField.autoSize = TextFieldAutoSize.LEFT;
textField.wordWrap = true;

textField.defaultTextFormat = textFormat;
textField.embedFonts = true;

textField.text = "The quick brown fox jumps over the lazy dog.";
textField.width = 500;

textField.x = 25;
textField.y = 25;


addChild
(textField);

Monday, April 6, 2009

Memory leaks

Memory leak refers to a condition in which an incremental but steady loss of memory seems to be taking place. Usually, the root cause of memory leak has to do with the malfunction of one or more programs running on the hard drive . Essentially, the program fails to return memory to the hard drive when usage is complete and the resources are no longer needed. The result is that the used memory is not cleared for use by other computer programs, and thus diminishes the operating capacity of the computer.

Just about any type of program can be the source for memory leak. In some cases, it may be an application program, such as a database, that resides on the hard drive. At other times, the cause of the memory leak could be one of the essential program files that drive the operating system for the computer. Generally, the malfunction within the application is the result of some sort of invasion into the program proper, such as a virus or bug.

Even when the memory leak is relatively small, it can eventually cripple a system. Each time the infected application is run, the application grabs more free memory and never returns that amount of memory to the system. Over time, the amount of available memory becomes so limited that other applications are unable to obtain resources to launch or perform necessary functions, and begin to become inoperable. The end result is that the system simply shuts down and no application can run.

Many operating systems today include programming that automatically scans for memory leak and will alert the user to the problem. In addition, a number of anti-virus software programs today include components that will identify bugs or viruses that can cause a memory leak, and destroy them before there is a chance for the problem to do much damage. Both approaches are very helpful in preventing and dealing with incidences of memory leak.