Don’t Do _root Drugs

Came back from my trip to find that one of my collegues was given a gift of good news. Since I’m a loser, I wandered about government sites until finding my way to MM’s homepage. Won’t their referrer’s be whacked now. Anyway, saw a download link for what I thought was Central, but was really Contribute. Ignoring that as a sign to go to bed, I ventured over to the Central App Dev Center to lament some more. Found an <a href=”http://www.macromedia.com/devnet/central/articles/how_it_works.html”>article</a> describing how Central will work. I liked how he said not to use _root. Pretty neat to know that your app is loaded into a _level. Helps you start thinking on how your app will work with the rest of the crew of apps it’ll be sitting next to.

4 Replies to “Don’t Do _root Drugs”

  1. there’s actually some good stuff on how all this will be managed (or *should* be managed) over at the Macromedia Central newsgroup: macromedia.central.general_discussion – through forums.macromedia.com

    Here’s part of a response from Kevin Lynch:

    The way this works in Central is that apps from different domains exist
    in separate _global spaces, as part of the security sandbox design. So,
    you don’t need to worry about colliding with applications from other
    domains.

    The thing you do need to worry about is colliding with other apps from
    the same domain, which can happen if the user decides to run several of
    your applications at the same time (for example, in two windows). So,
    you should declare a global for each of your apps, like _global.FooApp
    and _global.BarApp and that should do it. You could use the longer
    _global.com.yourdomainname.yourappname.yourobject for this if you like
    of course.

  2. I think your allowed to reference _root, your just not supposed to. I couldn’t see any responses, so am curious how they propose to run our apps. The _global space makes perfect sense, and I could easily deal with that. But the _levels remain to be seen on how they work. If you load a movie into a movie clip, that does cause a problem with _root, as does a movie loaded into _level1 that was expecting something to exist which really is on _level0’s main timeline.

    Regardless, they still said _root is bad, _levels or not. That’s probably one of the reaonses they redid some of the core components (just one not all) because a few relied, wrongfully so, on _root.

Comments are closed.