flash - HTMLLoader: Navigate Back and Forward in Page History -


i never had problems navigating , forward through page history of htmlloader child of main native window stage. have use: htmlloadervariable.historyforward();

but when add htmlloader child new native window, doesn't seem work.

here code:

function createnewhtmlwindow(pageurl:string):void{     //everytime click button, function creates seperate native window each containing htmlloader class load webpage      var myhtml= new htmlloader();     myhtml.width = 1000;     myhtml.height = 780;         myhtml.addeventlistener(event.complete, myhtmlloaded);       var myhtmloptions = new nativewindowinitoptions();     myhtmloptions.transparent = false;     myhtmloptions.systemchrome = nativewindowsystemchrome.standard;     myhtmloptions.type = nativewindowtype.normal;         var exthtmlwindow = new nativewindow(myhtmloptions);         exthtmlwindow.title="new title";     exthtmlwindow.width = 1015;     exthtmlwindow.height = 800;       exthtmlwindow.activate();     exthtmlwindow.stage.align = "tl";     exthtmlwindow.stage.scalemode = "noscale";      exthtmlwindow.stage.addchild(myhtml);      var backnativewin=new backbutton();     backnativewin.x=5;     backnativewin.y=500;     backnativewin.addeventlistener(mouseevent.click, loadprevhistory);     exthtmlwindow.stage.addchild(backnativewin);      var nextnativewin=new nextbutton();     nextnativewin.x=30;     nextnativewin.y=500;         nextnativewin.addeventlistener(mouseevent.click, loadnexthistory);     exthtmlwindow.stage.addchild(nextnativewin);      myhtml.load(new urlrequest(pageurl)); }  function myhtmlloaded(e:event):void {     //page loads  }   function loadnexthistory(m:mouseevent):void{     output.text="next>>"+m.target.parent.getchildat(0); //next>>[object htmlloader]      m.target.parent.getchildat(0).historyforward(); // line not working   }  function loadprevhistory(m:mouseevent):void{     output.text="prev>>"+m.target.parent.getchildat(0); //prev>>[object htmlloader]     m.target.parent.getchildat(0).historyback(); // line not working  }    

i've tried code own web page, works well.. here's code:

import flash.html.htmlloader; import org.aswing.jbutton; import flash.filesystem.file;  function createnewhtmlwindow(pageurl:string):void{ //everytime click button, function creates seperate native window each containing htmlloader class load webpage  var myhtml= new htmlloader(); myhtml.width = 1000; myhtml.height = 680;     myhtml.addeventlistener(event.complete, myhtmlloaded);   var myhtmloptions = new nativewindowinitoptions(); myhtmloptions.transparent = false; myhtmloptions.systemchrome = nativewindowsystemchrome.standard; myhtmloptions.type = nativewindowtype.normal;     var exthtmlwindow = new nativewindow(myhtmloptions);     exthtmlwindow.title="new title"; exthtmlwindow.width = 1015; exthtmlwindow.height = 700;   exthtmlwindow.activate(); exthtmlwindow.stage.align = "tl"; exthtmlwindow.stage.scalemode = "noscale";  exthtmlwindow.stage.addchild(myhtml);  var backnativewin:jbutton=new jbutton("back"); backnativewin.setsizewh(100,22); backnativewin.x=5; backnativewin.y=500; backnativewin.addeventlistener(mouseevent.click, loadprevhistory); exthtmlwindow.stage.addchild(backnativewin);  var nextnativewin=new jbutton("next"); nextnativewin.setsizewh(100,22); nextnativewin.x=130; nextnativewin.y=500;     nextnativewin.addeventlistener(mouseevent.click, loadnexthistory); exthtmlwindow.stage.addchild(nextnativewin);  myhtml.load(new urlrequest(pageurl)); }  function myhtmlloaded(e:event):void{ //page loads }   function loadnexthistory(m:mouseevent):void{ trace("next>>"+m.target.parent.getchildat(0)); //next>>[object htmlloader]  m.target.parent.getchildat(0).historyforward(); // line not working }  function loadprevhistory(m:mouseevent):void{ trace("prev>>"+m.target.parent.getchildat(0)); //prev>>[object htmlloader] m.target.parent.getchildat(0).historyback(); // line not working  } createnewhtmlwindow(file.desktopdirectory.resolvepath("index.html").url); 

and here's index.html on desktop:

<html> <head>     <title>this test page</title> </head> <body>     <a href="http://www.google.com">click me jump google.</a> </body> 

so think there must wrong test website, changing try again may help..


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -