Solved

Losing actions when accessing swf through loadMovie in Flash MX

Posted on 2007-03-29
16
204 Views
Last Modified: 2010-04-03
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!
0
Comment
Question by:plundquist
  • 10
  • 5
16 Comments
 
LVL 23

Expert Comment

by:Zeffer
Comment Utility
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
0
 
LVL 3

Expert Comment

by:ieciep
Comment Utility
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
0
 

Author Comment

by:plundquist
Comment Utility
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);
}

0
 

Author Comment

by:plundquist
Comment Utility
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!
0
 

Author Comment

by:plundquist
Comment Utility
(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!!
0
 
LVL 23

Expert Comment

by:Zeffer
Comment Utility
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
0
 

Author Comment

by:plundquist
Comment Utility
Thanks so much for the suggestion! I will try that and post how it works. Thanks!!
0
 

Author Comment

by:plundquist
Comment Utility
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!
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:plundquist
Comment Utility
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!!
0
 

Author Comment

by:plundquist
Comment Utility
Anyone?
0
 
LVL 23

Expert Comment

by:Zeffer
Comment Utility
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
0
 

Author Comment

by:plundquist
Comment Utility
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!
0
 
LVL 23

Expert Comment

by:Zeffer
Comment Utility
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
0
 

Author Comment

by:plundquist
Comment Utility
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!!!
0
 
LVL 23

Accepted Solution

by:
Zeffer earned 500 total points
Comment Utility
well wouldn't have got that in a month of Sundays just talking about it.
Have got it scrolling for you using a different approach..it was still giving problems (scrolling only to the left..not to the right).. fixed that by loading into a level using loadMovieNum..so it obviously didn't like being loaded into nav_level2..(I think that was screwing up the _x position for the clip and the right button couldn't read it accurately)
You will see the loadMovieNum in shared.fla.. and there are quite a few changes to control clip in Tester.fla

note..when using loadMovieNum...the stage should be the same size as the main clip..for registration purposes
any references from main movie to a movie loaded into a level use .._level..eg

_level99.control.gotoAndStop(1);

http://www.redpearl.co.nz/ee/project.zip

Z
0
 

Author Comment

by:plundquist
Comment Utility
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!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now