Thanks Michael but the timer is instantiated and started at runtime, not in
the constructor. I've tried it and both approaches don't work.
However I have located the source of the problem now (I believe):
I'm adding several of the Custom Bitmap Objects at runtime and as it is not
decided from start how many object are there, they are added in a for loop
like this (Tile is my custom Bitmap)...
for (var i:uint = 1; i <= tileAmount; i++)
{
var tile:Tile = new Tile(i);
addChild(Bitmap(tile));
}
When I run it, only the last added tile exists, all others are removed from
the screen. So this is a DisplayList problem. My question would be now: How
do I add dynamic DisplayObject instances and don't have them removed if the
next comes in? This is probably totally trivial but I kind of have a
blackout about this now.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of T. Michael Keesey
> Sent: Friday, 08 December, 2006 04:00
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] Running a Timer in more than one instance of
thesame
> DisplayObject?
>
> Are you initializing the timer at compile-time or in the constructor?
> That is, are you doing this:
>
> protected var _timer:Timer = new Timer();
>
> ... or this?:
>
> public function MyBitmapClass() {
> super();
> _timer = new Timer();
> //...
> }
> //...
> protected var _timer:Timer;
>
> I've had some trouble with the former approach. It seems to set all
> instances' _timer fields to the same object. The latter approach
> ensures that each field is indeed different.
>
> On 12/7/06, Sascha <[EMAIL PROTECTED]> wrote:
> > Hi List,
> >
> > I have an advanced AS3 problem with that I'm stuck ...
> >
> > I'm extending the Bitmap Class to create a custom bitmap object that
uses a
> > Timer to trigger a function that scrolls the bitmap's BitmapData.
> > This works fine as long as there is only one instance of the custom
bitmap
> > on the screen but as soon as there are two only one of them keeps
playing
> > the timed scroll. If I add many more they even all disappear.
> > I guess that it is timer related trouble like as if all are using the
same
> > timer (though every instance creates its own timer).
> >
> > Does somebody have any clue how to get this working?
> >
> > Thanks a lot,
> > Sascha
> >
> >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
>
>
> --
> T. Michael Keesey
> Director of Technology
> Exopolis, Inc.
> 2894 Rowena Avenue Ste. B
> Los Angeles, California 90039
> --
> The Dinosauricon: http://dino.lm.com
> Parry & Carney: http://parryandcarney.com
> ISPN Forum: http://www.phylonames.org/forum/
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com