# Calling variables of loaded external swf file

**URL:** <https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823>\
**Category:** flash\
**Created:** [July 16, 2003, 8:21pm UTC](https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823 "2003-07-16T20:21:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paisley](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@paisley](https://forum.kirupa.com/u/paisley)\
**Post date:** [July 16, 2003, 8:21pm UTC](https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823/1 "2003-07-16T20:21:49Z")

</div>

How do I call variables of my external swf file from my index.swf timeline?

this is what I did:

createEmptyMovieClip(“container”,5);  
loadMovie(“external.swf”);  
\_\_\_\_\_\_\_\_\_.variable.\_visible = xxx;

What do I put in the blank?

---

<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:** [July 16, 2003, 8:38pm UTC](https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823/2 "2003-07-16T20:38:10Z")

</div>

hi,

that will depend on where the variable in the external movie is.  
if it is in the main timeline:

```auto

container.variable._visible = false;

```

I suggest you read my [understanding target paths](http://www.nunomira.com/tutorials/)

---

<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:** [July 16, 2003, 9:22pm UTC](https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823/3 "2003-07-16T21:22:45Z")

</div>

actually, my problem is a little more complicated than the question I asked

In the main timeline:

container.onEnterFrame = show;

function show() {

```
if (container[namesArray[0]]._alpha != 100) {
	trace("entered");
                            container[namesArray[0]]._alpha +=5;
}
else {
	container.onEnterFrame = null;
}

```

}

only the ‘trace(“entered”)’ is displayed but the alpha of ‘container[namesArray[0]]’ didn’t change

Do you have a solution for my problem?

---

<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:** [July 16, 2003, 11:10pm UTC](https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823/4 "2003-07-16T23:10:27Z")

</div>

try tracing the alpha to see what you get, instead of the entered:

```auto

trace(container[namesArray[0]]._alpha);
[/As]
you may not be able to assure that _alpha != 100. depending on what you're doing, you may use
_alpha&lt;100
or
_alpha&gt;100

with methods, instead of
container.onEnterFrame = null;
you may use:
delete container.onEnterFrame
or
delete this.onEnterFrame
```

---

<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:** [July 16, 2003, 11:55pm UTC](https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823/5 "2003-07-16T23:55:15Z")

</div>

I solved that part of my problem. I transfered the portion of my script to the next frame.

Now, my problem is that in this script:

if (xxxxxx) {  
container.\_alpha += 5;  
}

when traced, the output is has decimals on it. Why is that?

---

<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:** [July 17, 2003, 12:19am UTC](https://forum.kirupa.com/t/calling-variables-of-loaded-external-swf-file/25823/6 "2003-07-17T00:19:58Z")

</div>

that’s got to do with the way flash handles numbers  
that’s why I wrote that

you may try to use  
Math.round()  
Math.floor()  
Math.ceil()

if you need to…
