Global variables

Is there any way to create variables that are available to access throughout other classes/functions? Something like ‘_root.thisVar = 1’ in AS2 - but without using event handlers to retrieve the info?

Just a curious little question!

Many thanks.

You can create classes that are built on the Singelton pattern to create ‘global variables’ but in general it’s something you want to stop doing since it leads to pretty poor project architecture.

Thanks sekasi - I figured there must be a way but I was looking to use it as a workaround to a problem - rather than find the correct solution! Quite a learning curve from as2!

Cheers again.

What you can do is create custom events that pass parameters to listeners further down the display list… It’s not awesome either, but it’s pretty decent encapsulation :stuck_out_tongue: