Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with sub-contained movie and variables

Status
Not open for further replies.

rninja

Technical User
Apr 11, 2001
381
US
I've got the php feeding a dynamic text field in a movie, and when I test it in flash it shows up. However this movie is loading in a container movie which loads about 5 different movies and doesn't show the variables.

I tried checking for a colliding level, but everything is labeled into it's own level and shows up in the container.

What could be wrong?

Rninja

smlogo.gif

 
Just to explain more clearly, here is the hierarchy:

base.swf-(Container)->
leftside.swf--------->(menu)
rightside.swf-------->(variable display)
story.swf------------>(loads variables form php/mysql)

according to a trace, this is the result:
_level0.story.variable

Here is the loading actionscript:
-----------------------------------------------------------
stop();
path= " //declare path to php files
lvOut = new LoadVars(); //create lv object
lvIn = new LoadVars(); //create lv object
lvIn.onLoad = function (success) {
if(success){
//PHP variable value to textbox
first_name.text = lvIn.rVal0;
last_name.text = lvIn.rVal1;
}else{
//...or notify of failure
first_name.text = "fail";
last_name.text = "fail";
}
}

_root.onLoad = function(){
trace(last_name);
//assign user-input value to lv property called yes
lvOut.yes = yes.text;
lvOut.sendAndLoad(path + "modeli.php", lvIn, "POST");
};




Rninja

smlogo.gif

 
Be sure you specify the level of the movie you are sending the vars too:

Code:
 if(success){
                //PHP variable value to textbox
                [highlight]_level0.first_name.text =  lvIn.rVal0;
                _level0.last_name.text = lvIn.rVal1;[/highlight]
        }else{
                //...or notify of failure
                first_name.text = "fail";
                last_name.text = "fail";
        }

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
I tried that and it doesn't seem to work. Maybe it's because this code posted above is in the same swf file being loaded into the container?

Rninja

smlogo.gif

 
You must identify the movie that contains the script. If it is loaded into another movie the _level identifier must be whatever level you are loading it into in the other movie.

In other words if your container movie contains something like:

Code:
loadMovieNum("theOtherMovie.swf",1);

Then the script above must refer to _level1. Alternatively you could use this/_parent.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
I debugged it in flash using the base.swf (the container flash file), and It shows that it loads levels 1-5. It shows my two variables in _level5 as:
_level5.first_name
and
_level5.last_name

I have the script in the level 5 movie. I tried using _root, _level5, _parent, and this, and no result appears in the movie! When I use this or _parent and I load the movie in level 5, it shows the variables, but not when run in the container movie, base.swf...

What could this be? I've been trying all sorts of methods!!!

Rninja

smlogo.gif

 
I would have to see it(and I'm not set up for PHP anyway). There isn't really anything else I can suggest. Sounds like it might be a timing thing.

Maybe someone else has an idea.
 
IS there a more effective way of referring to variables within a scope of movies like this?

MAIN MOVIE (Loads all components)
-------------------------------------------
| | | | |
Movie1 Movie2 Movie3 Movie4 Movie5
(BkGrnd) (Menu) (Links) (sub-BG) (DB Variables)

My main objective is to be able to use dynamic text, image, and video content.

I appreciate any assistance here, this is driving me up a wall 'cause it shoulb be straight forward...

Rninja

smlogo.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top