Hmmmm...

I think I am mistaken about the Void.
Make all the "Void" back to "void" on the "onClick" function.
Do you have a listener set up for your button?

//declare your functions before the onClick

function about():Void{
        //do something
}
function commercial():Void {
        //do something
}
function contact():Void {
        //do something
}

function onClick(e:MouseEvent):void {
    if (e.currentTarget.name == "about") {
                about();
        } else if (e.currentTarget.name == "contact") {
                contact();
        } else if (e.currentTarget.name == "commercial") {
                commercial();
        } else {
                gotoAndPlay(3);
        }
}
myButton.addEventListener(MouseEvent.CLICK, onClick);

I do appologize, I am not a AS3 programer and my specialty is mor AS2, but hopefully someone can add to this response who would know more about it.
HTH


Karl DeSaulniers
Design Drumm
http://designdrumm.com


On Jul 2, 2009, at 10:18 PM, Gustavo Duenas LRS wrote:

Ok I've tried just what you say and now I HAVE IMCOMPATIBLE OVERRIDE AND DUPLICATE FUNCTION DEFINITION, SOMEONE HELP ME PLEASE!!!

GUSTAVO

On Jul 2, 2009, at 10:44 PM, Karl DeSaulniers wrote:

Hey there Gus,
I think you just had a couple of things typed wrong. Try this:

//declare your functions before the onClick

function about():Void{//you had a lowercase "void" here it needs to be "Void"
        //do something
}
function commercial():Void {//you didn't have a "Void" here
        //do something
}
function contact():Void {//you had a lowercase "void" here it needs to be "Void"
        //do something
}

function onClick(e:MouseEvent):Void {//you had a lowercase "void" here, I think it needs to be "Void", plus you had "mouseEvent" and I think it needs to be "MouseEvent"
        if (e.currentTarget.name == "about") {
                about();
        } else if (e.currentTarget.name == "contact") {
                contact();
        } else if (e.currentTarget.name == "commercial") {
                commercial();
        } else {
                gotoAndPlay(3);
        }
}

HTH

Karl DeSaulniers
Design Drumm
http://designdrumm.com

On Jul 2, 2009, at 9:03 PM, Gustavo Duenas LRS wrote:

Hi coders I have this code

this is an onclick function


function onClick(e:mouseEvent):void{

if(e.currentTarget.name =="about"){
about();
}else if(e.currentTarget.name=="contact"){
contact();
}else if(e.currentTarget.name=="commercial"){
commercial();
}else{ gotoAndPlay(3);}
}

function about():void{
do something
}
function commercial(){
do something
}
function contact():void{
do something}

Well the problem is that anytime I'm running through the flash, it gets me an odd error like an 1021: Duplicate function

does anyone can see what is wrong there and what am I missing?

Gustavo
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to