actionscript 3 - AS3: setChildIndex of targetSection + "_mc" to FRONT / accessing buttons on alpha:0 MC -


i'm making customisation app in flash cs5 using as3 & greensock's timelinemax.

the navigation based on snorkl.tv bullet proof portfolio uses timelinemax jump labels in timeline, , alpha in appropraite mc. mcs [garment_mc,size_mc,design_mc,ink_mc,options_mc,checkout_mc] sit on same space on stage on separate layers, , tween x:-100 when button clicked.

this means when swf published top layer , it's mc cover other mcs, , when navigate lower mcs, displayed underneath alpha:0 mc, top-most mc's buttons/functions still clickable , affect previous choice (choose garment, next section, click on mc, registers on top-most mc).

i need navclick function include like... setchildindex(targetsection + "_mc", 0) have been getting 1067: implicit coercion errors.

can make suggestions why? or should here? im racing towards final hand-in date great, thank you!!

naigation code.

// section clips visible on stage //we don't want see them when swf starts //set array of section clips can start them alpha=0; var panel_clips = [garment_mc,size_mc,design_mc,ink_mc,options_mc,checkout_mc];  (var j:number = 0; j < panel_clips.length; j++) {     panel_clips[j].alpha = 0; }  ////  var tl:timelinemax = new timelinemax({}); tl.timescale = 1;   tl.addlabel("garment_in", tl.duration); tl.append(tweenmax.to(garment_mc, 0, {alpha:1, immediaterender:false})); tl.append(tweenmax.from(garment_mc, .5, {x:-100, y:0, ease:quart.easeout}));  tl.addlabel("garment_complete", tl.duration); tl.append(tweenmax.to(garment_mc, .5, {alpha:0}));    tl.addlabel("size_in", tl.duration); tl.append(tweenmax.to(size_mc, 0, {alpha:1, immediaterender:false})); tl.append(tweenmax.from(size_mc, .5, {x:-100, y:0, ease:quart.easeout}));  tl.addlabel("size_complete", tl.duration); tl.append(tweenmax.to(size_mc, .5, {alpha:0}));    tl.addlabel("design_in", tl.duration); tl.append(tweenmax.to(design_mc, 0, {alpha:1, immediaterender:false})); tl.append(tweenmax.from(design_mc, .5, {x:-100, y:0, ease:quart.easeout}));  tl.addlabel("design_complete", tl.duration); tl.append(tweenmax.to(design_mc, .5, {alpha:0}));    tl.addlabel("ink_in", tl.duration); tl.append(tweenmax.to(ink_mc, 0, {alpha:1, immediaterender:false})); tl.append(tweenmax.from(ink_mc, .5, {x:-100, y:0, ease:quart.easeout}));  tl.addlabel("ink_complete", tl.duration); tl.append(tweenmax.to(ink_mc, .5, {alpha:0}));   tl.addlabel("options_in", tl.duration); tl.append(tweenmax.to(options_mc, 0, {alpha:1, immediaterender:false})); tl.append(tweenmax.from(options_mc, .5, {x:-100, y:0, ease:quart.easeout}));  tl.addlabel("options_complete", tl.duration); tl.append(tweenmax.to(options_mc, .5, {alpha:0}));   tl.addlabel("checkout_in", tl.duration); tl.append(tweenmax.to(checkout_mc, 0, {alpha:1, immediaterender:false})); tl.append(tweenmax.from(checkout_mc, .5, {x:-100, y:0, ease:quart.easeout}));  tl.addlabel("checkout_complete", tl.duration); tl.append(tweenmax.to(checkout_mc, .5, {alpha:0}));   //set nav  navmc.addeventlistener(mouseevent.mouse_over, navover); navmc.addeventlistener(mouseevent.mouse_out, navout); navmc.addeventlistener(mouseevent.click, navclick); navmc.buttonmode = true;  navmc.garmentbtn.id = "garment"; navmc.sizebtn.id = "size"; navmc.designbtn.id = "design"; navmc.inkbtn.id = "ink"; navmc.optionbtn.id = "options"; navmc.checkbtn.id = "checkout";  function navover(e:mouseevent):void {     //tweenmax.to(e.target, .5, {tint:0x00ccff});     e.target.nextframe();     //e.target.gotoandstop(e.target.nextframe);     //trace("rolled"); }  function navout(e:mouseevent):void {     //tweenmax.to(e.target, .5, {tint:null});     //trace(e.target.id);     e.target.gotoandplay(1); }    function navclick(e:mouseevent):void {     trace(e.target.id);     targetsection = e.target.id;     if (targetsection != currentsection)     {         e.target.gotoandplay(2);         --> ?? //setchildindex(targetsection + "_mc", 0)    <--------??????         tl.tweenfromto(targetsection + "_in", targetsection + "_complete");         currentsection = targetsection;       }else{         trace("you @ " + currentsection);         }  }   //play through home1_complete automatically on first run tl.tweento("garment_complete");   // 

in navclick function change line:

targetsection = e.target.id; 

like this:

targetsection = e.target; 

because setchildindex function first argument needs child movie , not name/id.

edited: in case may should try this:
setchildindex( getchildbyname(e.target.id + "_mc"),0);


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -