Adobe Flex Actionscript Question:
Download Job Interview Questions and Answers PDF
What is dynamic keyword used for in actionscript?
Answer:
Dynamic classes, which allow you to programmatically add new properties and behavior to classes during the run-time. Just add the magic keyword dynamic to the class definition:
dynamic class Person {
var name:String;
}
Now let’s add dynamically two variables name and age and the function printme() to the object of type Person:
Person p= new Person();
p.name=”Joe”;
p.age=25;
p.printMe = function () {
trace (p.name, p.age);
}
p.printMe(); // Joe 25
dynamic class Person {
var name:String;
}
Now let’s add dynamically two variables name and age and the function printme() to the object of type Person:
Person p= new Person();
p.name=”Joe”;
p.age=25;
p.printMe = function () {
trace (p.name, p.age);
}
p.printMe(); // Joe 25
Download Adobe Flex Actionscript Interview Questions And Answers
PDF
Previous Question | Next Question |
How do we overload functions in actionscript? | What are sealed classes in flex? |