Iframe menu target

Get help using Construct 2

Post » Tue Nov 12, 2013 10:39 pm

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?
B
9
S
4
G
1
Posts: 104
Reputation: 2,278

Post » Wed Nov 13, 2013 2:27 am

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.
B
60
S
21
G
10
Posts: 643
Reputation: 10,320

Post » Wed Nov 13, 2013 8:07 am

Thanks @Mr E Bear.

The link seems still to open in the iframe instead of refreshing the whole window... Must try more later.
B
9
S
4
G
1
Posts: 104
Reputation: 2,278

Post » Wed Nov 13, 2013 12:03 pm

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.
B
9
S
4
G
1
Posts: 104
Reputation: 2,278

Post » Wed Nov 13, 2013 3:49 pm

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!
B
60
S
21
G
10
Posts: 643
Reputation: 10,320

Post » Mon Nov 18, 2013 9:50 pm

Thanks again @Mr 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?WizLore2013-11-18 21:58:39
B
9
S
4
G
1
Posts: 104
Reputation: 2,278


Return to How do I....?

Who is online

Users browsing this forum: 25games, jatin1726, kiki4construct and 31 guests