PDA

View Full Version : My Button Won't Activate...



tomyknoker
02-26-2007, 01:00 AM
Hi all,

I know it's something simple but could someone please take a look at the attached file and tell me what I am doing wrong! There is an MC on the rollOver state of my button but it won't play, it starts to play and then stops... Any help would be much appreciated!

BLiZZaRD
02-26-2007, 03:07 AM
Here is a solution. I didn't take a very close look at yours, but you need to ensure that you know the difference of when/how to use MCs and buttons.

With Flash 8 I have made a TON of buttons, and not once have I had to use the Button declaration. Using MCs to do the job makes it a whole lot easier. Also, make sure you give instance names and click the "export for Action Script" linkage options.

tomyknoker
02-26-2007, 03:13 AM
Hey Blizzard... That's actually an awsome explanation in it's self of how buttons shoud work! Thanks again!

BLiZZaRD
02-26-2007, 03:29 AM
Welcome.

Remember with this one though... this was just an example, and you can actually get REALLY wild if you want. Just follow the example(s) and you can add other effects, sparkles, attachSound("soundname"); whatever.

Get wild, test it out, try different things. It's how we learn :D

tomyknoker
02-27-2007, 06:01 PM
Hey Blizz! I tried to animate some MC's into Buttons but I couldn't get the attached to work... I'm sure it's something to do with the way I am targeting it... Could you take a look if poss and see if you can see what i am doing wrong? The 'CREATIVE' button has the actions...

BLiZZaRD
02-27-2007, 10:39 PM
Okay, you are going to be mad at me :p

AS and instance names and linkage and MC names are ALWAYS CaSE SenSItIvE!

on your "menu" btn you had:



on(rollOver){
_root.btnWhole.gotoAndPlay("labelStormCreative");
}
on(rollOut){
_root.btnWhole.gotoAndStop("44");
}


notice the name is btnWhole... yet the MC is NAMED BtnWhole.

Changing it to:



on(rollOver){
_root.BtnWhole.gotoAndPlay("labelStormCreative");
}
on(rollOut){
_root.BtnWhole.gotoAndStop("44");
}

it works perfectly.

Now for a few tidbits of advice:

1) look at the LAST frames of the BtnWhole MC.. they are just frames.. you will see your blue tween line is dotted. highlight all the final frames (frame 80) and convert them to keyframes. this will end and complete your tweens.

2) you are using text as buttons... this is fine, but if you notice you have to rollOver the letters, if you rollOver inbetween the letters it acts as rollOut. To fix this, just make all your text into MCs, and add a black background. this way no matter where onthe text I rollOver I am still "on" the button.

Hope it helps.

It looks good too. Might be able to be cleaned up and use less frames, less plain items and more MCs and AS, but that is up to you. :)

tomyknoker
03-01-2007, 06:00 AM
Ahhhhh jeex I knew it was something simple! Thanks for the advice Blizzard... Was wondering what you thought could be cleaned up and in what part could I use AS for? Only if you have time maybe you could give me some more advice! :)

BLiZZaRD
03-01-2007, 08:07 PM
I will be more than happy to offer up some advice. Please allow me time to finish up some of these smaller projects I am working on at the moment and I will use your old file to show you some things to do, as well as a few little "tricks" to help everything work a little smoother.

tomyknoker
03-02-2007, 02:42 PM
Thanks Blizzard look forward to it! :)

BLiZZaRD
03-07-2007, 06:25 PM
Okay, had a wee bit of time so I tweaked on your thingy here.

Not everything I wanted to show you is in here, because not all the opportunities presented themselves. However I will be going over some of the other things in future tutorials I post here so keep an eye out ;)

Mainly the important things are to remember the following:

try and make EVERYTHING a movie clip. It makes editing, tweening, tweaking, moving, etc easier.

Except for buttons, click the option for "linkage" on every MC you make. Even if you don't plan to use AS 2.0 linkage, it helps when you need it and don't realize it. Just make it a habit that when you make or convert to a movie clip you check the export for linkage option.

tween when you can, as opposed to line by line animation. Also, try and make it so you can reuse MCs (like your drawing of the line around the sub menu parts) Making one circle animation is easier to drag on stage and rename or give instance names too, and is less CPU intensive than making whole new circles.

Give backgrounds to text, especially those that will be clicked on or interactive.

Take a look at the little changes I have made here, and see what you can take and learn from. Same results, a little smaller and faster movie. :)

nisa
05-07-2007, 02:14 AM
hello..i have problem with linking my button rollover to page.html.Anybody tell me how can i solve my problem????i'm trying see a action script but i can't do.so hope help me as soon as possible.

Medyman
05-09-2007, 07:24 PM
You should explain your problem better. I'm not sure what you're trying to do.

If you're linking onRollOver...here is how I would do it

1. Use a movie clip instead of a button
2. Use the following actionscript


<movieclip>.onRollOver = function() {
getURL("page.html");
}

If you want to get rid of the hand cursor, use this:


<movieclip>.onRollOver = function() {
getURL("page.html");
this.getHandCursor = false;
}

loydbrahn
11-29-2007, 08:00 AM
I just stumbled across this thread, and am having a similar problem.

I have just started working with Flash, and don't have much experience. I am trying to create a simple flash menu, where rolling over each menu items causes a different movie clip to play.

I have tried to model my .fla and Action Script after the files in this thread. My movie clip plays fine by itself, but nothing happens when I rollover my button.

I'd appreciate any assistance anyone can give.

--Uh oh. I tried to upload my .fla, but apparently it's too big (even .zipped).

Here's my action script for the button:

on(rollOver) {
_root.productsMC_mc.gotoAndPlay("xplay");
}
on(rollOut) {
_root.productsMC_mc.gotoAndStop("1");
}

I've name the second frame of my movie clip (productsMC_mc) xplay, and added

stop;

to the action script of the first and last frames of the movie clip.

Is there anyway to make my .fla smaller so I can upload it? It's almost 4MBs!


Thanks!

BLiZZaRD
11-30-2007, 12:14 AM
Depending on the versions and other things in the file, your coding is correct. You will need to check that you have given the MC an instance name and perhaps even a linkage identifier.

If you have all that and it still isn't working you can make a new document with just the nave bar in it and zip up that file. ;)

Alternately, code it slightly different. instead of relying on the AS to find where the user is at, let the user tell the Flash where he is.

ON the button put this code:



on(rollOver) {
this.gotoAndPlay("xplay");
}
on(rollOut) {
this.gotoAndStop(1);
}