Iframe menu target

0 favourites
  • 6 posts
From the Asset Store
A well commented template with list menus and shops to use in your top-down RPGs or metroidvania games!
  • I'm doing a menu for a webpage in c2.

    The menu is embedded in an iFrame.

    When I click a link the mainpage should update not just the iFrame.

    Usually you do this by adding _top to the hyperlink.

    How do I do this in Construct 2?

  • Under the browser object the Open URL in new window action has a tag property that can use _parent and _top. Simply add this to an onClick event.

  • Thanks E Bear.

    The link seems still to open in the iframe instead of refreshing the whole window... Must try more later.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Seems as my browser did not refresh properly... worked after deleting browser history.

    I have another question though... How do I keep track og which page the user is at?

    I would like:

    If the user is at link1, button1 is blue

    If the user is at link2, button2 is blue

    etc.

  • Hmmm that's a bit trickier but I think it's doable.

    Create a variable called "URLis".

    Create a system event every tick - choose "Set value" for the action:

    Set the value of URLis to the appropriate Browser object expression (i.e domain, path or hash - hash seems like a good bet here).

    From here you can call events with the conditional of the URLis value, such as displaying buttons.

    That's my best bet; all of this is from memory so I'm sorry if it's off - Let me know how you get on!

  • Thanks again E Bear.

    I just used a text object instead of a variable.

    And used the browser - referrer expression.

    When clicking on the menu item I made in Construct 2 I get a orange flashing of the object when loading the next page. I would like to find out how to avoid that.

    ---actually only chrome does the orange flashing... any idea why?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)