Be a Supporter!

Very weird Event Listener problem!!

  • 298 Views
  • 7 Replies
New Topic Respond to this Topic
Rhinan
Rhinan
  • Member since: May. 19, 2005
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Very weird Event Listener problem!! May. 29th, 2012 @ 08:58 AM Reply

So I'm basically going crazy here. The rule is;
"Assign an event listener to a function, and flash does whatever is in the function when the event happens"

right? Well Flash currently disagrees. I've done only that but it just doesn't work. It doesn't give errors or anything, it just doesn't work.

I'm building a portfolio website in Flash at the moment, and I have some event listeners made in the first (and only) frame of the website. They do all the work for all the buttons. But ever since I added the art lightbox, 13 listeners stopped working. Traces show that the code never even gets to the function.

Example here.

It's a difficult problem so if anyone would like to help me out please provide me your skype name or anything else to communicate with and I will show you everything about the file.

MUCH thanks in advance, I hope someone can help.
~Rhinan

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to Very weird Event Listener problem!! May. 29th, 2012 @ 09:03 AM Reply

Your "art lightbox" is probably on top of the other objects and is blocking the mouse events. It works again if you remove it, right? Solution: make the "art lightbox" mouseEnabled property false.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

Rhinan
Rhinan
  • Member since: May. 19, 2005
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Response to Very weird Event Listener problem!! May. 29th, 2012 @ 09:26 AM Reply

At 5/29/12 09:03 AM, ProfessorFlash wrote: Your "art lightbox" is probably on top of the other objects and is blocking the mouse events. It works again if you remove it, right? Solution: make the "art lightbox" mouseEnabled property false.

W-wow. You can't imagine how much that helped. I didn't know of such a thing! The games work again, but the art is still below the games page so that doesnt work at the moment. Would it help if I load the movieclips with actionscript instead of just placing them on the stage manually? Or do you know a better way to do this?

Thanks a LOT!

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to Very weird Event Listener problem!! May. 29th, 2012 @ 09:36 AM Reply

At 5/29/12 09:26 AM, Rhinan wrote: The games work again, but the art is still below the games page so that doesnt work at the moment.

I do not understand what you are saying here.


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

Rhinan
Rhinan
  • Member since: May. 19, 2005
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Response to Very weird Event Listener problem!! May. 29th, 2012 @ 09:39 AM Reply

At 5/29/12 09:36 AM, ProfessorFlash wrote:
At 5/29/12 09:26 AM, Rhinan wrote: The games work again, but the art is still below the games page so that doesnt work at the moment.
I do not understand what you are saying here.

I have two movieclips with mouse event movieclips in them. They're on top of each other but I can't move them because that would screw the overall look of the website. Is there any way to get the mouse events to work again without moving the movieclips?

ProfessorFlash
ProfessorFlash
  • Member since: Oct. 6, 2007
  • Offline.
Forum Stats
Member
Level 32
Programmer
Response to Very weird Event Listener problem!! May. 29th, 2012 @ 09:57 AM Reply

At 5/29/12 09:39 AM, Rhinan wrote:
At 5/29/12 09:36 AM, ProfessorFlash wrote:
At 5/29/12 09:26 AM, Rhinan wrote: The games work again, but the art is still below the games page so that doesnt work at the moment.
I do not understand what you are saying here.
I have two movieclips with mouse event movieclips in them. They're on top of each other but I can't move them because that would screw the overall look of the website. Is there any way to get the mouse events to work again without moving the movieclips?

You can solve this by organizing. Removing the buttons from the two movieclips sounds like the simplest solution. That way there is no overlapping, because the buttons aren't overlapping, right? It's the container movieclips that overlap?


You can solve pretty much any problem you may have with AS3 by consulting the AS3 Language reference.

Rhinan
Rhinan
  • Member since: May. 19, 2005
  • Offline.
Forum Stats
Member
Level 15
Game Developer
Response to Very weird Event Listener problem!! May. 29th, 2012 @ 10:01 AM Reply

At 5/29/12 09:57 AM, ProfessorFlash wrote:
At 5/29/12 09:39 AM, Rhinan wrote:
At 5/29/12 09:36 AM, ProfessorFlash wrote:
At 5/29/12 09:26 AM, Rhinan wrote: The games work again, but the art is still below the games page so that doesnt work at the moment.
I do not understand what you are saying here.
I have two movieclips with mouse event movieclips in them. They're on top of each other but I can't move them because that would screw the overall look of the website. Is there any way to get the mouse events to work again without moving the movieclips?
You can solve this by organizing. Removing the buttons from the two movieclips sounds like the simplest solution. That way there is no overlapping, because the buttons aren't overlapping, right? It's the container movieclips that overlap?

Yep, but the buttons are on the same position anyway. I'm thinking of deleting them when they're at the last frame of their fadeout frame, then bringing them back in when you click the 'games' or 'art' button. Seems the most easy way.

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to Very weird Event Listener problem!! May. 29th, 2012 @ 10:42 AM Reply

At 5/29/12 10:01 AM, Rhinan wrote: I'm thinking of deleting them when they're at the last frame of their fadeout frame

use a tween engine for such simple effects, it's much more convenient than frame based animation and a lot easier to do something when it's finished as most tween engines provide a possibility to register a callback function or event listener.

Instead of removing all buttons, put them in one container and remove/add that container.