Skip to content

Instantly share code, notes, and snippets.

@royletron
Last active August 29, 2015 14:05
Show Gist options
  • Save royletron/8d19f848705fd56e5896 to your computer and use it in GitHub Desktop.
Save royletron/8d19f848705fd56e5896 to your computer and use it in GitHub Desktop.
AS3 Interviewee Test
<?xml version="1.0" encoding="UTF-8"?>
<activity>
<textField x="50" y="50" text="Hello World" ID="test_text_field" />
<button x="50" y="100" text="Click Me!">
<function name="ONCLICK">
<![CDATA[
var tf = getElementByID('test_text_field');
if(tf != null){
tf.text = String(Math.random()*100);
}
]]>
</function>
</button>
</activity>

Interview Exercise

The file content.xml represents a piece of content that your application should accept and render. The accepted nodes and their given attributes are as follows

This is the root node used to represent a single activity and will only appear once in the XML file.

Represents an AS3 TextField class and accepts the following attributes

  • @x - The x coordinate for the TextField. Maps directly to the TextField.x attribute
  • @y - The y coordinate for the TextField. Maps directly to the TextField.y attribute
  • @text - The text string that is displayed in the TextField. Maps directly to the TextField.text attribute
  • @ID - A unique identifier for the specific instance on the element, which is used to reference it within <function> tags.

*All TextField elements are to be single line height and use the TextFieldAutoSize.LEFT autosizing attribute

Represents a basic button which you can create through whatever means you feel appropriate, but it should extend DisplayObject, have a way of displaying text on it and accept the following attributes:

  • @x - The x coordinate for the Button. Maps directly to the DisplayObject.x attribute
  • @y - The y coordinate for the Button. Maps directly to the DisplayObject.y attribute
  • @text - The text to display on the Button.

The <button> can also accept a single <function> node as described below.

Represents a simple function that can be evaluated by your application and have access to the standard AS3 Math library and also a custom function getElementByID that accepts a single parameter which is the ID of the element and returns the element or null if no element is found. The <function> element also needs to accept the following attribute:

  • @name - The name of the given function, if the name uses the keyword ONCLICK the function should be called when the parent element receives a standard MouseEvent.CLICK event.

Expected Output

Your application should accept the content.xml file and render the following: Initial State Clicking the button should then display something similar to the following (with a random number): Clicked State

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment