DJRobThaMan
01-01-2006, 05:20 PM
Hi
I've been using javascript scroll bars for a web site I'm making, but I've finally got up the nerve to go in a different direction. I decided a director file would be best and so I made it and it works perfectly (the track ball follows the mouse when I hold down the mo0use button over it and all the other functionability I want is there) except it doesn't scroll through the content. :)
I didn't really want the whole site to be a director file so the scroll bar is the only thing that is a director file. I'm trying to get it to send out a call to a javascript function with the position of the track ball (I already have this calculated and it does it fine) as a parameter. This javascript function changes the scroll position of the elements in a div (using the scrollTop property).
I've tried using both the externalEvent and getNetText methods and neither seems to work.
Here is the code:
Test:
Lingo:
getNetText("javascript::test()")
(also tried "test()" as a parameter and externalEvent with the same parameters)
Javascript in HTML:
function test()
{
alert("I guess this works");
}
Actual code that I thought would work but didnt :) :
Lingo:
on mouseDown
repeat while the mouseDown
if the mouseV < 15 then
sprite(4).locV = 15
else if the mouseV > 233 then
sprite(4).locV = 233
else
sprite(4).locV = the mouseV
externalEvent("custombar("& string(sprite(4).locV) & ")")
updateStage
end if
end repeat
end
Javascript:
function custombar(x)
{
var info = document.getElementById("container");
info.scrollTop = ((x - 15) / 233) * (info.scrollHeight - 290);
}
As with the test I've tried getNetText as well as adding "javascript::" to the beginning of the parameter.
I've been snooping around and it seems that in VBScript there's a special thing you have to do when you open the script tag to catch the values coming from the director movie. Is there some similar thing that needs to be done for Javascript? Or have I just made some overly simple mistake that I'm going to kick myself for later?
I would really appreciste any sort of help with this.
Thanks a lot,
Douglas
I've been using javascript scroll bars for a web site I'm making, but I've finally got up the nerve to go in a different direction. I decided a director file would be best and so I made it and it works perfectly (the track ball follows the mouse when I hold down the mo0use button over it and all the other functionability I want is there) except it doesn't scroll through the content. :)
I didn't really want the whole site to be a director file so the scroll bar is the only thing that is a director file. I'm trying to get it to send out a call to a javascript function with the position of the track ball (I already have this calculated and it does it fine) as a parameter. This javascript function changes the scroll position of the elements in a div (using the scrollTop property).
I've tried using both the externalEvent and getNetText methods and neither seems to work.
Here is the code:
Test:
Lingo:
getNetText("javascript::test()")
(also tried "test()" as a parameter and externalEvent with the same parameters)
Javascript in HTML:
function test()
{
alert("I guess this works");
}
Actual code that I thought would work but didnt :) :
Lingo:
on mouseDown
repeat while the mouseDown
if the mouseV < 15 then
sprite(4).locV = 15
else if the mouseV > 233 then
sprite(4).locV = 233
else
sprite(4).locV = the mouseV
externalEvent("custombar("& string(sprite(4).locV) & ")")
updateStage
end if
end repeat
end
Javascript:
function custombar(x)
{
var info = document.getElementById("container");
info.scrollTop = ((x - 15) / 233) * (info.scrollHeight - 290);
}
As with the test I've tried getNetText as well as adding "javascript::" to the beginning of the parameter.
I've been snooping around and it seems that in VBScript there's a special thing you have to do when you open the script tag to catch the values coming from the director movie. Is there some similar thing that needs to be done for Javascript? Or have I just made some overly simple mistake that I'm going to kick myself for later?
I would really appreciste any sort of help with this.
Thanks a lot,
Douglas