PDA

View Full Version : Embedded Buttons


Icarus
06-19-2002, 08:50 PM
Has anyone else had a problem with jumping between scenes with buttons that are used in an animation?

When I take a button and put it on my page and tell it to jump to a certain scene and frame it works perfectly. However when I try and do the same thing with a button that is embedded in an animation it won't jump to the appropriate scene. As a matter of fact it makes the animation (navigation) go away (as if it is jumping to a empty frame within the animation itself).

I hope this makes sense.

Any Ideas??

JHallam
06-19-2002, 09:15 PM
what are you using just basic button with on(event) ??

have you got the file online so we can view the problem?

Icarus
06-19-2002, 09:48 PM
J,

Thanks for the response. Here is my URL:

http://www.websight.org/Main_New/flash/websight_flash.html

I dropped one of the buttons onto the main scene in the last frame. This is where the problem occurs, right now that button won't go to the right scene, but it does go to frame 1 of the current scene?

The other problem is with the button on the Rollover for About Us. When you try and click on Philosophy - NOTHING! Both Philosophy buttons have the exact same script:

on (release) {
gotoAndPlay ("Philosophy", 1);
}

And it gets stranger still, when I test the button using "Enable Simple Buttons" the link is fine, but when I test it by publishing it becomes broken.

Thanks for your help!

JHallam
06-19-2002, 10:41 PM
Scenes are trouble, you should really use loadMovie alot better!

But anyway,

on (release) {
gotoAndPlay("scene", "1")//make sure "1" is not on set label
}

Better yet, it's late here, if you mail me @ [email protected] then I can help much easier and quicker.

Icarus
06-19-2002, 11:39 PM
Thanks for the offer of the email but it got bumped back to me twice......?

Basically here is what I am trying to accomplish, I know there is
probably a great way to do it through scripts but I am still learning
that aspect of flash. Anyway what I want the scene to do is this:

