Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

passing variables

Posted on 2003-10-24
4
Medium Priority
?
266 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 2000 total points
ID: 9612654
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
ID: 9612729
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
ID: 9613047
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
ID: 9613149
*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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
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.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses

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