When getting an external SWF using a loader in ActionScript 3, you usually not getting the the MovieClip contained within. Luckily, the loader you used to get the SWF has a property content that contains that movie clip – and with that, also the timeline.
Props to Jonas, who told me that. I just hope I am getting it right here, since I finally didn’t use it in my project …
Sometimes, the state of an object decides which method has to be executed. Instead of an unwieldy switch construction like this …
switch (task) {
case "sleep":
sleep();
break;
case "walk":
walk();
break;
}
… you can use the someObject[someExpression] notation. This works for any object, and you can use it to access both variables and methods. All those lines from above become this: