Scenes AS3

Subscribe to Scenes AS3 10 posts

Sign in to reply


 
avatar for KMAE KMAE 439 posts
Flag Post

I am having some trouble with Scenes in CS4. Below is my preloader which is in a separate scene. The preloader works great, it loads and continues onto the next scene. The problem occurs after. All my gotoAndStops and/or gotoAndPlays seem to have some wonky behavior. When I remove the scene everything plays normally as before. But when I put the scene back it messes up again.

I have selectively gone and tried putting on those certain links that don’t seem to work: I have not done this for all of them. Should I? I usually just put gotoAndStop… without anything in front of it. Is that a problem with scenes. Anyways the below don’t seem to make any difference. I tried to make sure my timeline layers were all still aligned appropriately and they seem fine to me.

this.gotoAndStop("frame", "scene");
this.gotoAndStop("frame");
MovieClip(root).gotoAndStop("frame");
MovieClip(root).gotoAndStop("frame", "scene");

For example when I click on the credits button that points to the credits frame it goes instead to the game frame and the game is playable. When I click the game button it says that frame doesn’t exist.

From the game frame that I got to by clicking the credits button, if I click the quit button I go to the last instructions page instead of the main menu. I don’t see any pattern to this.

I found a potential solution that does not appear to work. A website said make sure there is no actionscript on the page you are linking to from the other scene. So I have removed the actionscript from that frame and started it on the next frame. Still no go.

I have a couple more things to try, any advice is appreciated.

Preloader:

stop();
import flash.media.Sound;
import flash.media.SoundChannel;

addEventListener(Event.ENTER_FRAME, preloaderListener);

var sndCat:catmeow3 = new catmeow3();
var sndCatChannel:SoundChannel = sndCat.play(10);

function preloaderListener(evt:Event):void {
	var percent = loaderInfo.bytesLoaded/loaderInfo.bytesTotal;
	preLoad.scaleX = percent;
	//trace(percent);
	if (percent == 1) {
		continueOn();
	}
}

function continueOn():void {
	removeEventListener(Event.ENTER_FRAME, preloaderListener);
	gotoAndPlay("intro", "Poe");
}
 
avatar for Varilian Varilian 92 posts
Flag Post
Originally posted by KMAE:

function continueOn():void {
removeEventListener(Event.ENTER_FRAME, preloaderListener);
gotoAndPlay(“intro”, “Poe”);
}

Why do you have a gotoAndPlay?
Try using this instead. If I know how your preloader looks, then this should work just fine.

function continueOn():void {
	removeEventListener(Event.ENTER_FRAME, preloaderListener);
	nextFrame();
}

If that code is in the last frame of your preloader, or a layer that reaches the last frame, your swf will automatically advance to the next scene.
 
avatar for KMAE KMAE 439 posts
Flag Post

I will try that, I didn’t know the scene was considered attached so closely if that makes sense. I thought in order to get out of one scene to another you had to specifically call it. The play is because it goes right into the intro animation so I don’t want to stop.

Edit: That did not work. Since I had erased the first frame of the second scene thinking it would conflict, calling nextFrame(); just goes to that blank frame and stops. If I call nextFrame(); from there it goes to the first frame of animation and stops. So I have to call play(); to get it started again.

I want to get this fixed because having a portable preloader is supposed to be beneficial. If I give up, I’ll just end up putting the preloader in the 1st frame of my second scene and probably never use scenes again :P

 
avatar for Varilian Varilian 92 posts
Flag Post
Originally posted by KMAE:

I will try that, I didn’t know the scene was considered attached so closely if that makes sense. I thought in order to get out of one scene to another you had to specifically call it. The play is because it goes right into the intro animation so I don’t want to stop.

Edit: That did not work. Since I had erased the first frame of the second scene thinking it would conflict, calling nextFrame(); just goes to that blank frame and stops. If I call nextFrame(); from there it goes to the first frame of animation and stops. So I have to call play(); to get it started again.

Have you tried calling play(); from the last preloader frame?

 
avatar for KMAE KMAE 439 posts
Flag Post

Same error.

 
avatar for Moonkey Moonkey 1007 posts
Flag Post

gotoAndPlay(“intro”, “Poe”);

If you’re specifying a frame label, you don’t need to specify a scene as well. It’ll find the label regardless of which scene its in.

 
avatar for KMAE KMAE 439 posts
Flag Post

No, it isn’t that thanks. I have removed the reference to the new scene. Just have the labels.
Calling play from the preloader still sends me on my way fine, but for some reason the links are still screwed up. Maybe it could be Flash? I’ll try to do a proper publish and try it in a browser instead of the built in player.

Edit: Nope, wasn’t that. Still does it when published too. Anyone work with scenes before? Is there some way they can mess up the goto links?

 
avatar for KMAE KMAE 439 posts
Flag Post

Still having problems with this. Am now willing to send the .fla to people I trust which are those I know help people with consistently good answers.

 
avatar for ajwontpay ajwontpay 970 posts
Flag Post

hope your game ends out to be great

 
avatar for Draco18s Draco18s 5885 posts
Flag Post
Originally posted by ajwontpay:

hope your game ends out to be great

Congratulations on your recent necromancy!

Sign in to reply