Link to home
Start Free TrialLog in
Avatar of Fivez
Fivez

asked on

passing variables

How can I pass variables to this function ?  Now I've written the following:
_root.sector(foto, "Spector<br>Foto<br>België<br>uitgevoerd in 2002");
This does not work, the only thing working is declaring the variable before calling the function:
nieuwesector = "foto";
nieuweinfo = "Spector<br>Foto<br>België<br>uitgevoerd in 2002";
_root.sector(nieuwesector,nieuweinfo);

This is my function sector:
function sector(nieuwesector,nieuweinfo) {
    nsector = nieuwesector +"knop";
    _root.nieuwesector._visible = true;
    nieuwefoto = "po"+nieuwesector+"1.jpg";
    fotoclip2.loadMovie("../Flash/foto/nieuwefoto");
    _root.oudesector._visible = false;
    _root.info = nieuweinfo;
    oudesector = nieuwesector;
}
ASKER CERTIFIED SOLUTION
Avatar of negatyve
negatyve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mvkvivek
mvkvivek

Hi Fivez,

If you have placed function in separate layer and you are calling it from some other layer. This will work if function layer is placed top. But, vice versa is not working. It may be loading problem i think... I don't know why?

I hope some Experts will explain about this.

Thanks
Avatar of Fivez

ASKER

It does no longer work.....
nieuwesector, nieuweinfo,oudesector are variable declared in the top layer/1st frame of my movie,
the function below is also declared in that same layer/1st frame

function sector(nieuwesector,nieuweinfo) {
    _root.nieuwesector._visible = true;                      // does not work
    _root.oudesector._visible = false;                        // works
    nieuwefoto = "po"+nieuwesector+"1.jpg";            // works
    fotoclip2.loadMovie("../Flash/foto/"+nieuwefoto);  // works
    _root.info = nieuweinfo;                                     // works
    _root.informatie._visible= true;                           // works
    oudesector = nsector;
}
*this*, is what you are trying to do:

function sector(nieuwesector,nieuweinfo) {
      _root[nieuwesector]._visible = true; // this line
      _root.oudesector._visible = false;
      nieuwefoto = "po"+nieuwesector+"1.jpg";
      fotoclip2.loadMovie("../Flash/foto/"+nieuwefoto);
      _root.info = nieuweinfo;
      _root.informatie._visible= true;
      oudesector = nsector;
}