# loadMovie and Referencing problem

**URL:** <https://forum.kirupa.com/t/loadmovie-and-referencing-problem/183738>\
**Category:** flash\
**Created:** [March 29, 2006, 5:02pm UTC](https://forum.kirupa.com/t/loadmovie-and-referencing-problem/183738 "2006-03-29T17:02:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwidauer](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@cwidauer](https://forum.kirupa.com/u/cwidauer)\
**Post date:** [March 29, 2006, 5:02pm UTC](https://forum.kirupa.com/t/loadmovie-and-referencing-problem/183738/1 "2006-03-29T17:02:44Z")

</div>

hi.

Example: I have an swf called “test.swf”. In this Flashmovie i have an Instance of an Movieclip called “title”. I load test.swf in another Flashmovie called “main.fla” by

\_root.container01.loadMovie(“test.swf”);

where container01 is an instance of an empty Movieclip.

From within main.fla I’d like to refer to the alpha value of the instance title by

\_root.container01.title.\_alpha = 80;

but this does not work (title.\_alpha is undefined). What is wrong? Thanks in advance for any help…

bye  
chris

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [March 29, 2006, 5:10pm UTC](https://forum.kirupa.com/t/loadmovie-and-referencing-problem/183738/2 "2006-03-29T17:10:16Z")

</div>

Should work. Have you done a trace?

Also make sure your instance names are correct - Flash is case sensitive!

_edit_ on second thought - it may depend on the order you have your code. If you are loading test.swf and then trying to alter the \_alpha right away it may not happen. Flash fires so quick that the swf may not be fully loaded before you are trying to change the \_alpha. If you were to put the code to change the \_alpha on a button click then the referencing should work. If you want it to happen on its own then you should probably add preloader-like code to make sure that the swf has fully loaded before trying to fire off an code on the objects inside test.swf

hope that makes sense :hr:

---

<div class="post-metadata">

**Author:** ![cwidauer](https://avatars.discourse-cdn.com/v4/letter/c/a9a28c/32.png) [@cwidauer](https://forum.kirupa.com/u/cwidauer)\
**Post date:** [March 29, 2006, 7:11pm UTC](https://forum.kirupa.com/t/loadmovie-and-referencing-problem/183738/3 "2006-03-29T19:11:46Z")

</div>

hi lunatic,

thanks for the reply.

[quote=lunatic]Should work. Have you done a trace?  
sure. the “undefined” is coming from the trace.

Actually, i have event handlers such as

\_root.container01.btn01.onRollOver = function() {  
\_root.container01.titel.onEnterFrame = function() {  
if (this.\_alpha\<100) {  
this.\_alpha += (100-this.\_alpha)/4;  
} else {  
delete this.onEnterFrame;  
}  
};  
};

(and analogously for RollOut)

So, the title fades in when the mousearrow is going over an active zone (the btn01 is a active aera button and i have to place it in the externally loaded swf).

Anyways, meanwhile i place the code in the externall swf, but i would prefer to have the code all togehter in the main fla.

cheers,  
chris

---

<div class="post-metadata">

**Author:** ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)\
**Post date:** [March 29, 2006, 7:18pm UTC](https://forum.kirupa.com/t/loadmovie-and-referencing-problem/183738/4 "2006-03-29T19:18:42Z")

</div>

title.\_alpha may be undefined because title doesn’t exist yet at the time the code is called. You have to make sure the external swf has fully loaded before accessing objects contained within it. 🙂

Oh and by the way when you use a tag like [noparse]

> [@lunatic](#):
>
> [/noparse] make sure you use a closing tag like

.

We also have some nifty actionscript, php, and code tags you can use in the same way, such as  
[noparse]

```auto
your actionscript code here

```

[/noparse]  
[noparse]

```php
your php code here

```

[/noparse]  
[noparse]

```auto
generic code here

```

[/noparse]

Wrapping your code in the appropriate tag will make it more readable, so those trying to help you can quickly scan for an error or read what you are trying to do much easier.

:hr:
