I am new at actionscript 3. I want to change a variable set to 0 in the parent to 1 when a button in the child is clicked.
This is the parent zero.swf:
var noPass:Number=0;
function getPass(event:onLoad, noPass):void {
if(noPass==0) {
var passRequest:URLRequest=new URLRequest("PasswordPage.swf");
var passLoader:Loader = new Loader();
passLoader.load(passRequest);
addChild(passLoader);
} else {
removeChild(passLoader);
var navRequest:URLRequest=new URLRequest("nav/ILNav.swf");
var navLoader:Loader = new Loader();
navLoader.load(navRequest);
addChild(navLoader);
}
}
addEventListener(onLoad, getPass, noPass)
this is the child PasswordPage.swf:
submit_btn.addEventListener(MouseEvent.CLICK, subClick, noPass);
var myName:String;
var myPass:String;
function subClick(event:MouseEvent, noPass):void {
myName=name_txt.text;
myPass=pass_txt.text;
failedName_txt.text="";
failedPass_txt.text="";
if (myName=="Kim"&&myPass=="Pablo") {
//this.parent.removeChild(this);
//DisplayObjectContainer(this.parent).removeChild(this);
//unload(passLoader);
noPass=1
} else if (myName != "Kim") {
failedName_txt.text="You have entered the wrong Username.";
} else {
failedPass_txt.text="You have entered the wrong Password.";
}
}