Jump to content

[HELP] Automatically change text


*RaCeR^

Recommended Posts

Hello everybody, i'm here for help with a little problem.

I'm trying to create a Youtube Browser to play songs for the whole server. but Link does not update itself as it should.

Can anyone tell me a function that does when I click the link it automatically changes the URL in the text bar?

 

Below this to change when you click a button. I wanted him to change alone. 

function geturl()
if source == CINEMA.button[1] then
	guiSetText(addressBar,getBrowserURL(theBrowser))
	end
end
addEventHandler("onClientGUIClick",root, geturl)


Can somebody help me ? Thx s2 
 

Link to comment

it's an event you attach it to your browser element like how you attached the onClientClick event to the cinema button.

function geturl()
	guiSetText(addressBar,getBrowserURL(source))
end
addEventHandler("OnClientBrowserNavigate",theBrowser, geturl)

This event will be called every time the browser navigates to a different page.

Link to comment
function geturl(theBrowser) -- Function of URL Link to guiSetText with a Button Command
if source == CINEMA.button[1] then
	guiSetText(addressBar,getBrowserURL(theBrowser))
	end
end
addEventHandler("onClientGUIClick",root,geturl)

local theBrowser = guiGetBrowser(browser) -- Function of the Browser
addEventHandler("onClientBrowserCreated", theBrowser, 
	function()
		loadBrowserURL(source,"https://www.youtube.com")
	end
)

Don't have any errors in debugscript and it works with the button function, if i put the function to he goesn't alone :c 

If anyone can help me with this file, contact me Pv. Please :c ( i send the script )

Edited by *RaCeR^
Link to comment

Please explain:  "when I click the link it automatically changes the URL in the text bar?"

Which link and where? Are you talking about links that are rendered within the browser or any GUI/DX text link?

The code provided by LopSided_  should work absolutely fine. 

 

local theBrowser = guiGetBrowser(browser) -- Function of the Browser

addEventHandler("onClientBrowserCreated", theBrowser,
function()
    loadBrowserURL(source,"https://www.youtube.com")
end )


function geturl(targetURL)
    guiSetText(addressBar, getBrowserURL(targetURL))
end
addEventHandler("OnClientBrowserNavigate",resourceRoot, geturl)

 

Edited by dk99
  • Like 1
Link to comment
9 hours ago, dk99 said:

Please explain:  "when I click the link it automatically changes the URL in the text bar?"

Which link and where? Are you talking about links that are rendered within the browser or any GUI/DX text link?

Yes, the URL Changes in the text bar automatically, 

Yes, Every Link, and Rendered within the Browser, like Chrome example, but for the Youtube, u Click on a Video and URLText changes automatically. ( i can make a little video for explain if u want )

 

Link to comment

Update: http://imgur.com/a/T1KbC


It works only when you put it in 1 time it goes, then it does not work anymore.

type: i'm enter the youtube, but, if i click on a video, the URL don't change.

function geturl(theBrowser, b)
    bool = true
    for b, v in string(b, browser) do
    guiSetText(addressBar, getBrowserURL(theBrowser))
    end
end
addEventHandler("onClientBrowserNavigate",root,geturl)
addEventHandler("onClientBrowserDocumentReady",root,geturl)

 

Link to comment

That was 1 of the problems I came across when I made my youtube script.

The problem is youtube's site, not the script because if you try it with this forums it will work perfectly.

Maybe you can check either of my youtube scripts and probably find the solutions and get some tips.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...