# Changing external variables?

**URL:** <https://forum.kirupa.com/t/changing-external-variables/213926>\
**Category:** Uncategorized\
**Created:** [January 24, 2007, 10:57am UTC](https://forum.kirupa.com/t/changing-external-variables/213926 "2007-01-24T10:57:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benzrecordings](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/benzrecordings/32/1337_2.png) [@benzrecordings](https://forum.kirupa.com/u/benzrecordings)\
**Post date:** [January 24, 2007, 10:57am UTC](https://forum.kirupa.com/t/changing-external-variables/213926/1 "2007-01-24T10:57:45Z")

</div>

hi,  
first of all sorry for my bad english, but i´m german…

i have got a problem with changing variables. I´m loading an swf. in the main film. in that swf theres a function, that draws a line per AS. I used some different variables at the beginning of that script, cause I want to change them in the main film. heres the AS for the linedraw function:

```auto

Linethickness1 = 1;
Linethickness2 = 10;
Linethickness3 = 100;

Time1 = 100;
Time2 = 2;
Time3 = 4;

Color1 = 0xFF0000;
Color2 = 0xFF0350;
Color3 = 0x230450;

xMax = 500;
yMax = 400;

faktor_vonx = 1; 
faktor_vony = 10;
timefaktor_else = 20;

_root.createEmptyMovieClip("line", 1);
_root.line._x = 0;
_root.line._y = 0;
_root.line.lineStyle(Linethickness1, Color1);
_root.zeitbegrenzung = 0;

function drawL(vonx, vony, bisx, bisy) {
    _root.line.moveTo(vonx, vony);
    time = 0;
    _root.line.onEnterFrame = function() {
        if (time<Time1) {
            time = time + 2;
            vonx += (bisx-vonx)/faktor_vonx;
            vony += (bisy-vony)/faktor_vony;
            this.lineTo(vonx, vony);
        } else {
            delete this.onEnterFrame;
            if (_root.zeitbegrenzung<timefaktor_else) {
                drawL(vonx, vony, Math.round(Math.random()*xMax), Math.round(Math.random()*yMax)), 
                
                
                _root.zeitbegrenzung += 1;
                trace(_root.zeitbegrenzung);
            }
        }
    };
}
drawL(0, 0, 200, 200);

```

i´m loading this film via “loadMovie” into the main film. that works great. but now to my problem, theres a button in my main film. by clicking on it I want to chage the variables of the function. for example “Linethickness1 to Linethickness2”… it does not work, has anyone an idea how to solve that problem?!

for explanation, I load several linedraw films in the main film and every film has got there own parameters so the lines look different. that´s why I named the variables in every film the same way, so when i klick in the main film on the button, it changes “Linethickness1 to Linethickness2” and Linethickness2 has got different numbers in the specific film…

I hope it´s understandable :ponder:
