Flash / Flex / ActionScript/Statement/for each — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 09:19, 26 мая 2010
Use for each in loop to display all elements in an object
for each (var element:Object in targetObject) {
// do some action
}
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var weather:Object = new Object();
weather.temp = 45;
weather.conditions = "rain";
weather.pressure = 970;
for each (var element:Object in weather) {
trace(element.toString());
}
}
}
}