Community
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Peter Lone" <
href="mailto:plone@livingworkplace.com">plone@livingworkplace.com>
wrote in message
href="news:D4CFAD98549CAD86BE4B3DCAD1B918D0@in.WebX.maYIadrTaRb">news:D4CFAD98549CAD86BE4B3DCAD1B......
All:
This is a response to several earlier posts
by "vanceg" and others. As far as I know, there is no good way to
utilize the WaitForPageLoaded() method of
AdView.Viewer when using it inline, as the
script throws an error. So here'a a little JavaScript
code that lets you set properties for the
face="Courier New">AdView object.
The trick is to load an *empty* instance of the
object, and then load the DWF during page load. This lets us bypass
having to wait an inital DWF load and gives us access to many of the
properties as soon as the empty
face="Courier New">AdView instance is loaded. So a
sample bit of code would look like this:
size=2><html>
<head></head>
<body>
<script
language="javascript" type="text/javascript">
function initDwf()
{
var strFileName
=
"http://SERVER_O
face="Courier New" size=2>R_IP/SomeDir/MyFile.dwf";
var
strNamedView = "ALL";
// this is how we call the
DWF to load
var strUrl = strFileName +
"\?NotifyMissingFonts=false" +
"\&NamedView=" +
strNamedView;
// load the
file
AdView.SourcePath = strUrl;
// set your custom
parameters
AdView.width = screen.availWidth -
10;
AdView.height = screen.availHeight - 10;
// adjust some other
properties
size=2> AdView.Viewer.ToolbarVisible =
false;
AdView.Viewer.PaperVisible =
false;
AdView.Viewer.LinksEnabled =
false;
AdView.Viewer.BackColor = 0;
// Call some other setup
functions, if desired
setTimeout("setupLayersToTurnOn();", 1000);
size=2>
return
true;
}
function setupLayersToTurnOn()
{
var
objLayer;
var strLayersToShow
= "LAYER1,LAYER2,LAYER3"; // turn on whatever layers
// make sure the DWF is loaded
before attempting to access Layers collection
AdView.Viewer.WaitForPageLoaded();
//Put
layers to turn on into an array
var
arrLayersToShow = strLayersToShow.split(",");
// Turn all layers
OFF
var colLayers = AdView.Viewer.Layers;
for(var i=1;i<=colLayers.count;i++) {
colLayers(i).visible = false;
// Turn ON only layers those layers you wish to
see
for(var
j=0;j<arrLayersToShow.length;j++) {
if(colLayers(i).name==arrLayersToShow) {
colLayers(i).visible = true;
break;
}
}
face="Courier New" size=2> }
</script>
<object id="AdView"
classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" border="0"
codebase="
href="http://www.autodesk.com/global/expressviewer/installer/ExpressViewerSetup.cab">
face="Cou...
face="Courier New" size=2>"
>
<param
name="Src">
</object>
<!--
Call the
setup function(s) inline like so:
-->
<script
language="javascript"
type="text/javascript">
initDwf();
</script>
</body>
</html>
Notice
that the object definition does NOT have a value for the Src parameter.
We set this when we call the initDwf()
function.
size=2>
Now this
method won't work for everything. For example, if we want to turn on or
off layers programatically at load time, then we'll still have to deal with
the evils of the WaitForPageLoaded()
method. But, if you use the setTimeout()
method, as shown, the method won't throw an error. If it throws, then
just set the wait period up from
face="Courier New">1000.
Now, there may be a better way of doing this, and
this assembly of workarounds is certainly not my idea of
perfection. I do know that this works more often than not. But,
considering the issues of some of the people in this NG, hopefully this
will help out until then next version of AEV fixes these issues
;).
Let me know if this helps anyone
out.
face=Arial>
😛
size=2>---------------------------------------------------------
Peter B.
Lone
Living Workplace Corporation
(240) 683-6060
FAX: (240)
683-6070