View Full Version : ActionScript 3.0 quiz

10-16-2008, 05:23 PM

Need your urgent help in cracking this quiz:

1. Q.
For a default DisplayObjectContainer with a width of 240 pixels and height of 180 pixels, how would you position a default DisplayObject with a width of 54 pixels and height of 78 pixels within the center of the container? What would the new x/y coordinates of the DisplayObject be?
2. Q.
With the following XML, what would the syntax of the trace() statement below be to produce a value of 33623232323 ?
var _val:String = "foobar";
var _xml:XML = <clouds>
<cumulous><elevation key="336">Cumulous</elevation></cumulous>
<cirrus key="23232323"><elevation key={_val}>Cirrus</elevation></cirrus>
<nimbus><elevation key={_val}>Nimbus</elevation></nimbus>

3. Q.
Whats the fastest method to remove a DisplayObject from a DisplayObjectContainer if all you know is that the child DisplayObject name is "firetruckAsset"?
4. Q.
What would be a few good ways to unit-test the previous operation?
5. Q.
In the context below, flag the 'foo' object available for ASVM Garbage Collection.
var foo:DisplayObjectContainer = new Sprite();
var bar:MovieClip = MovieClip( foo );
foo.addEventListener( new Event( Event.CHANGE, this.onChange, false, 0, true ) );
6. Q.
How would you go about finding the index of "myjelly" in this scenario?
var myjelly:*= { key:"orange" };
var list:ArrayCollection = new ArrayCollection( "strawberry", "lime", "orange" );
7. Q.
Given the following scenario:

var times_chewed:int;
function chew():void {

function swallow():void {


If you wanted to chew() and then swallow() a total of 3 times in the prior code using "times_chewed", what is the cleanest approach?

8. Q.
What one of the best ways to reduce the overall byte size of a compiled SWF using MXMLC?

Thanks a ton,


10-16-2008, 05:37 PM
Sounds like a school project or possibly a quick interview question to me... When is it due??? :)

10-16-2008, 11:47 PM
tonight... Yes, kind of a interview screening. Can you help me please? I am falling short on Questions 4, 5 and 8. I have not used much of MXML too.

10-17-2008, 12:29 AM
If I were interviewing somebody, I'd rather hear that you don't know the answer than hearing the answer from somebody else rather than you... I can guide/teach you the knowledge after I hire you but I cannot teach you how to be honest...

10-17-2008, 12:36 AM
Plead the Fifth!