Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 10-29-2002, 07:07 AM   #1
[raz]
Registered User
 
Join Date: Jul 2002
Posts: 38
Default check if level exists...

hi,

working on a menu system that loads a movie into a level upon button press (basic stuff), always loading the movies into the same level...

what i'm wondering is, how i could check to see if a level is ready or not, to then load the next level...

purpose? on button press, i'd like to have the loaded level movie, i.e. about.swf on level 2, play a set number of frames as an outro sequence...then load the desired next movie onto that same level once that outro sequence has ended.

all loaded movies will have a similar outro sequence, the same number of frames long, within the same numbered frames.

i.e. i have a menu system, on level 0, two buttons, one is "about" the other is "links"

when you press "about" the about.swf loads into level 2, plays, stops on frame 50

when you press links, the code reads...

on (release) {
_root._level2.gotoAndPlay(51);
}

which plays the outro sequence, frames 51 - 100...

now comes the tricky part (for me that is)...how do i check to see if level 2 has reached frame 100 before i load up the links.swf into that same level? I'm assuming there has to be some sort of loop checking to see if frame 100 on level 2 has been reached, but i don't know all that much about actionscripting...so when frame 100 has been reached, the desired movie (based on button press) will load smoothly after the outro sequence of the previous movie into that same exact level, replacing the previous one...

so the question is, how do you check to see what frame a level is on, all within the actionscripting of one button?

like...

on (release) {
_root._level2.gotoAndPlay(50)
}

if ...(help me !!) level 2 is at frame 100, then go to

loadMovieNum(selectedmovie.swf,2)

otherwise, wait till level 2 is at frame 100, then load the next movie...


i hope this all makes sense and you guys can help me out...thanks
[raz] is offline   Reply With Quote
Old 10-29-2002, 08:50 AM   #2
i++
Registered User
 
Join Date: Sep 2002
Location: 5 feet over ground
Posts: 120
Default

hi raz,

there are different ways to solve your problem.

either ask the _currentframe of _level2 from _level0:
ActionScript Code:
if(_level2._currentframe >= 100){...}


or let the about.swf set a variable if it has reached frame 100:
actionscript for frame 100 of about.swf:
ActionScript Code:
_level0.outroReady = 1;
and on _level0 in a frame loop or enterFrame-handler:
ActionScript Code:
if(outroReady){...}


or let the about.swf call the loadMovie-command:
actionscript for frame 100 of about.swf:
ActionScript Code:
_level2.loadMovie(selectedMovie);

hope it helps.

i++
i++ is offline   Reply With Quote
Old 10-29-2002, 01:42 PM   #3
[raz]
Registered User
 
Join Date: Jul 2002
Posts: 38
Default

Quote:
Originally posted by i++


either ask the _currentframe of _level2 from _level0:
ActionScript Code:
if(_level2._currentframe >= 100){...}


i++
this seems the most understandable to my newbie knowledge of scripting... but my newbieness is most with "if" commands...

so then, what would come after the if statement? if correct, it would load the next movie, however, what if it hasn't reached frame 100 yet? this is kind of like a oldschool preloader in a sense right? if frame x is loaded, go to and play frame x, then if that came back false, the next frame would tell it to go back to frame 1 or something...but my question is can all this checking and rechecking be done all within the one script of the "on (release)"

so it would be like this...

on (release) {
_root._level2.gotoAndPlay(50)
if(_level2._currentframe >= 100)
?????
?????
loadMovieNum(links.swf,2)
}

what replaces the question marks above? what if it hasn't reached 100, then how do you repeat the checking process until it has reached 100, then continue on in the script, loading the next movie via the loadMovieNum action?

thanks for the help so far, appreciate it greatly...
[raz] is offline   Reply With Quote
Old 10-30-2002, 03:00 AM   #4
[raz]
Registered User
 
Join Date: Jul 2002
Posts: 38
Default

anyone?
[raz] is offline   Reply With Quote
Old 10-30-2002, 06:26 AM   #5
farafiro
Addicted To FLASH
 
farafiro's Avatar
 
Join Date: Dec 2001
Location: Egyptian in UAE
Posts: 12,436
Send a message via MSN to farafiro Send a message via Yahoo to farafiro
Default

hey [raz], what i++ said is right but u just need to put it on an onEnterFrames to check it, so
ActionScript Code:
//on the links button on(release){ _level2.gotoAndPlay(51) } //then on an empty MC or if your are on MX make it on the _root onClipEvent(enterFrame){ if(_level2._currentFrame == 100){ _level2.loadMovieNum("links.swf") } }
but I mostly recommend to make it with variables, cause if the second loaded movie has 100 frame, it will be re-loaded again.
but with variable u can stop checking if the variable has anoher value

also if u used the onEnterFrame with Flash MX, u can delete it later
__________________
‚€* GOD Is Near ‚€*
Questions Don't PM for Questions . Thanks
An eye for an eye, make the whole world blind
_____________________________________________GHANDI
farafiro is offline   Reply With Quote
Old 10-17-2006, 10:55 PM   #6
brusli
Registered User
 
Join Date: Oct 2005
Posts: 2
Default

instead of
if(_level2._currentframe >= 100){...}
try
if(_level2._currentframe >= _level2._totalframes){...}
brusli is offline   Reply With Quote
Old 10-18-2006, 01:59 AM   #7
anonymous
Banned by AS.org Staff
 
Join Date: Oct 2006
Posts: 1,524
Default

More simply...

if(_level2._width > 0){
// then something is loaded on that level...
}
anonymous is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:58 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.