How do I assign a mouseclick event Listener to a simplebutton already nested in a movie clip when it's dropped on stage?


i'm trying assign mouseclick event listener simplebutton nested within movie clip's later frames, starting @ frame 2 , up. card, however, not added game until later, , when player clicks on it/turns over.

 

there 4 files involved in program:
#1 main actionscript file, corresponds to
#2 dreamquester .fla file.
#3 artifactcard file movieclip's corresponding .as file,
#4 combo1.as file corresponding instance of simplebutton named combo1 already

nested --and instance named-- inside/as child of said artifactcard movieclip.

 

what i've done far isn't working:
in main dreamquester.as file, when player clicks on artifactcard, mouse_down event

listener takes them function (clickartcard), trouble at:

 

// player clicked on artc card--which child of posart1 on stage--to turn card over:
        function clickartcard(a_event:mouseevent) {
            var thisartcard:artifactcard = (a_event.target artifactcard);
            thisartcard.gotoandstop(unclickedart1);  // go frame number of artifact
                                // card combo1 button is.
            thisartcard.removeeventlistener(mouseevent.click,clickartcard);
            thisartcard.buttonmode = false;
            trace("combo1.combo is:" + combo1.combo);
            trace("posart1.artc.combo1 is:" + posart1.artc.combo1);
            posart1.artc.combo1.addeventlistener(mouseevent.mouse_down, comboclickedwho);
            }

 

when artc card--the static public instance of artifactcard--is clicked, gets the

trace("posart1.artc.combo1 is:" + posart1.artc.combo1); which returns error message:  

 

typeerror: error #1010: term undefined , has no properties.
    @ methodinfo-61()

 


so how declare static public variable of simplebutton @ start of main .as

file make defined mousedown actionlistener pre-existing-and-named-instance

combo1 simplebutton?

 

perhaps there way, while debug movie program running, click on simplebutton , see

what it's parent heirarchy is, see name of parents above simplebutton incase

different think?

 


(just in case, hoping squeeze zip file containing these files less 9mb incase willing @ files see i've done far, 9 megs big! though graphics i've imported turned vector graphics trace bitmap. wish there way check file size of each symbol in flash cs4, here...)

 

thank help!

~ethan



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Flip address is out of range arduino uno r3

Arduino Uno not uploading

Indesign and MathType fonts