PDA

View Full Version : Calling variables of loaded external swf file



paisley
July 16th, 2003, 04:21 PM
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?

nunomira
July 16th, 2003, 04:38 PM
hi,

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


container.variable._visible = false;

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

paisley
July 16th, 2003, 05:22 PM
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?

nunomira
July 16th, 2003, 07:10 PM
try tracing the alpha to see what you get, instead of the entered:
[code]
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<100
or
_alpha>100

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

paisley
July 16th, 2003, 07:55 PM
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?

nunomira
July 16th, 2003, 08:19 PM
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...