Solved

passing variables

Posted on 2003-10-24
4
260 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
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IE 11 Flash Player issue 7 238
Flash player plugin 13 7 333
ActionScript 3 - Removing Duplicates in ArrayCollection 1 382
private function works only without TabNavigator? 3 311
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

810 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