views:

146

answers:

1

I saw a App named PictureBrowser in the /Leopard/Developer/Examples/WebKit. I found that this App can show the images only in a webview. Now I want to show some swf flash swf files in this webview , How to do ? I thought this is a problem with javascript , Now I can show the two html file in this ,somebody can help to resolve this problem?

image_template.html:

function showImages() {

var imagePath = imagePaths[nextImage];
var imageLabel = imageLabels[nextImage];
var imageSpan = document.getElementById('' + nextImage);
var imageElement;

if (nextImage < imagePaths.length){
 var flag=imagePath.lastIndexOf(".");
 var extension="";
 if(flag!=-1){
  extension=imagePath.substr(flag+1).toLowerCase();
  switch(extension){
   case "swf":
    imageElement = document.createElement("embed");
    break;
   default:
    imageElement = document.createElement("img");
  }

 }
    imageElement.style.visibility = "hidden";
    imageElement.style.position = "absolute";
    imageElement.style.left = "-9999px";
    imageElement.style.top = "-9999px";
    imageElement.style.border = "solid black 1px";
    imageElement.setAttribute("id", imagePath);
    imageElement.setAttribute("src", 'file://' + imagePath);
    imageElement.addEventListener("load", imageLoaded)
    imageElement.label = imageLabel;
    imageSpan.appendChild(imageElement);
}
     nextImage++;
 if (nextImage < imagePaths.length)
 setTimeout('showImages()', 1);

}

A: 

I take it putting the path to the SWF file into imagePaths didn't work? And if not, what happened instead?

Peter Hosey