Locate application and generate a string with a online sourcefolder url


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

Method finds out if application runs online or offline and fills the variable contentURL with a flashvars parameter.


Copy this code and paste it in your HTML
  1. private function applicationIsOnline(stage : Object) : Boolean
  2. {
  3. var returnVal : Boolean = new Boolean(false);
  4. if(stage.loaderInfo.url.indexOf("file:") != -1)
  5. {
  6. trace("Computer works lokal");
  7. contentURL= "";
  8. returnVal = false;
  9. } else
  10. {
  11. trace("Computer works online");
  12. if(stage.loaderInfo.parameters.contentURL != null)
  13. {
  14. contentURL = stage.loaderInfo.parameters.serverURL;
  15. } else
  16. {
  17. contentURL = "";
  18. }
  19. returnVal = true;
  20. }
  21. return returnVal;
  22. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.