PDA

View Full Version : conditional statements from movie loaded in scrollPane?


jimmydwilson
08-03-2005, 07:03 PM
Hello everyone,

I'm having a problem with an external .swf that I have loaded into a scrollpane. I have buttons within this external .swf that affect the main timeline using the _level0 function. Though I make simple actions affect the main timeline (ie gotoAndPlay), any conditional statements that I make don't seem to register on the main timeline. Does anyone have any idea why this is and how you can make conditional statements apply to the main timeline from inside a scrollPane?

Here is the script that I have on one of the buttons:

newsbut1.onRelease = function() {
_level0.gotoAndPlay (307);
_level0.news = true
_level0.contact = false
_level0.who = false
_level0.what = false
_level0.studies = false
_level0.our = false
_level0.COR = false
_level0.newsmain = false
_level0.news1 = true
_level0.news2 = false
_level0.news3 = false
_level0.news4 = false
_level0.news5 = false
_level0.news6 = false
_level0.news7 = false
_level0.news8 = false
_level0.news9 = false
_level0.news10 = false
}

The gotoAndPlay part works, but the rest doesn't (based on testing with the trace function). Any ideas? Thanks in advance, and just so you know, I'm pretty beginner-ish, so complex solutions will definitely go over my head.

Cota
08-03-2005, 07:36 PM
Are all those variables located on the _root timeline, or the loaded movie?

jimmydwilson
08-03-2005, 07:48 PM
Hi Cota, thanks for the quick reply

All of those variables are meant to affect behaviour in the main timeline (ie i want the if (x==true) and corresponding action to take place in the main timeline. hope that clears things up.

Cota
08-03-2005, 08:11 PM
well it may be pathing issue...._level0 refers to the _root timeline. So if they exist in a movieclip, they would require that path. The other options is to make them _global variables. Just replace _level0 with _global

jimmydwilson
08-03-2005, 08:41 PM
Hi Cota,

I don't think that _level0 vs. _root is the problem, because as I said, the gotoandPlay function works properly and it is set to _level0. I don't think that _root would work because the buttons are in a separate swf on another level. anyways, I will give making them global variables a try. Thanks a lot.

jimmydwilson
08-03-2005, 09:16 PM
Ok,

here's an update, I've tried changing all the _level0 functions to _global functions (on the send and receive ends of the conditional statements) but still no luck. Does anybody have any other suggestions? Thanks in advance.

jimmydwilson
08-03-2005, 10:03 PM
OK, finally figured it out after much frustration. The problem was that I had the gotoAndPlay command first and the conditional statements after. It moves to the other level before it has a chance to carry out the conditional statements. This isn't a problem if you have a goto command followed by conditional statements in the same movieclip, but if you do it between levels, it doesn't have time to recognize subsequent statements before executing the goto command. Hope this saves someone out there some time, because I've been wrestling with this all day.

Cota
08-04-2005, 01:04 AM
sorry I missed that... :(