How to track page change


To track, when page change, use AS3 code:


getClassByAlias("aliasXmLoader").xmLoader.
  addEventListener("pageChanged", onPage);
 
function onPage(e:Event):void {
var currentPage:String;
currentPage = getClassByAlias("aliasXmLoader").xmLoader.currentPage;
// in var currentPage - current page internal address
// for example: XmAdvPage-main/Home
}


For example, you can track page visiting with certain name:

function onPage(e:Event):void {
var currentPage:String;
currentPage = getClassByAlias("aliasXmLoader").xmLoader.currentPage;
 
if(currentPage.substr(0,22)=="XmAdvPage-main/Project") {
  gotoAndPlay('projects');
  return;
}
gotoAndPlay('default');
return;
 
}


 

For designer