I'm having trouble with this menu tutorial I
Anyway my problem is their base menu class is;
package com.game.scripts. Menu {Import Flash. Display. movie clip; Import flash.display.Stage; Import flash.events.Event; Import caurina.transitions.Tweener; Public Class Basemanu Expands Movie Clip (Public V Forum): Stage; Public var loadNext: base menu; Public function base menu () {alpha = 0; } Public function unload (load: base menu = null): zero {if (loadMe! = Null) {loadNext = loadMe; } Tweener.addTween (this, {alpha: 0, time: 0.7, but full: Remove}}; } Remove public function (): Zero {// sendmail (new event ("menu deleted")); If (stageRef.contains (this)) {stageRef.removeChild (this); } If (loadNext! = Null) {loadNext.Load (); }} Public function load (): zero {stageRef.addChild (this); Tweener.addTween (this, {alpha: 1, time: 0.7}); }}} Whenever I use the Remove () function, which is also used by the unload () function, my forum. AddEventListeners Breaks Especially my forum breaks AddEventListener (KeyboardEvent.KEY_UP, KeyUpHandler) does not execute in any other category at all.
Is there another way that I can remove the menu without breaking the stage? Or if you know of a better menu tutorial, the link will be appreciated: D
edit I have commented everything in the Remove () function and The key handler is still not working. Edit 2 The first edit only applies to my main menu, my other menus look fine, I commented on this part; if (stageRef.contains (this)) {stageRef.removeChild (this); } and my KeyUpHandler works fine, so I'm assuming that Flash will not remove the movie clip for me, or will I be okay and it will be removed?
I can only guess that the sprite which you are giving to the menu class for the phase of reef Do not have any reference after your phone is deleted, and therefore collect garbage, so you can not get any key events anymore.
Two suggestions:
- Make sure you set a reasonable price for stageRef
- to make sure that you have your keyboard listener The steps are not cleaned to ensure they are using a strong reference.
Comments
Post a Comment