To toggle

hello there,\r\ri have this situation here\ronstage: a button and a movieclip\r\rthe button says:\r\ron (press) {\r_ _ _ _ SAM = not SAM;\r}\r\rand the movieclip says:\r\ronClipEvent (enterFrame) {\r_ _ _ _ if (SAM) {\r_ _ _ _ this.rotation+=20;\r _ _ _ } else {\r_ _ _ _ this.rotation =180;\r _ _ _ }\r}\r\rbut it doesn’t work, the toggling…\r\rwhat gives? \r\rmeesje


 on (press) {SAM=!SAM}

pom 0]

hi pom, thanks for your reply, alas it’s still no go… :frowning:

i know i can solve this by…\r\rnot adding a script TO the MC\rbut make 2 keyframes IN the MC\rand make the button tell targets to goplay some frame\r\rbut i really would like to know why this script\r(which seems to me a more elegant solution)\rdoesn’t work…\r\rmeesje

I know : if (_root.SAM)…\rSAM is located in _root., not in your movie clip. Does that make sense to you ?\r\rpom 0]

another problem might be that you never toggle SAM (at least it’s not toggled in the code you provide).\rif you want the button to toggle, do this:\ron(release){\rif(!sam){\rsam=true;\r} else {\rsam=false;\r}\r}\rif you want the button to toggle one way and the movie to toggle the other…\rbutton:\rif(!sam){\rsam=true;\r}\r}\rmovie:\ronClipEvent(enterFrame){\rif(_root.sam){\r_rotation+=20;\r_root.sam=false;\r} else {\r_rotation=180\r}\r}\r\rif i understand your situation correctly those examples should work for you.\r:) \rjeremy

YEEHA! again happy happy here ))\r\r(_root.SAM) worked\ri never knew one had to write the path of the variable\r\ras for the toggler\r\ron (press) {\r&nbsp &nbsp &nbsp &nbsp SAM = not SAM;\r}