• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 636
  • Last Modified:

moving to next scene

Hi all

i am developing a project in Flash MX 2004

it has 2 scenes, 1-preload scene, 2-main scene

first it opens preload scene, and plays the loading animation,
when it is loaded it should go to main scene and stops on the 1 frame of main scene

---- this code is on the clip event of the loading movie on the preload scene ------
onClipEvent (enterFrame) {
            totalBytes = _root.getBytesTotal();
            loadedBytes = _root.getBytesLoaded();
            percentDone = int((loadedBytes/totalBytes)*100) ;      
            this.txtPercent = "% " + percentDone ;
            if (totalBytes>loadedBytes) {
                  this.gotoAndStop(percentDone);
            } else {
                  _root.gotoMain();
            }
}


-------- this code is on the timeline of the preload scene -----
function gotoMain() {
      gotoAndStop("main",1);
}

it goes to main scene, but also stays on the preload scene (i dont want to see the content of the preload scene)

how can i completely go to main scene?

thanks in advance,
Nurbek
0
nurbek
Asked:
nurbek
  • 9
  • 9
  • 8
2 Solutions
 
BillystyxCommented:
try gotoAndStop(100); where 100 is the frame number past the last frame in the preload scene

billystyx
0
 
BillystyxCommented:
with your method though, it is easier not to work with scenes, but with movieclips.

add 2 frames to the start of the main movie, and put your preloader clip on the first frame of those 2 frames.
second frame action script:
gotoAndPlay(1);

first frame:
   totalBytes = _root.getBytesTotal();
          loadedBytes = _root.getBytesLoaded();
          percentDone = int((loadedBytes/totalBytes)*100) ;    
          this.txtPercent = "% " + percentDone ;
          if (loadedBytes>=totalBytes) {
               this.gotoAndStop(3);
          }

frame3:
start of main movie

billystyx
0
 
blue-genieCommented:
that sounds odd, the timeline can't be on 2 scenes simulataneously.  It's just not possible.

maybe you should delete your movieclip when its finished loading.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
nurbekAuthor Commented:
Billystyx

adding gotoAndStop(100); on the last frame doesnt change

i can do it adding two frames start of the main scene (which i dont want to do :) )


blue-genie
is there something like remove the scene?

any other ideas?
0
 
blue-genieCommented:
not that i'm aware of, but you can use removeMovieClip.
is it possible for you to post your file, i'm very curious to see how 2 scenes can display simulataneously.

0
 
BillystyxCommented:
I meant to change 100 to a number which was one over the very last frame of your preloader scene.

if your preloader mc has the linkage identifier set in the library (to a name, say, 'preloader'), you can put a stop();
on frame 1 of main movie, and then this code
dep=_root.getNextHighestDepth();
attachMovie("preloader","preloader",dep);

preloader._x=200;
preloader._y=200;

preloader.onEnterFrame=function(){
totalBytes = _root.getBytesTotal();
          loadedBytes = _root.getBytesLoaded();
          percentDone = int((loadedBytes/totalBytes)*100) ;    
          this.txtPercent = "% " + percentDone ;
          if (loadedBytes>=totalBytes) {
removeMovieClip(this);
               _root.play();
          }

}


Billystyx
0
 
nurbekAuthor Commented:
here is the link (maybe this explaines better :) )

www.ajansgalya.com/test/temp.fla

http://www.ajansgalya.com/test/temp.swf

0
 
BillystyxCommented:
dep=_root.getNextHighestDepth();
attachMovie("preloader","preloader",dep);

preloader._x=200;
preloader._y=200;

preloader.onEnterFrame=function(){
totalBytes = _root.getBytesTotal();
          loadedBytes = _root.getBytesLoaded();
          percentDone = int((loadedBytes/totalBytes)*100) ;    
          this.txtPercent = "% " + percentDone ;
          if (loadedBytes>=totalBytes) {
this.gotoAndStop("percentDone");
          }

and on the button that takes you into the main site

on(release){
_root.preloader.removeMovieClip();
               _root.play();
}

But I can't look at the fla right now ... so I can't fix it up...

billystyx
}
0
 
blue-genieCommented:
nurbek, :-)

i thought as much, it's not possible for 2 scenes to play simulataneously, if you have a look in your layer1 of your main scene, you'll notice you have an instance of your cizgi movieclip there - that's whats playing - not your preloader.

just remove it.

blu.
0
 
nurbekAuthor Commented:
billystyx

attaching movie is the same as adding 2 frames start of the main scene,

i want to use two(or more) scenes jumping from one to another,
(preloading was just an easy example of demonstrating it)




0
 
BillystyxCommented:
why?
(out of interest:)
0
 
nurbekAuthor Commented:
i couldnt manage jumping between scenes, and something stays on my head :)
how can i do it, is it possible, this will bother me, unless i find the satisfied solution :)

If it is possible, i will try different ideas, without using load, remove, attach etc...  :)

i have done projects using loadmovie, attach remove etc... (want to try different things :) )



0
 
blue-genieCommented:
nurbek? your original question says
"it goes to main scene, but also stays on the preload scene (i dont want to see the content of the preload scene)"

is that no longer the problem?

0
 
nurbekAuthor Commented:
this is still problem :)

but it can be solved adding two frames or attaching moveclip as Billystyx sugested

i want to completely jump to another scene :)


0
 
blue-genieCommented:
but u are jumping to another scene.
0
 
BillystyxCommented:
fair enough then - just interested to know why ( I personally don't like scenes - but it could be unfamiliarity that leads me to that conclusion).
Billystyx

good luck with your project

0
 
BillystyxCommented:
If the clip is removed from the main scene - then on the click of that button it moves to main scene, doesn't it?

(I haven't seen the fla, but what Blu said makes sense)
0
 
blue-genieCommented:
scenes suck, i concur.

if that's what this was all about, then yes I agree, don't use scenes, but if you absolutely want to then do it, and if its just a case of using it for preloading that's find, but i'd advise that further development (i.e. main scene) use movieclips and external swfs.

thats my last word on that....

blu.
0
 
nurbekAuthor Commented:
blue-genie

i want to completely jump to next scene :) (if you noticed that movie clips on both scenes are visible)
it is jumping, but it looks like  loading movie clip (loading the main scene)

Billystyx
i have also done projects in one scene

this time i wanted to try more scenes :)
0
 
blue-genieCommented:
explain that again.

what do you mean by completely jump to next scene, how is it currently not complete?

0
 
nurbekAuthor Commented:
jumping to another scene

when i jump to main scene from preload scene, i dont want too see the buttons, movies, graphics etc... on the preload scene
as if main scene opened firslty, not the preload scene


0
 
blue-genieCommented:
but nurbek, what you will see on your main scene depends on what you put on your main scene and therefore, that's what you see.

in your case, you see the text in red that says "This is the main scene :) "
AND you see the text in blue that says this is the loading scene, cause that's what you have on the main Scene.

am i making any sense here or have I lost the plot?

blu.

0
 
nurbekAuthor Commented:
tuuuuuuuuuuuuu

beat me now :)

yeah, maybe i also worked too much :)

10x blue-genie :) you got the nice shot
i used the same movie with same places on both movies :) (thats why i couldn see the difference)
0
 
blue-genieCommented:
he sees the light!!!!!

:-)
0
 
nurbekAuthor Commented:
thanks to both

now i can take a deep breath!!!

regards,
nurbek
0
 
BillystyxCommented:
good luck:)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now