-
1. Re: "Refreshing" frame?
kglad Apr 19, 2010 1:00 PM (in response to Shed Simas)there's no problem adding an event listener. why are you having trouble?
-
2. Re: "Refreshing" frame?
Shed Simas Apr 19, 2010 2:42 PM (in response to kglad)I don't know. But, this is the code I was using. There are multuple buttons for the same functions so here's a simplified version with only one:
stop(); deerphoto.addEventListener(MouseEvent.CLICK, openThis); deerphoto.buttonMode = true; function openThis(myEvent:MouseEvent):void { myEvent.currentTarget.gotoAndPlay(currentFrame+1); myEvent.currentTarget.removeEventListener(MouseEvent.CLICK, openThis); myEvent.currentTarget.buttonMode = false; deerphoto.closeCard.addEventListener(MouseEvent.CLICK, closeThis); } function closeThis(myEvent:MouseEvent):void { gotoAndPlay(3); myEvent.currentTarget.addEventListener(MouseEvent.CLICK, openThis); myEvent.currentTarget.buttonMode = true; }The thing is right now I'm having even more trouble because I tweened my buttons and now they are within a "Tween" symbol and I can't access them. I don't want to convert it to frame-by-frame, but I can't think of any other solutions...
-
3. Re: "Refreshing" frame?
kglad Apr 19, 2010 2:55 PM (in response to Shed Simas)that's not going to work. you're trying to add a mouse listener to whatever just called closeThis() and that object presumably already has a listener.
try:
stop();
deerphoto.addEventListener(MouseEvent.CLICK, openThis);
deerphoto.buttonMode = true;
function openThis(myEvent:MouseEvent):void {
myEvent.currentTarget.gotoAndPlay(currentFrame+1);
myEvent.currentTarget.removeEventListener(MouseEvent.CLICK, openThis);
myEvent.currentTarget.buttonMode = false;
deerphoto.closeCard.addEventListener(MouseEvent.CLICK, closeThis);
}
function closeThis(myEvent:MouseEvent):void {
MovieClip(myEvent.currentTarget.parent).addEventListener(MouseEvent.CLICK, openThis);
myEvent.currentTarget.removeEventListener(MouseEvent.CLICK,closeThis); // not sure you want this
gotoAndPlay(3);
} -
4. Re: "Refreshing" frame?
Shed Simas Apr 19, 2010 3:04 PM (in response to kglad)Hmm, I'm still having the same problem. Clicking "deerphoto" opens it up and disables it, but clicking "deerphoto.closeCard" only closes it, and does not re-enable it.
-
5. Re: "Refreshing" frame?
kglad Apr 19, 2010 3:11 PM (in response to Shed Simas)remove that gotoAndPlay() to see if that's causing a problem.
-
6. Re: "Refreshing" frame?
Shed Simas Apr 19, 2010 3:28 PM (in response to kglad)I did, but still no change...
-
7. Re: "Refreshing" frame?
kglad Apr 19, 2010 3:56 PM (in response to kglad)what the following trace reveal:
stop();
deerphoto.addEventListener(MouseEvent.CLICK, openThis);
deerphoto.buttonMode = true;
function openThis(myEvent:MouseEvent):void {
myEvent.currentTarget.gotoAndPlay(currentFrame+1);
myEvent.currentTarget.removeEventListener(MouseEvent.CLICK, openThis);
myEvent.currentTarget.buttonMode = false;
deerphoto.closeCard.addEventListener(MouseEvent.CLICK, closeThis);
}
function closeThis(myEvent:MouseEvent):void {
MovieClip(myEvent.currentTarget.parent).addEventListener(MouseEvent.CLICK, openThis);
trace(MovieClip(myEvent.currentTarget.parent).name)
myEvent.currentTarget.removeEventListener(MouseEvent.CLICK,closeThis); // not sure you want this
gotoAndPlay(3);
}The thing is right now I'm having even more trouble because I tweened my buttons and now they are within a "Tween" symbol and I can't access them. I don't want to convert it to frame-by-frame, but I can't think of any other solutions...


