Link to home
Start Free TrialLog in
Avatar of plundquist
plundquist

asked on

Losing actions when accessing swf through loadMovie in Flash MX

Hi! I am using Flash MX to build a website. I am completely trying to learn as I go, so sorry if I don't use the correct terminology!
I have built it so that the main page only has main navigation on it, and then there are 3 blank movie clips in which I do loadMovie, and separate swf files then load for the main content, second and third levels of navigation. I hope this wasn't a stupid move, but I was hoping it would save time if I need to change content down the road.

So, my problem: on my second and third levels of navigation, I have built horizontal menus that have arrows on either side and when you rollover the arrows the menu moves left or right. So it works perfectly when I do Publish Preview when I only have the file open for the navigation, but when I Publish Preview the main page, the arrows do nothing. Is there something I am doing totally wrong, or is this not even possible to do?

I am sure you need to look at some code or files or something, but I will wait until you ask for them because I am not sure which parts are vital, or how to upload files, so just give me direction on what you need. Thank you SO much for your help, and I hope I explained this in a halfway decent manner!!
Thanks!
Avatar of Zeffer
Zeffer
Flag of New Zealand image

in the second and third movies in the first frame of each put..
this._lockroot = true;

When they are loaded into the main movie they are losing their reference to their _root as the main movie is _root.

Z
Avatar of ieciep
ieciep

Try _parent instead of _root. By writing _parent a one level up i.e. parent level is referred.

For example:
----------------
Lets consider a scenario:

(mc = movie clip)

Here's a scene Hierarchy:
                        _root
                          |______mc1
                          |              |_________mc1Inside
                          |______mc2
                          |              |_________mc2Inside
                          |______mc3
                          |              |_________mc2Inside

Variables on _root: (Actionscript)
----------------------------------------
checkMovie1=1;
checkMovie2=0;
checkMovie3=0;

If we are in mc1 level:
--------------------------
from mc1 you can access these root variables by just writing:

_root.checkMovie1=0;

but you can also access it through _parent like:

_parent.checkMovie1=0;

If we are in mc1.mc1Inside level:
---------------------------------------
from mc1.mc1Inside you can access these root variables by just writing:

_root.checkMovie1=0;

now here's a tricky part if you are using _parent, you have to call parent's parent for the checkMovie1 etc variables declared at the _root level i.e.

_parent._parent.checkMovie1=0;

Similarly, you can use these _root vairables from mc2, mc2.mc2Inside and mc3, mc3.mc3Inside levels.

If you want me to look at the code send it on:

faizanul_haq@hotmail.com
Avatar of plundquist

ASKER

Thanks so much for your quick responses! So maybe it is because it is really early for me, or (more likely) maybe it is because I am clueless, but even though these solutions seem easy enough, I am not having any luck. I think I see what parts you are focusing on, so I will post my code for those areas and maybe you can see it where I am going wrong.

This is what I have in the button in the main movie (first level) that makes the navigation (second level) pop-up in movie clip:

on (release) {
      _root.nav_level2.loadMovie("Tester.swf");
}

                                      (ieciep, when I tried your solution, I put
                                            on (release) {
                            _parent.nav_level2.loadMovie("Tester.swf");
                                              }
                                            is that right, or am I completely off?)

Then, inside the actual level 2 navigation movie itself (the one that loads into level 1), I have on the stage a mc "control" in which there is a level called "up" with three frames, the first and third just stop(); , but the second frame of "up" has this in it:


x = getProperty("_root.text", _x);
if (x>1) {
gotoAndStop(1);
} else {
setProperty("_root.text", _x, x+6);
}




x = getProperty("_parent._parent.text", _x);
if (x>1) {
gotoAndStop(1);
} else {
setProperty("_parent._parent.text", _x, x+6);
}

DISREGUARD MY LAST POST because I accidently hit the submit button, and the post is totally incomplete, so I am redoing it and will post it in a minute. Sorry!
(Sorry about the accidental post!) ANYWAY, Thanks so much for your quick responses! So maybe it is because it is really early for me, or (more likely) maybe it is because I am clueless, but even though these solutions seem easy enough, I am not having any luck. I think I see what parts you are focusing on, so I will post my code for those areas and maybe you can see it where I am going wrong.