When the user clicks on Philosophy, and is on the Home page for example,
the home page text flys out (I have it as its' own movie right now) and
the new scene loads. The best way I could think of was to have a new
scene for each button with the fly out animation's in the preceding
frames.

However if you know of, and I am sure you do, a better way to handle
that please let me know so I don't take the long road home!

Thanks once again.

James

JHallam
06-19-2002, 11:53 PM
ahhh reason with email, is cus typo

[email protected]

before it was nltworld.com

pls send before I go sleep

JHallam
06-20-2002, 12:11 AM
okay, leave the email, that way others can help too cus I've ran out of time.

basically, I think you need to set labels in each frame and then call them up

on(release) {
gotoAndPlay ("scene","label"):
}


Should run then. But beware, using frames can get messy.

Search the forum for LoadMovie or even look at the tutorials section

you can have on a button instead of loading another scene.

Basically do this:

get the scenes philosophy etc into new files.

publish them, so that they are SWF files

on main buttons, use -


on(release) {
_root.loadMovie("philosophy.swf");//obviosuly Philosphy button
}

// then on your other buttons
//basically unload the rest and load then one you need. Like

on(release) {
_root.loadMovie("philosophy.swf");//obviosuly Philosphy button
}
_root.unloadMovie("otherscene.swf")
_root.unloadMovie("other3scene.swf")
//etc etc


Like I said, search and read tutorials you will understand better.

Good luck!

Icarus
06-20-2002, 01:33 PM
Thanks for the info.

How can I get the loaded movie to finish playing before it unloads?

Do I need two movies one to fly the text in, one to fly it out? And if so can you then write a script that will tell the first movie (the Home page text) to unload, load the second (the fly out), and finally load the appropriate button (i.e. philosophy)?.

I think I will take your advice and switch it over to load movies, but I want to make sure it is possible before I spend the time.

Thanks!

20 Ton Squirrel
06-20-2002, 03:46 PM
Hey, thought I'd chime in real fast on this. Use of scenes isn't so bad, they work fine. I don't want 'em getting a bad rap here because they can be very useful! It's a personal preference whether or not to use them. To me it all depends on what needs to be accomplished.

If a site was too large I'd consider breaking it up and using loadMovie just to avoid the use of a preloader. When that isn't the case, I use scenes when I need to have a different layer composition or when I need a bit of modularity to juggle around sections of the movie.

There's a certain trick to gotoAndPlay() and gotoAndStop() that isn't necessarilly documented. I've posted on this before, but I'll mention again for the sake of laziness:

The following will work:
gotoAndPlay("myScene", 23);
gotoAndPlay("myScene", "myFrameLabel");
gotoAndPlay(23);
gotoAndPlay("myFrameLabel");

The following will not work:
_root.gotoAndPlay("myScene", "myFrameLabel");

This is because when you call a gotoAndPlay() with a reference it only accepts ONE argument. I'm not sure if that's your problem, but this is at least something to tuck away for later.

If nothing else, you might try just making your frame labels unique throughout the movie and call the gotoAndPlay() on that alone. Make sense?

I'm speaking up on this cuz it seems like you are trading one problem for another, Icarus. Since ya can't get the scenes to work yer moving into a gray area that you have to ask more about.

Can you post your zipped up FLA up here so we can vivisect it?

Icarus
06-20-2002, 06:31 PM
Nyar,

Thanks for your chime in, I do believe you are right about my gray area and I will try and stay in a paler shade of understanding.

I tried your suggestion regarding the frame label and gotoandplay code, however, and much to my chagrin, I am still having the same problem. I have included the FLA file for you to, hopefully, disect, and let me know what it is that I am doing wrong.

James

20 Ton Squirrel
06-20-2002, 07:08 PM
Okie, James-san. I got yo back. The name's Andy, but everyone calls me 20 here. NYAR is like a battlecry... long story. *wink*

Right, so I got this skeletal version of the FLA and peered inside it's stuffage. I see lots going on here. First off, pathing is your problem.

You've got these buttons encased in a movieclip that rests on your main timeline. How do I explain this? Hmmm... When you call gotoAndPlay() it expects to have the target in the movieclip it's called from or the timeline. Make sense?

Now peer back at my last post about how gotoAndPlay() works. If these buttons are in a movieclip then we can't specify two arguments. What you'll need to do is make your frame labels UNIQUE. An easy way of doing this is by the following format:

<SCENE NAME> + "_" + <FRAME LABEL>

Thus if I have a scene called myScene and a frame IN that scene labeled myFrame, it'd look like this:

myScene_myLabel

Then all ya gotta do is change the code on your buttons to look like this:


on (release) {
_root.gotoAndPlay("Philosophy_Phil");
}


That should solve your main problem here. I noticed also that you had lots of on(release) statements in there for a single button. Try this instead:


on (rollOver) {
tellTarget ("About Us Sub Animation") {
gotoAndPlay(2);
}
tellTarget ("Services Sub Animation") {
gotoAndStop(1);
}
tellTarget ("Client Sub Animation") {
gotoAndStop(1);
}
tellTarget ("Contact Sub Animation") {
gotoAndStop(1);
}
}


You'll find it's more efficient and easier to code that way... of course, if you wanna get up-to-date on the code syntax, that could also be done like:

on (rollOver) {
_root["About Us Sub Animation"].gotoAndPlay(2);
_root["Services Sub Animation"].gotoAndStop(1);
_root["Client Sub Animation"].gotoAndStop(1);
_root["Contact Sub Animation"].gotoAndStop(1);
}


Hope this helps you. I strongly suggest you go over some of the basic tutorials we have here, they will help explain the foundations of actionscripting and what not.

Icarus
06-20-2002, 08:46 PM
XX,

Surprisingly I understand everything you said in the last post, and it actually makes sense to me. I implemented your suggestions regarding the path and the unique frame names, unfortunately it didn't help the problem.

I also updated the extraneous code so it is a bit cleaner now. Thanks for the suggestion on the tutorials I am learning them as fast as possible, but you know it may take a while to crawl out of the primordial ooze.

Anyway I am including the updated FLA for your dissection,

James