Making movie clip disappear with button


hi all,

thank looking @ post , hope can answer question

 

basically have interactive 3d project when viewer clicks on window , drags either right or left, appears rotating 3d model rendered out in maya. doing moving mouse on x axis causes movie clip play backwards or forwards.

the code got site works dream! have made click next button goes identical movie clip , start same frame previous movie clip left off from. i'm rather proud of myself @ moment

however - on second identical movie clip (mc_2) has labels on images. , want is, on mouse press labels disappear , when viewer has finished scrubing through time line mouse drag , releases mouse, labels reappear!

very here : http://bmc.erin.utoronto.ca/~enid/interactivethyroidectomy/

 

so worked out code works in little test project did. put code on button called my_btn , made label , changed movie clip called my_mc, , worked perfect

 

on (press) {

_root.my_mc._visible = false;

}

on (release) {

_root.my_mc._visible = true;

}

 

but need previous movieclip, mc_2, use code above. however, if add anywhere amoungst previous actionscript coding in layer mc_2, viewer can no longer scrub through time line anymore. code above affected previous code. is:

 

stop();

mc_2.stop();

var startx:number;

var startframe:number;

var changedistance:number;

var traveldistance:number;

mc_2.onpress = presshandler;

mc_2.onrelease = releasehandler;

mc_2.onreleaseoutside = releasehandler;

function presshandler():void {

startx = mc_2._xmouse;

startframe = mc_2._currentframe;

this.onmousemove = movehandler;

}

function releasehandler():void {

this.onmousemove = null;

}

function movehandler():void {

changedistance = mc_2._xmouse - startx;

traveldistance = startframe + changedistance;

if (traveldistance > mc_2._totalframes) {

mc_2.gotoandstop(traveldistance % mc_2._totalframes);

} else if (traveldistance < 0) {

mc_2.gotoandstop(mc_2._totalframes + (traveldistance % mc_2._totalframes));

} else {

mc_2.gotoandstop(traveldistance);

}

 

}

 

just i'm ultra clear various layers etc

on scene 1 have 4 layers

actions, buttons, movie clips , background

in frame 2 has actionscript listed above, , mc_2

inside mc_2 100 frames of 360 degree view images of shoulder rendered maya

in layer above images have labels - 1 of ive converted movieclip called my_mc purpose of post.

 

so need add somewhere actionscript mc_2 mouse presses, , releases make specific mc (my_mc) invisible when mouse pressed, , re appear when mouse released.

i hope makes sence.

 

thank in advance.

cat

as best can tell deascription, need put 2 lines of code presshandler , releasehandler functions.

 

function presshandler():void {

   startx = mc_2._xmouse;

   startframe = mc_2._currentframe;

   this.onmousemove = movehandler;

   my_mc._visible = false;

}

 

function releasehandler():void {

   this.onmousemove = null;

   my_mc._visible = true;

}



More discussions in ActionScript 1 and 2


adobe

Comments