Director 1.4 Best pratice

I’m kind of puzzled about to use Director fully to get the most of it.

What I would like to see an example how to use Director with initVars() and clean() that are called from the director class and not within new() like initVars() is in the existing examples.

I also would like to know exactly how they are meant to be used together. clean() is pretty obvious but how is initVars supposed to work in harmony with clean().

In my head initVars should be called after clean in the previous scene but that’s not the case.

I thought it would work like this:

[blockcode]
newscene->new()
oldscene->clean()
newscene->initVars()
[/blockcode]

but it seems to work like this

[blockcode]
newscene->new()
newscene->initVars()
oldscene->clean()
[/blockcode]

So if you as an example use audio.stop() to stop background music in clean, then it would also stop any background music started in initVars for the new scene.

It would be really helpful to get this explained :slight_smile:

Best regards
Claes [import]uid: 73836 topic_id: 15699 reply_id: 315699[/import]

I would like to learn this too. I love director class, and I’ve managed to use it without much problem – but I’m not entirely sure how to use clean() function properly (partly because when I first started using it, clean() function was not in the class.) [import]uid: 67217 topic_id: 15699 reply_id: 58034[/import]

+1 [import]uid: 13156 topic_id: 15699 reply_id: 60342[/import]

Please take a look on http://developer.anscamobile.com/forum/2011/09/28/director-15-what-do-you-want [import]uid: 8556 topic_id: 15699 reply_id: 60384[/import]