# Bypass lockroot?

**URL:** <https://forum.kirupa.com/t/bypass-lockroot/263600>\
**Category:** flash\
**Created:** [June 17, 2008, 4:09pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600 "2008-06-17T16:09:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)\
**Post date:** [June 17, 2008, 4:09pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/1 "2008-06-17T16:09:28Z")

</div>

Is it possible to bypass [COLOR=“DarkOrange”]this.lockroot = true;[/COLOR] for just one function?

And make sure it stays lock for the rest of the code…

---

<div class="post-metadata">

**Author:** ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)\
**Post date:** [June 17, 2008, 6:23pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/2 "2008-06-17T18:23:40Z")

</div>

Set this.lockroot = false; before/when you start your function, then reset it to true when you exit the function.

---

<div class="post-metadata">

**Author:** ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)\
**Post date:** [June 17, 2008, 7:00pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/3 "2008-06-17T19:00:06Z")

</div>

Thanks,

so…

```auto

//on my main timeline, frame 1

this.lockroot = true;

function accessroot() {
	this.lockroot = false;
//the rest of the function goes here
this.lockroot = true;
}

```

is it this simple?

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 18, 2008, 8:23am UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/4 "2008-06-18T08:23:43Z")

</div>

hey why didn’t anyone tell me that 😛

---

<div class="post-metadata">

**Author:** ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)\
**Post date:** [June 18, 2008, 5:00pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/5 "2008-06-18T17:00:04Z")

</div>

I still haven’t tested it yet…  
But from Glosrfc’s comment, it seems the case.

I will make a quick movie to test it and make sure it really is that easy.

---

<div class="post-metadata">

**Author:** ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)\
**Post date:** [June 18, 2008, 5:36pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/6 "2008-06-18T17:36:27Z")

</div>

Well…

it doesn’t work!

I’m attaching my test file. Maybe I am not doing it correctly.

---

<div class="post-metadata">

**Author:** ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)\
**Post date:** [June 18, 2008, 6:19pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/7 "2008-06-18T18:19:39Z")

</div>

Files are in the wrong format.

The first question has to be…why are you addressing \_root in the first place? Using absolute targets like \_root is certain to cause problems and \_lockroot=true is just a temporary workaround. So temporary that it was removed from AS3.

You should really be using relative addresses in the SWF you’re loading, e.g. this or \_parent, or combining them this.\_parent where this is the loaded SWF code and \_parent is the SWF into which it is loaded.

---

<div class="post-metadata">

**Author:** ![artriste](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@artriste](https://forum.kirupa.com/u/artriste)\
**Post date:** [June 18, 2008, 6:42pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/8 "2008-06-18T18:42:10Z")

</div>

Well, I have to agree that it is far from being a convenient technique and I tried to avoid it myself. In this case, I was using a pretty heavy code that I haven’t write… and prefered not to mess with it. I could always replace all instances of \_root with the proper path or using parents as you suggested.

Anyway, just wanted to see if it was possible… as it would make sense to turn off a lockroot for just a function or too. I’m pretty sure many have tried it before.

thanks for clarifying

---

<div class="post-metadata">

**Author:** ![glosrfc](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/glosrfc/32/8334_2.png) [@glosrfc](https://forum.kirupa.com/u/glosrfc)\
**Post date:** [June 18, 2008, 7:00pm UTC](https://forum.kirupa.com/t/bypass-lockroot/263600/9 "2008-06-18T19:00:57Z")

</div>

It’s possible to turn it off using false. Another option would be to explicitly declare \_level0 inside the function in which you don’t want lockroot to be true. Also note that it’s \_lockroot and not lockroot, e.g.  
this.\_lockroot = false;
