Hi Karl,

jus keep breathin;), this will pass and you'll never go back to as2 again;).

Anyway on subject, have you tried out the standard SimpleButton class?
If it doesnt fit your need, why not, maybe we can help with that, but that class should work for most simple cases.

In addition, do you still use the Flash IDE? Since as3 offers so many options, here is just one of the possible ones that might fit your workflow:

- create a basic button class, put all the buttonMode, handCursor etc stuff in there - add the eventlistener mumbojumbo in there as well, in short everything to create a button - if you want to implement the functionality for different states such as _up, _down etc go ahead and do so

Now create a movieclip with timeline states _up, _down etc, and specify your button class as base class for this clip:
-voila a button, you can do this with as many buttons as you like

Of course if you'd rather keep the assets external that is possible as well, but it might require a slightly different setup.

HTH,
JC






On 24-10-2012 14:33, Paul A. wrote:
Try removing:

button1_btn.mouseChildren = false;
button2_btn.mouseChildren = false;

Your code is a bit convoluted!

divers_btn.addEventListener(MouseEvent.CLICK, function() { gotoAndStop("divinedivers"); }); scuba_btn.addEventListener(MouseEvent.CLICK, function() { gotoAndStop("scubadudes"); });

divers_btn.addEventListener(MouseEvent.ROLL_OVER, function() { divers_btn.gotoAndStop("OVER");});
..

Paul

On 24/10/2012 12:39, Karl DeSaulniers wrote:
Hello All,
Long time. If your available at the moment, I could use your help with some AS3. I finally got an AS3 job! Yay! But I am stuck on the most simple of things.
All I am trying to do is make some buttons work... lol
Here is my code.

button1_btn.buttonMode = true;
button2_btn.buttonMode = true;
button1_btn.useHandCursor = true;
button2_btn.useHandCursor = true;
button1_btn.mouseChildren = false;
button2_btn.mouseChildren = false;

button1_btn.addEventListener(MouseEvent.CLICK, function() { changeSelect(1); }); button2_btn.addEventListener(MouseEvent.CLICK, function() { changeSelect(2); }); button1_btn.addEventListener(MouseEvent.ROLL_OVER, function() { toggleB1(2); }); button2_btn.addEventListener(MouseEvent.ROLL_OVER, function() { toggleB2(2); }); button1_btn.addEventListener(MouseEvent.ROLL_OUT, function() { toggleB1(1); }); button2_btn.addEventListener(MouseEvent.ROLL_OUT, function() { toggleB2(1); });

function changeSelect(p):void {
        switch (p) {
            case 1:
this.gotoAndStop("divinedivers"); //goto frame divinedivers in this MC
            break;
            case 2:
this.gotoAndStop("scubadudes"); //got frame scubadudes in this MC
            break;
        }
}

function toggleB1(f):void {
        button1_btn.gotoAndStop(f); //toggle this button MC frame
}

function toggleB2(f):void {
        button2_btn.gotoAndStop(f); //toggle this button MC frame
}

Why does AS3 have to make things so difficult for something so simple??
What the heck am I doing wrong???

Also, how do you use just a button instead of a mc?
I tried using just a button and it wouldn't even switch to the over state that is inside the button!!?

AS2 is just so much more simple... sigh*

TIA,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to