This is what I have in the button in the main movie (first level) that makes the navigation (second level) pop-up in movie clip:

on (release) {
      _root.nav_level2.loadMovie("Tester.swf");
}

                                      (ieciep, when I tried your solution, I put
                                            on (release) {
                            _parent.nav_level2.loadMovie("Tester.swf");
                                              }
                                            is that right, or am I completely off?)

Then, inside the actual level 2 navigation movie itself (the one that loads into level 1), I have on the stage a mc "control" in which there is a layer called "up" with three frames, the first and third just stop(); , but the second frame of "up" has this in it:


x = getProperty("_root.text", _x);
if (x>1) {
gotoAndStop(1);
} else {
setProperty("_root.text", _x, x+6);
}

          (ieciep, again, this is how I tried it, but did I butcher it?)

                                  x = getProperty("_parent._parent.text", _x);
                                  if (x>1) {
                                  gotoAndStop(1);
                                   } else {
                                  setProperty("_parent._parent.text", _x, x+6);
                                   }

The second layer called "down" is very similar, obviously some different  values, and it does its business is frames 4-6.

Here is what I have on the buttons, still in the level 2 navigation movie:

on (rollOver) {
control.gotoAndPlay(5);
}

on (rollOut, dragOut) {
control.gotoAndStop(4);
}

So there is a bunch of code for you, oh, and Zeffer, I put your code in its own layer in the first frame of the level 2 navigation movie (tried separately from ieciep's solution, of course). Did I not do that correctly?
Thank you SO much for all of your brilliant assistance!!
yes you did that right but depending on what code you have in the movie..it doesn't always work.
another way to do it is to have references to..this..when you're refering to the movie you are in..eg
on (rollOver) {
this.control.gotoAndPlay(5);
}

you have used ieciep's suggestion incorrectly..but I'll let him comment on that.

Z
Thanks so much for the suggestion! I will try that and post how it works. Thanks!!
So I tried that for the buttons, and it still isn't working, but I wonder if you also intended me to change the code to that style in other areas. Sorry you are having to hold my hand through this! I tried it in conjunction with your first suggestion, and also without use of the first suggestion. Are there other places I should change it besides the button code? Thanks so much for your help!
I was wondering if any one had anything else for me to try, or if there is any more info that you need from me. Thanks so much!!
Anyone?
well ieiecp seems  to have abandoned ship..
do you want to put your .fla somewhere so I can download it and take a look..problems with paths
are difficult to figure out just from description.

Z
Sure! Yes, I am sure it is frustrating trying to figure something like this out when you can't look at it! Where/how do I upload that? Thanks SO much!I I really appreciate all of your help!
you can register at the following site..or if you don't want to ..you can still use the site annonymously.

http://www.snapdrive.net/?utm_source=freewebspace.net&utm_medium=textad
upload the .fla .. then get the link to it and post the link here

Z
Okay, I have uploaded my files.
My main movie is at:
http://www.snapdrive.net/files/395633/shared.fla 

And the navigation that is giving me the trouble is in the movie at:
http://www.snapdrive.net/files/395633/Tester.fla

So the "Shared" movie is the main movie, in which the "Tester" movie opens. When you preview "Shared," click on the link "Find A Contractor" to see the navigation that is giving me trouble.

 I have included the files below, which aren't giving me any trouble, but they are the content that appear in the main movie for the links you will be testing, so just in case you need them for whatever reason.
http://www.snapdrive.net/files/395633/Homepage.fla http://www.snapdrive.net/files/395633/FindAContractor.fla http://www.snapdrive.net/files/395633/HomeBuilders.fla

So, again, I am just having trouble making the arrows work in the "Tester" movie when it is opened within the movie "Shared." "Tester" was working perfectly when previewed on its own, but now it isn't scrolling correctly either (instead of scrolling until you move your mouse off of it [or reaching the end of the menu], it only moves a little bit each time you mouse over), probably because I have been trying so many things that I screwed it up somewhere and can't figure out where. ANYWAY, I really appreciate all of your help with this!!!
ASKER CERTIFIED SOLUTION
Avatar of Zeffer
Zeffer
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just had time to check here really quickly, but can't wait to download it tomorrow. Thank you SOO much for all of your help! You are seriously a life saver, and your help is EXTREMELY appreciated! You rock!!