View Full Version : using browser scrollbars when required
Billy T
02-02-2006, 05:44 AM
hmm not sure if this is possible.
I have a flash site whose height will vary depending in which section the user is in.
Is there any combination of Stage.scaleMode, the html embed code, and possibly using javascript to target the flash movies id that will allow me to utilise the browsers scrollbar when required? (without reloading the whole page of course)
I hope this makes sense
Thanks in advance
http://javascript.internet.com/miscellaneous/hidden-scrollbars.html
it's working whit IE
no idea what's whit the others
Billy T
02-02-2006, 09:16 PM
yeah it doesn't work in safari and doesn't do what I need to do. I need the scrollbars to appear and disappear themselves as required as I adjust the height of the embeded flash movie (as the user goes from section to section). I guess thats my question
Can the height of the of the embeded swf be changed after the page has loaded? Setting to 100% won't work as the scrollbars wont appear
Thanks for the suggestion Xeef
Hmmm
i coud by totlay wrong here ! (not good at html)
i think the only way will by to put it in a "div" or "frame" and reload this
whit out reload i don't think it's makabel :(
http://www.devpapers.com/article/256
To dynamically write a flash movie to a layer we can use this function:
function loadFlash(id,theurl,width,height) {
document.getElementById(id).innerHTML ='<embed src="'+ theurl + '" width="'+ width + '" height="'+ height + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" scale="exactfit" /><\/embed>';
}
The loadFlash function has four parameters that will need to be defined later on a mouse event. These parameters are:
id = The id value of the layer in which the flash movie is contained.
theurl = the src value of where the movie resides.
width = the width of the movie.
height = the height of the movie.
So let us assume that our original movies width and height are 500 * 300 respectively and we want to resize the height value down so that another element is completely visible. We would call the loadFlash function like so;
...
..
mayby it's enought to change the size of the "div" ?
or some combination of this
Billy T
02-03-2006, 05:55 AM
OMG
mate that is awesome
mucked around with it a little and its working perfectly
http://onlinegalleries.com.au/test_dynamic_height/embed.htm
would be curious to see if it works on all browsers
Thanks again!
Billy T
02-07-2006, 01:18 AM
ok I'm close with this but don't quite have it perfect
I am calling a javascript over and over from flash that smoothly resizes the div
fscommand ("whatever", currentHeight);
<script type="text/javascript">
function olg_DoFSCommand(command, args) {
var nodeObj = document.getElementById('flashLYR');
nodeObj.style.height =args+'px';
}
</script>
http://www.onlinegalleries.com.au/new/site.php
works fine on a mac but not on IE on a PC. If I use getURL instead of fscommand it works fine on mac and pc but I get the javascript click over and over on a PC
anyone have a solution?
Thanks again
I am calling a javascript over and over from flash that smoothly resizes the div
why do you call it over and over ?
call it ones ! and let the rest Javescript do !
"settimeout" or what was the comand in JS ? (setInterval)
Hmmmm
resize seams to work fine but how big it is i have no scrollbar :(
check you FLA i have 80-100% CPU whitout something happening !
I get the same result as Xeef. But your first link seemed to work fine on IE6 for PC.
Billy T
02-07-2006, 04:41 AM
thanks again guys
I think I have it sorted using the fscommand method - http://onlinegalleries.com.au/new/site.php
yeah I tried using setInterval in javascript but couldnt get it going so I went back to doing it in flash. If the processor problem (which I also noticed) is due to calling the javascript onEnterFrame then I will try it again (I dont think it is though - noticed that problem a while back)
can you please check the link again and see if its working ok?
Thanks again
That works great....Pretty clever. IE6, WinXP.
Billy T
02-07-2006, 05:26 AM
cool
are you still getting the processor problems?
Thanks
Yeah, CPU usage still sky rockets to 100%...
Billy T
02-07-2006, 06:07 AM
dang
I shall persist
hey is there anyway to return the current value of a style property of a div? for example I have
function slideHeight(height){
var theHeight=document.getElementById('flashLYR').styl e.height;
alert(theHeight);
}
and I get nothing in the alert box :(
Ta
Billy T
02-07-2006, 06:16 AM
that's the forum putting the typo in 'style'
'think' I might have fixed the performance - had an onmousemove that I didnt need that was refreshing the screen - please check again when you get a sec
Thanks
Performace still shoots up to 100% and hovers between 90%-100%.
you can read it BUT you have to set it ! to read it out !
<body>
<script>
setTimeout("T(500)",10)
function T(Y){
//there must by a way to get the value (123) instead of "123px"
O=String(document.getElementById('flashLYR').style .height)
O=O.substr(0,O.length-2);
if (O<Y){
O++
document.getElementById('flashLYR').style.height=O +"px"
setTimeout("T("+Y+")",10)
}
}
</script>
if i don't set the height here i als get no alert !
<div id="flashLYR" style="height:50px">
Content for New Div Tag Goes Here</div>
<input type="button" name="Button" value="Button" onClick="T()">
</body>
performance is still not good ! but seams better around 60% (was 80-100%)
Billy T
02-07-2006, 11:05 PM
very nice - thanks!
and with easing
<script>
setTimeout("T(500)",100)
function T(Y){
//there must by a way to get the value (123) instead of "123px"
O=String(document.getElementById('flashLYR').style .height)
O=O.substr(0,O.length-2);
M=Number((O-Y)/5);
if (M>2 || M<-2){
O=Number(O-M);
//alert(O);
document.getElementById('flashLYR').style.height=O +"px"
setTimeout("T("+Y+")",100)
}
}
</script>
I don't think the multiple js calls are whats the causing the performance issue but I will implement this anyway
Thanks again
primate
12-22-2006, 01:59 AM
http://onlinegalleries.com.au/
WOW! Super cool site!!
I've been trying to find a tutorial/instructions on how to do exactly what you've done there. However, I'm not quite understanding all the steps that you went through in the forum. Any closing, summary, step-by-step, advice for us lower primates? Please kind sir?
Thanks,
primate david
Billy T
12-22-2006, 02:51 AM
well its been a long time so I can't really remember how I did it ;)
is there anything specific you don't understand?
primate
12-22-2006, 03:06 AM
This is totally sad... most of it. I'm in over my head. I thought of this effect before I saw it, well at least before I saw it executed with Flash. The only sites I've come across that do this with Flash would be yours and http://www.bigspaceship.com. Have you come across any explanations that might work, keeping in mind that I can follow instructions and figure out what's in front of me, but I'm not so good at filling in the blanks yet :(
david
almost forgot http://www.jamesor.com/ and I'm sure there are others
vBulletin® v3.7.1, Copyright ©2000-2009, Jelsoft Enterprises Ltd.