View Full Version : loadMovie question
dking193
08-17-2005, 01:41 AM
Help if you can…
I have a photo gallery I’m working on. I have a mc instance <portfolio> that does a nice fade in and out, that calls a mc <pics> that has a different picture on each frame. Looks like this _root->portfolio->pics. When I click on the thumbs(buttons) that reside on the _root page, you see the old picture fade out (from portfolio mc) and the new picture fade in (pics mc).
Here is a snippet of what works:
//_root.pic_num = picture number I want to view
_root.portfolio.pics.gotoAndStop(_root.pic_num);
Next I decided I needed to load multiple groups of pictures so I decided to use LoadMovie into my default MC but I can’t seem to address the individual pics after I load the external .swf files. Here is that code.
if (_root.pictureGroup == 1) {
// Load Nature thumbs and pics
loadMovie("thumbs_nature.swf", _root.content_mc);
loadMovie("nature_images.swf", _root..portfolio.pics);
} else if (_root.pictureGroup == 2)
// Load Landscape thumbs and pics
loadMovie("thumbs_landscape.swf", _root.content_mc);
loadMovie("landscape_images.swf", _root.portfolio.pics);
}
The above works great. Both the thumbs and the picture groups load up when I click the correct group type button. The problem is now when I try to gotoAndStop on a frame, I see the fade in and out, but the image in frame 1 of the pics mc never changes. If I change from Nature to Landscape I see the image change from the group, but once again I can’t change the image viewed from Frame 1. I’ve tried every combination I can think of to address the individual frames in pics, but nothing works. Why does this work on the default mc but not on the loaded external .swf.
_root.portfolio.pics.gotoAndStop(_root.pic_num);
Please help!
Jiggie
08-17-2005, 02:05 AM
hi!
cud you attach your fla here so that i can help you fix it.
dking193
08-17-2005, 02:17 AM
Due to a lot of house cleaning I need to do, it is very large at this time. I don't think 10-15mb attachments will fly here. I'll see if i can trim it down and/or go ahead and post it on the web.
dking193
08-17-2005, 03:12 AM
I went ahead and posted the site. It will take a few seconds to download (optimization comes later). Most of the site is functional. The problem is on the portfolio section. When you first go there, click on the thumbs and the main picture will change. Next click on the first or second picture (only ones wired) under the My Portfolio secion and you will see the main picture loads up, but you can’t change the image when you click the thumbs. Now perhaps the code snippets above will make sensehttp://www.flashmove.com/board/images/smilies/confused.gif
http://www.kingphotoart.com (http://www.kingphotoart.com/)
Loads up much faster the second time…http://www.flashmove.com/board/images/smilies/wink.gif
Jiggie
08-17-2005, 03:37 AM
hi!
Nice site.
try using trace to see if the variable is being passed from the thumbnail to the bigger picture.
dking193
08-17-2005, 04:18 AM
Thanks Jiggie for the response, but that's not it. I've even hardcoded the frame number for the gotoAndStop with no change. I even used the following code to see if I was hunting with the right dog:
trace(targetPath(_root.portfolio.pics));
It returned "_level0.portfolio.pics" which is the same as "_root.portfolio.pics", right? The .swf files are being loaded, I just can't get to the frame I need.
I tried to use the debugger to trace where the heck the MC is being loaded or get some other clue as to what is going on, but nothing that I can tell.
Jiggie
08-17-2005, 04:26 AM
you loaded landscape.swf into _root.portfolio.pics, right. is there another movieclip inside landscape.swf that holds your pictures? coz if yes, i think you should do this: _root.portfolio.pics.someMC.
if not, try checking the number of frames of your movieclip pics.
trace(_root.portfolio.pics._totalframes)
Hope this helps
dking193
08-17-2005, 04:51 AM
It looks like this root->portfolio->pics. The images are in the pics mc. Take a look at these screen shots and see if this helps.
http://www.kingphotoart.com/root.jpg
http://www.kingphotoart.com/root_action.jpg
http://www.kingphotoart.com/portfolio_mc.jpg
http://www.kingphotoart.com/portfolio_mc_action.jpg
http://www.kingphotoart.com/pic_mc.jpg
these images are high res so if your browser scales them down, just expand it back. As you can see I hardcoded the frame to load to show passing the variables from the thumb buttons isn't the problem.
dking193
08-17-2005, 05:20 AM
Jiggy, you might be on to something! I checked total frames loaded from both the Nature.swf and the Landscape.swf and got 13 for both. The Nature one does have 13, but landscape only has 6. Should I unload the movies before reloading? The original pic mc has 13 images. Am I just picking up the size of the original one?
Jiggie
08-17-2005, 05:26 AM
Hi!
im currently reviewing your work and the pics you sent me...
be right back...
Jiggie
08-17-2005, 05:34 AM
did you try to trace the value of pictureGroup?
my gues is pictureGroup is not recieving and data and thus remains false...
or try this:
if (_root.pictureGroup == 1 || !_root.pictureGroup)
{
//_root.gotoAndStop(yourVariable)
trace(yourVariable)
}
else if (_root.pictureGroup == 2)
{
//_root.gotoAndStop(yourVariable)
trace(yourVariable)
}
dking193
08-17-2005, 05:43 AM
Nope that works fine. Remember earlier I even hardcoded a frame number in here.
This might help. The original mc is the one you see when you first go to the portfolio section and everything works before you click a new portfolio to look at. The original has 13 frames (images) in it. When I load Landscape and check right afterwards it traces 13 frames when it only has 6. Nature which does have 13 shows 13 as well. I'm also printing out the _totalframes inside the the portfolio mc that directs the pics mc which frame to show and the same trace statement that showed 13 earlier now only shows 1 for total frames???
Jiggie
08-17-2005, 05:53 AM
its really hard to troublshoot with out the fla...
can you delete all the images and save-as the fla to a diferent file name then zip it?
then post it here so that i can review it... all i need to see are the codes.
but so far i think it has something to do wen u ....
Ohhhh wait, wait, wait... try this:
create or put an emptyMovieClip in your pics movieclip then load your external swf there (in the empty mc) then from there access it with gotoAndStop just like before.
Jiggie
08-17-2005, 06:01 AM
heres an example
external.swf is loaded into main.swf
dking193
08-17-2005, 06:14 AM
Okay being portofolio mc calls pics this is what I did:
_root.portfolio.createEmptyMovieClip("test_mc", this.getNextHighestDepth());
loadMovie("landscape_images.swf", _root.portfolio.test_mc);
trace("loaded "+_root.portfolio.test_mc._totalframes+" frames from Landscape")
}
However, the trace only returns a 1 when it should return 6. Perhaps I'm not exporting the landscape_images.swf file correctly? I right click on it in the library and export it. Next test will be to remove the stop() on frame one, export it and see if when I run it standalone, it cycle through all the images.
dking193
08-17-2005, 06:53 AM
The .swf files are fine. When I run the .swf file standalone they cycle. When I goto the portfolio section of the website after I removed the the stop() it cycles through all the images. If I click on a thumb nail it stops cycling and stops on the correct image. Next I click on the 1st or 2nd image in My Portfolio, the new .swf file loads and starts cycling. However when I click on the thumb, it will not stop. The stop on number variable is getting through when I trace. I just can't seem to address the loaded mc for the gotoAndStop command.
Jiggy your test of course works fine and is similar to what I'm doing other than I'm a few more levels deep.
Dave
Jiggie
08-17-2005, 07:47 AM
sori for the late response... having internet problems... m still checking on your work.
dking193
08-18-2005, 07:44 AM
After a very long night, again, I found the problem. I reworked the code every way I could and still could not select the images inside the external .swf file. I wont go into all that issues, but apparently you can't just right click on a MC file in the library and export it as a .swf file if it has multiple frames and expect it to work with loadMovie(). At least I couldn't get it to work. I opened a new .fla and rebuilt my slide show, then ctrl+enter to compile and it worked the first time.
If someone knows what you must do in the properties or links to be able to export a swf from the lib and get it to work with loadMovie(), please let us know.
Dave
Jiggie
08-18-2005, 07:51 AM
hi Dave!
Another way to create a .swf from your movieclips in your library is to enter that movieclip and press ctrl+alt+enter
vBulletin v3.5, Copyright ©2000-2010, Jelsoft Enterprises Ltd.