Still mucking around with the same example, but just trying to extend it a bit.
This example now has 3 classes.
1. ‘DisplayListTest’ is the main base class. It creates instances of ‘DisplayListContainer’ and passes an integer as a paremeter to each ‘DisplayListContainer’ and then adds it to its displayList.
2. ‘DisplayListContainer’ these are created in the main class. A new TextFormat object is created, an instance of ‘DisplayListChild’ is created and a new TextField is created. The integer then used in the TextField. The Tween class is then used to contually move this object randomly around the stage.
3. ‘DisplayListChld’. An instance of this object is create once inside each ‘DisplayListContainer’. It creates a circle Shape inside itself and a GlowFilter. The object then listens to its own enterFrame event to change continually change the alpha property of the GlowFilter.
[as]package
{
import flash.display.Sprite;
import flash.display.Shape;
import mx.effects.Tween;
import flash.display.TextField;
import flash.display.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.events.Event;
import flash.events.EventType;
import flash.filters.GlowFilter;
public class DisplayListTest extends Sprite
{
private var _containers_array:Array;
private const _items_int:int = 20;
public function DisplayListTest()
{
super();
this.initDisplayListTest();
}
private function initDisplayListTest():Void
{
this._containers_array = new Array();
for(var i:int = 0; i < this._items_int; i++)
{
this._containers_array.push(new DisplayListContainer(i));
this.addChild(this._containers_array[i]);
}
}
}
private class DisplayListContainer extends Sprite
{
private var _index:int;
private var _text_txt:TextField;
private var _circle:DisplayListChild;
private var _x_tween:Tween;
private var _y_tween:Tween;
public function DisplayListContainer(i:int)
{
super();
this._index = i;
this.initDisplayListContainer();
}
private function initDisplayListContainer():Void
{
var format_fmt:TextFormat
format_fmt = new TextFormat();
format_fmt.font = "Verdana";
format_fmt.color = 0xFF0000;
format_fmt.size = 8;
this._circle = new DisplayListChild();
this.addChild(this._circle);
this._text_txt = new TextField();
this._text_txt.autoSize = TextFieldAutoSize.LEFT;
this._text_txt.defaultTextFormat = format_fmt;
this._text_txt.text = this._index.toString();
this._text_txt.x = - Math.round(this._text_txt.width / 2);
this._text_txt.y = - Math.round(this._text_txt.height / 2);
this.addChild(this._text_txt);
this.startXTween();
this.startYTween();
}
private function startXTween():Void
{
delete this._x_tween;
this._x_tween = new Tween(this, this.x, Math.random() * 200, (Math.random() * 1000) + 500, 31);
this._x_tween.setTweenHandlers(this.onXTweenUpdate, this.onXTweenEnd);
}
private function startYTween():Void
{
delete this._y_tween;
this._y_tween = new Tween(this, this.y, Math.random() * 200, (Math.random() * 1000) + 500, 31);
this._y_tween.setTweenHandlers(this.onYTweenUpdate, this.onYTweenEnd);
}
private function onXTweenUpdate(val:Object):Void
{
this.x = val;
}
private function onXTweenEnd(val:Object):Void
{
this.x = val;
this.startXTween();
}
private function onYTweenUpdate(val:Object):Void
{
this.y = val;
}
private function onYTweenEnd(val:Object):Void
{
this.y = val;
this.startYTween();
}
}
private class DisplayListChild extends Sprite
{
private var _myCircle:Shape;
private var _glow:GlowFilter;
private var _glowAlpha_num:Number;
private var _glowIncrement_num:Number;
public function DisplayListChild()
{
super();
this.initDisplayListChild();
}
private function initDisplayListChild():Void
{
this._glowAlpha_num = Math.floor(Math.random());
this._glowIncrement_num = (Math.random() - 0.5) / 10;
this._glow = new GlowFilter(0x00FF00, this._glowAlpha_num, 6, 6);
this.filters = [this._glow];
this._myCircle = new Shape();
this._myCircle.graphics.beginFill(0xffffff);
this._myCircle.graphics.lineStyle(1, 0x000000);
this._myCircle.graphics.drawCircle(0, 0, 10);
this._myCircle.graphics.endFill();
this.addChild(this._myCircle);
this.addEventListener(EventType.ENTER_FRAME, this.onEnterFrame);
}
private function onEnterFrame(event:Event):Void
{
if((this._glow.alpha + this._glowIncrement_num) > 1 || (this._glow.alpha + this._glowIncrement_num) < 0)
{
this._glowIncrement_num = this._glowIncrement_num – (this._glowIncrement_num * 2);
}
this._glow.alpha += this._glowIncrement_num;
this.filters = [this._glow];
}
}
}[/as]

[...] tutorial from helpQLODhelp) AS3 sample codes http://www.tink.ws/blog/as-30-moving-circle/ http://www.tink.ws/blog/as-30-displaylisttest/ AS3 some special new features and [...]
[...] amples >> 3 sites Encoding PNGs in ActionScript 3 Tinic Uro Moving circle (source code) DisplayListTest (source code) ActionScript 3.0 Sound >> 2 sites Sound Spectru [...]
AS2 has made me lazy
So tonight I figured I’d look into AS3. I took the idea of Tink’s example and expanded on it slightly to learn the things I wanted to know. I discovered that AS3 rocks but AS2 has made me lazy. I…
[...] has made me lazy
So tonight I figured I’d look into AS3. I took the idea of Tink’s example and expanded on it slightly to learn the things I wanted to know. I discovered tha [...]
[...] flash October 19th, 2005 So tonight I figured I’d look into AS3. I took the idea of Tink’s example and expanded on it slightly to learn the things I wanted to know. I discovered tha [...]
[...] en ActionScript 3 Tinic Uro Encodeando JPEGs en ActionScript 3 Tinic Uro Moviendo Circulo Prueba de Lista de Visualización Moviendo MovieClip en AS3 Mosaico desde un JPG Msn Messenger en [...]
[...] -30-moving-circle/” target=_blank snap_preview_added=”spa”>Moving circle (source code) DisplayListTest (source code) [...]
[...] en ActionScript 3 Tinic Uro Encodeando JPEGs en ActionScript 3 Tinic Uro Moviendo Circulo Prueba de Lista de Visualización Moviendo MovieClip en AS3 Mosaico desde un JPG Msn Messenger [...]