Load= true?

okay i have a scen named preload, and i want it to load an external .swf, but once it’s done doing so to move on to frame two so far i have

stop();
_root.createEmptyMovieClip(“container”,1);
container.loadMovie(“01.swf”);
container._x = container._y = 0 ;
if (this.getBytesLoaded() == this.getBytesTotal()) {
_root.play(“preloader”, 2);
} else {
gotoAndPlay(“preloader”, 1);

and this doesn’t work, i think my problem is the “if(this.getBytesLoaded()” but i am not sure how to identify if the movie is loaded, maybe with true and false? but i am not sure how i would do that, help pretty please?

first thing ive noticed is that youve not closed off your else statement :wink:

reason your code doesnt work though is because your not updating your values. its nice to think that if you write something like ytou have in your else statement it would reload the frame but flash thinks its smart and so to prevent a looping error, it ignores gotoAndPlay functions if the target frame is the same as the current frame…

solution:
move your current frame 2 to frame 3 and on new frame 2, give it the AS

gotoAndPlay(1)

whereas on your preloader code have this instead:

_root.createEmptyMovieClip("container",1);
container.loadMovie("01.swf");
container._x = container._y = 0 ;
if (this.getBytesLoaded() == this.getBytesTotal()) {
_root.gotoAndPlay("preloader", 2); //note that _root.play() doesnt accept arguements, ie. _root.play(this, is "an" [arguement]) will evaluate the same as _root.play()
}

that should solve your problem :slight_smile:

Prophet.

hey that’s cool, thanks, but what if i put something like this in my movie:

stop();
if (_root.getBytesLoaded()<_root.getBytesTotal()) {
gotoAndPlay(_root.“intro”, 2);
} else {
gotoAndPlay(_root.“intro”, 1);

but because i am a retard :wink: i don’t know how to target the main movie from the external swf, so my _root.“intro”,2 doesn’t really work, urgh, how would i point to that?

_root.gotoAndPlay("intro", 2)

you define the path before you tell it what to do, ie, imagine you have a group of children one calle _root, one called _parent, one is called Eric_MC, the other is textbox… (they had retards for parents :wink: lol) youve got to address one of them before you tell them what to do, _root!! gotoAndPlay in the garden!!! because lets face it, gotoAndPlay in the garden _root!! would just get a “whaaa??” as a response (if ur lucky!)

sorry for the weird response :wink: but its like nearly 2.45 am…

Prophet.

OH* my gosh! how easy, duh, ok thanks a million buck-a-roo, sillyness is cool, hopefully that will help me remember that, kiss kiss

lol ur welcome :blush: :smiley:
it was my pleasure miss :hat:

Prophet.

sorry to bother you again, but i just created a flash document and the first code you gave me with the “if (this.getBytesLoaded()” freezes on that frame and doesn’t go any further, and it doesn’t make any sense to me why it doesn’t move on…i used refering to root with external swfs and that’s doing dandy and so is the rest of it, but…man, poop!

_root.createEmptyMovieClip("container",1);
container.loadMovie("01.swf");
container._x = container._y = 0 ;
if (this.getBytesLoaded() == this.getBytesTotal()) {
_root.gotoAndPlay("preloader", 3); //note that _root.play() doesnt accept arguements, ie. _root.play(this, is "an" [arguement]) will evaluate the same as _root.play()
}

i edited your original code when i posted it but silly me forgot to change it so that when your 100% preloaded you go to frame 3 rather than 2… try that, might work better

Prophet.

PS not a problem, i dont mind helping twenty-something ladies ;):wink: lol

actually i noticed that already and corrected it, my movie still just stops for no apparent reason at the frame with that action script in it, i am at work right now, but i will look at it a little harder when i get home

what i am really trying to do is have an intro to a site that has three swf backgrounds, and one randomly is used, i have figured that out, but the external swf is not effected by my pre-loader, therfore the background doesn’t show up for 5 seconds on a slow connection, and i am trying to make it a bit more pro quality and figuring out how i can load the backgrounds before the intro is actualy played.

ok doke…
hmmm…

bytes=container.getBytesLoaded()+this.getBytesLoaded()
total=container.getBytesTotal()+this.getBytesTotal()

_root.createEmptyMovieClip("container",1)
container.loadMovie("01.swf")
container._x = container._y = 0

if (bytes == total) {
	_root.gotoAndPlay(3) // note i got rid of your scene here... keeps things as simple as possible.... it will goto frame 3 of whatever timeline this code is in now...
}

this will preload your background as well.
you dont have a preloader bar or anything?
here:

bytes=container.getBytesLoaded()+this.getBytesLoaded()
total=container.getBytesTotal()+this.getBytesTotal()
percent = (bytes/total)*100
loadBar._width=2*percent

_root.createEmptyMovieClip("container",1)
container.loadMovie("01.swf")
container._x = container._y = 0

if (bytes == total) {
	_root.gotoAndPlay(3) // again got rid of your scene here: hope u dont mind ;)
}

all you gotta do is have a rectangle as a movieclip which has a registration point of the left (well left hand reg point is most common for preloaders anyway) and its max width at the moment will be 200 pixels.

that should work… dont forget you shouldnt have any kind of stop() action on frames 1 or 2 and on frame 2 it should have this AS

gotoAndPlay(1)

and your intro starts on frame 3 (make sure your preloading gfx arent visible by this point) if this fails, try putting this AS in:

trace(bytes+" / "+total)

and see if there are any errors there… failing this, post your fla and i will do my best to take a look, failing this (o my god thats a lot of "failing this"s! ;)) email me your fla at samyoue@gmail.com

Prophet.

EDIT:- if you do send an fla, im using FMX, not FMX2004 ok?

That’s Awesome!!, i understand all the AS, so i will get to using it tonight, if i have any problems i will send you the fla, but i should be fine: i hope there is a little place in heaven for you Prophet.

:smiley:

Prophet.