I’m having problems with creating a class that holds all the code for my event & listeners that listens for objects that are in a different class.
package {
import flash.display.;
import flash.events.;
public class Prospect extends MovieClip {
var theLogin:MovieClip = new login();
public function Prospect () {
}
}
]
//////////////////////////////////////////////////////////////////////////////////////////////
package {
import flash.events.*
import flash.display.*;
public class TheEvents extends Prospect implements IEvents {
public function TheEvents () {
}
public function LoginEvents():void {
theLogin.loginBtn.addEventListener(MouseEvent.CLICK, loginClick);
function loginClick(event:MouseEvent):void {
trace('login button clicked');
}
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.;
import flash.events.;
public class Main extends MovieClip {
var theProspect:Prospect = new Prospect();
var events:TheEvents = new TheEvents();
public function Main () {
addChild(theProspects.theLogin);
events.LoginEvents();
}
}
}
Basically I am trying to set the listener to listen for an object that is in a different class.
When I test my project with this concept I don’t get any errors but I don’t see the trace statement from TheEvents class after I click the loginBtn.
Any help or better way of accomplishing this would be greatly appreciated.