Basic SWFAddress Setup


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import com.asual.swfaddress.*;
  2.  
  3. function handleSWFAddress(e:SWFAddressEvent):void {
  4. trace("# SWFAddress Path: "+e.path);
  5.  
  6. switch(e.pathNames[0]) {
  7. case "section2":
  8. //code to go to section 2
  9. break;
  10.  
  11. case "section1":
  12. default:
  13. //code to go to section 1
  14. break;
  15. }
  16. }
  17.  
  18. SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleSWFAddress);
  19.  
  20. //Use setValue to change sections
  21. //If left here it will override deeplinks by changing the value immediately
  22. SWFAddress.setValue("/section1/");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.