Solved

passing variables

Posted on 2003-10-24
4
256 Views
Last Modified: 2010-04-03
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;
}
0
Comment
Question by:Fivez
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
negatyve earned 500 total points
Comment Utility
you have to call it this way:

_root.sector("foto", "Spector<br>Foto<br>België<br>uitgevoerd in 2002");

not this:

_root.sector(foto, "Spector<br>Foto<br>België<br>uitgevoerd in 2002"); // missing double quotes around "foto"
0
 

Expert Comment

by:mvkvivek
Comment Utility
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
0
 

Author Comment

by:Fivez
Comment Utility
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;
}
0
 
LVL 27

Expert Comment

by:negatyve
Comment Utility
*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;
}
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now