# Vars lost in LoadMovie ?!?!

**URL:** <https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046>\
**Category:** flash\
**Created:** [December 23, 2002, 11:30am UTC](https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046 "2002-12-23T11:30:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![piddu](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@piddu](https://forum.kirupa.com/u/piddu)\
**Post date:** [December 23, 2002, 11:30am UTC](https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046/1 "2002-12-23T11:30:05Z")

</div>

Hi,  
i am loading an external SWF into an empty movieclip but all properties (vars) from that mc seem to be lost.

In other words I have variables contained in movie clips that should be loaded with the external SWF … but it doesn’t work !!

Is it normal that parameters contained in an external movie are lost when loaded ?? I’ve never come across this before … :crazy:

… if anyone can help …

bye

piddu

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 23, 2002, 12:47pm UTC](https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046/2 "2002-12-23T12:47:20Z")

</div>

they´re just with a wrong path.

=)

WELCOME TO KIRUPA FORUM!

I´m sure you´ll gonna like in here. Stick around, give us a shot, and you´ll not regret it.

[SIZE=1]_Please don’t spam on help forums_[/SIZE]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 23, 2002, 1:10pm UTC](https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046/3 "2002-12-23T13:10:44Z")

</div>

well , maybe … but I’ve checked the path many times…

the external mc is loaded into an empty movie clip called tilemenu which is positioned in the \_root

the external MC has 5 different movieclips, each with an id property set.

when i load it into my movie I can target those 5 movie clips but if I try to read the “id” property i get an “undefined” result, which is not what I was expecting.

Any advices ??

piddu

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 23, 2002, 1:30pm UTC](https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046/4 "2002-12-23T13:30:36Z")

</div>

What do you mean by \*\*“id” property \*\* ? is that a variable, or the instance name?

try targeting by it´s level, ex:

[SIZE=1]increase the _variable_ **speed** inside the _mc_ **ball** on _level_ **2** :[/SIZE]

```auto
_level2.ball.speed++;

```

=)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 24, 2002, 7:24am UTC](https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046/5 "2002-12-24T07:24:07Z")

</div>

sorry if I didn’t explain myself very well … 🙂

The problem was this :

- I am loading an external mc that holds a number of sub-moviclips

- Each of these mc has some custom properties already set

- When I load this external mc into my movie I catch the “onData” event so that I know when it is fully loaded.

As soon as this event is raised I call a function that reads those properties we were talking about from the loaded external mc.

For some reason this properties are not ready to be read in that moment (the onMovieClipeEvent(onData)) … but if you just let 1 or 2 frames pass then those variables do appear !!

The solution :

I’ve placed a var called “Inited” in the external MC. As soon as the onData event is raised I wait for “Inited” to be set, then I can call my custon function that does what I need. (it is a level-editor for an arcade game I am doing)

This thing really made me go nuts because I’ve never come across such a particularity in actionscript … hope this will help somebody else as well.

Bye and Merry Christmas !!

PiddU

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 26, 2002, 11:20am UTC](https://forum.kirupa.com/t/vars-lost-in-loadmovie/10046/6 "2002-12-26T11:20:51Z")

</div>

Cheers:crazy:
