User Tag List

Results 1 to 10 of 10

Thread: Get Current URL?

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    201
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Get Current URL?

    Is there anyway to get the current URL? I tried looking at the Flash Player Object's actions but there doesn't seem to anything there.

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,343
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    The Flash Player object has an expression called GetDomain$( "Flash® Player" ).
    I have not tried it, but that seems like it may do the job.
    If that only retrieves the domain (www.mysite.com) and you need it to retrieve the entire url of the current page that links to the application, then you can do that by calling a javascript that retrievs the url of the current page. You can add the javascript on the page that links to the file.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    201
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    Cool, I now have a .js function which reads...

    Function JSGetCurrentURL()
    {
    var currentURL = window.location.pathname;
    }

    ..but how exactly do I return the value into mmf2? There doesnt seem to be an onComplete condition for the object, only an 'on JavaScript Error' condition?

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    201
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    OKay, now I've found how to display the returned String using JSStrResult$( "Flash® Player" ) however this is actually returning empty) despite using the following js function:

    function JSGetCurrentURL()
    {
    var currentURL = window.location.pathname;
    return currentURL;
    }

    What's up with the .js function?

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    201
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    BTW, I also tried GetWindowDomain$( "Flash® Player" ) as described in the documentation to get the full domain path but this only returns the top level site name ("mysite.com")

    I still need assistance with the .js function.
    Cheers

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,343
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    Have you tried it on an actual webserver? As far as I remember the javascript function wouldn't work on the local filesystem.

    1. Make sure the javascript works on your webserver (mysite.com)

    2. Add this code to your MMF game:

    * Start of frame
    - Flash Object: Call Function "JSGetCurrentURL"
    - String 1: Set Alterable String to JSStrResult$( "Flash Object" )

    3. Save game as Flash, copy it to the webserver, and run it from a page that inludes the javascript.

  7. #7
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    201
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    Yeah, I'm actually running it live on the webserver but nothing is returned. ?

  8. #8
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,343
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    That's strange if you're doing everything correctly. Make sure spelling and capitilazing is correct, and when you call the function, don't include the "()". Try with as simple code as possible. Also make sure that the game gets the latest version of the script, that it is not cached.

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro

    Join Date
    Apr 2008
    Posts
    201
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    Apologies. My javascript was attached to my PHP file which was in a different directory on the server. I have since embedded the javascript function into the actual html page and it gets called just fine.
    Many thanks!

  10. #10
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,343
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    Re: Get Current URL?

    No problem! I had lots of problems before I was able to set it up correctly too

Similar Threads

  1. open url in current window?
    By brett in forum SWF/Flash Export Module Version 2.0
    Replies: 8
    Last Post: 10th August 2011, 07:12 AM
  2. Current state
    By Fanotherpg in forum Install Creator and Patch Maker
    Replies: 4
    Last Post: 5th March 2010, 12:33 PM
  3. Get Current Resolution
    By GabSt in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 25th October 2008, 04:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •