View Full Version : targeting mess
lunatic
January 1st, 2004, 06:10 PM
Howdy.
I have a looped sound and some components in my main movie (scroll bar) which for some reason is really bogging down my swf and causing the preloader bar not to show up until like 46% or something ridiculous.
So I am trying to solve the problem by having a preloader swf as suggested by Kode in this thread (http://www.kirupaforum.com/forums/showthread.php?s=&threadid=34466&highlight=linkage). However, now all my targeting is messed up in my main movie. Everything that was _root has to change but I can't tell what to load it into. I tried using _parent, _parent._parent, _root.container_mc (which is a blank movie clip created in the preloader swf that main is loaded into after the preloader is 100%) and others but nothing works. Even the simple looped sound which was originally just _root.backsound.start(0,999) can't be targeted.
Can anyone tell me how to target things on my main stage based on the preloader swf?
Thanks!
kode
January 1st, 2004, 10:16 PM
Load the SWF into a level instead. ;)
lunatic
January 1st, 2004, 10:38 PM
Hi Kode!
How do you mean? I think in the code you gave in that thread that I followed the new movie clip called container_mc is loaded into level 0. So do you mean I should load the container_mc into another level or skip the container_mc all together and just load the main.swf directly into a level on the preloader swf? I have lots of _root references in main.swf (plus other swfs that get loaded into main) so do I need to replace all those? I think I am over confusing myself but I couldn't get anything to work properly.
Thanks for any help! :D
kode
January 2nd, 2004, 12:18 AM
Yeah, load the SWF directly into another level; and don't forget to modify the code in the preloader movie, so it gets the bytes loaded/total of the level into which you're loading the SWF. :)
lunatic
January 2nd, 2004, 12:32 AM
(panicked) how do you reference a level?? :huh:
kode
January 2nd, 2004, 12:58 AM
http://livedocs.macromedia.com/flash/mx2004/main/12_as287.htm
:P
lunatic
January 2nd, 2004, 01:04 AM
Well I've got that part down but I'm still having trouble referencing the items on the main.swf that is now, say, on level 10.
I've got this on my preloader:
//on frame 1:
function preload() {
var bytes_loaded = _level10.getBytesLoaded();
var bytes_total = _level10.getBytesTotal();
var getPercent = Math.floor(100*bytes_loaded/bytes_total);
loadBar._width = getPercent*200;
percentClip.loadText.htmlText = getPercent+"%";
clipBounds = loadBar.getBounds(_root);
percentClip._x = clipBounds.xMax;
percentClip._y = loadBar._y;
if (bytes_loaded>0 && getPercent == 100) {
this.onEnterFrame = undefined;
}
}
//on frame 2 so you don't see the preload bar:
stop();
loadMovieNum("main.swf", 10);
this.onEnterFrame = preload;
and now, for example, on my main.swf I've got this code to loop an mp3 sound that is in the library of main.swf:
backsound = new Sound();
backsound.attachSound("loopy");
_root.backsound.start(0,999);
Obviously _root doesn't work there but I'm confused as to what I'm supposed to put. _level10.backsound.start(0,999); doesnt' work either. What am I being stupid about? :hair:
kode
January 2nd, 2004, 11:03 AM
Uhmm... by loading the SWF into a level you shouldn't have change anything, it should work fine. :-\
Could you attach your files (or upload them to your server if the files are too big)? :P
lunatic
January 2nd, 2004, 11:23 AM
Yeah that's what I thought. Now I seem to have messed it up even more where the prelaoder paged doesn't even load the main.swf.
here are the files (home.comcast.net/~mkatzmoye/test.zip)
I would like for the intro page to load the preloader page in a popup, then when the preloader is finished it loads main.swf onto level 10.
What am I doing wrong Kode? :h:
lunatic
January 2nd, 2004, 08:42 PM
Hey Kode, sorry to bug ya, but do you have any idea why this isn't working?
Thanks for the help! :bu:
*edit: Actually I got it working but the preloader never shows. Just blank white screen until all is loaded. Got any clues?
www.marysuetobin.com
lunatic
January 7th, 2004, 07:11 PM
Okay I'm back again! Preloaders just aren't my thing I guess :(
Anyone wanna help with this one?
Here is the code I have now on frame one of a swf called preloader:
function preload() {
var bytes_loaded = _level10.getBytesLoaded();
var bytes_total = _level10.getBytesTotal();
var getPercent = Math.floor(100*bytes_loaded/bytes_total);
loadBar._width = getPercent*200;
percentClip.loadText.htmlText = getPercent+"%";
clipBounds = loadBar.getBounds(_root);
percentClip._x = clipBounds.xMax;
percentClip._y = loadBar._y;
if (bytes_loaded>0 && getPercent == 100) {
this.onEnterFrame = undefined;
}
}
and on frame 2:
stop();
loadMovieNum("main.swf", 10);
this.onEnterFrame = preload;
But page is white until fully loaded then main.swf starts. You can see the effect here (www.marysuetobin.com)
Any feedback much appreciated! :pleased:
kode
January 8th, 2004, 02:24 AM
OM(F)G! I'm so sorry! I've been totally busy and I forgot about this. :(
But... I'm free tonight, I'll check it out as soon as possible. :)
kode
January 8th, 2004, 03:15 AM
Ok, you have to make a couple of changes to the preloader:
1) Insert a frame at frame 2 in the components layer (this will fix the white screen thing!).
2) Replace this line in the preload function:
loadBar._width = getPercent*200;
With this one:
loadBar._xscale = getPercent;
3) Uhmm... there's no third step, we're done. :P
lunatic
January 8th, 2004, 11:26 AM
Hi Kode! Thanks so much for getting back to me! Oh I hate to even say it but it's still not working.
1) I don't have a components layer? :h:
2) I replaced this code but the same thing is happenning:
I have an index page with an Enter button on it. When you click the enter button it loads the Preloader.html page which is SUPPOSED to show the preloader then load the main.swf onto Level 10. The main.swf file IS loading but no preloader bar/percent shows - instead there is just a blank white screen in the preloader.html pop up for a few moments and then main.swf starts right up. So the only real problem here is that the loadBar/loadText isn't showing while main is being loaded.
Thanks so much for sticking with me here! :bu: :hr:
kode
January 8th, 2004, 11:45 AM
1) There are 2 layers in the preloader movie, one is labeled code and the other one is labeled components; insert a frame at frame 2 in the components layer. ;)
2) You won't see any difference unless you've completed step 1. :P
...Maybe I should just attach the FLA. :)
lunatic
January 8th, 2004, 12:05 PM
Oh duh, sorry, I know what you mean! :trout: I was thinking of the fla called components that was in the original thread - you had zipped a couple examples together that I've been working from.
I am at work now but will try it out as soon as i get home. Thanks again Kode! U R dabest!
kode
January 8th, 2004, 12:11 PM
You're welcome - As usual, let me know if you can't get it to work. =)
lunatic
January 8th, 2004, 09:42 PM
Works beautifully of course. I feel so stupid for not seeing that. How'd you know I forgot that part?
Thanks again. Hope I'm as flash smart as you some day! :D
kode
January 8th, 2004, 11:24 PM
You shouldn't feel stupid about it. It's not only you... people usually tend to overlook small things. :P
Once again, you're welcome; glad I could help. :beam:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.