Solved

passing variables

Posted on 2003-10-24
4
262 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: 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

There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
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…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

756 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