open picture using getURL (two parter)

I have a web site where i wish to have a 'click to enlarge' button.
I can easily do this with:
on (release) {
      getURL ("pictures/building.jpg" ,"_new")
}

my problem is, I wish the browser to open at the size of the picture, not full screen.

see link below for an exact example of what i want to do:

http://www.illuminations.com/jump.jsp?itemID=12938&itemType=PRODUCT&iMainCat=11&iSubCat=20725&iProductID=12938

I know this is not flash, but is it possible?
If not, how to I recreate this including the 'close window' button?
are there any tutorials? Need to learn quickly.
I do have access to dreamweaver but have rarely used it.
Thanks
sledgeAsked:
Who is Participating?
 
CetusMODCommented:
PAQed with points refunded (300)

CetusMOD
Community Support Moderator
0
 
RoonaanCommented:
Do you know the size of the pictures? then you can use:

getUrl('javascript:window.open('pictures/building.jpg','mywindow','height=123,width=456');');

-r-
0
 
sledgeAuthor Commented:
thanks Roonaan.

flash originally reported the following errors:

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 2: ')' or ',' expected
           getUrl('javascript:window.open('pictures/building.jpg','mywindow','height=123,width=456');');

**Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 3: Unexpected '}' encountered
     }

Total ActionScript Errors: 2        Reported Errors: 2


due to single and double quote problems had to change the script in flash to this :

on (release) {
      getURL('javascript:window.open("pictures/building.jpg","_blank","height=360,width=480");');
}

when i run it, nothing happens.

Where have I messed up the code?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
RoonaanCommented:
Might be that the javascript call only works when run from browser. Can you test that for me?

Also, you might need to change the "_blank" into "myWindow", as window.open is already opening a new window, and "_blank" is a value you would use for target, not as windowname.

-r-
0
 
sledgeAuthor Commented:
changed "_blank" to "myWindow", published out and ran through I.E. still the same result. I did notice at the bottom left of I.E where it says 'done', there is a yellow triange with an exclamation mark in it.
0
 
sam85281Commented:
Put this in the <head></head> area of your html document.  Change the commented values in the top lines if neccessary:

<script language='javascript' type='text/javascript'>
smallestWidth  = 200; // Approx width of smallest image you'll use
smallestHeight = 200; // Approx height of smallest image you'll use
xOffset = 100; // Distance window pops from left
yOffset = 100; // Distance window pops from top
var closeOffFocus = true; // True-Window will close when focus is lost(i.e. they click the main window again.  Change to false if you don't want this.

if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+smallestWidth+',height='+smallestHeight+',left='+xOffset+',top='+yOffset;
var optIE='scrollbars=no,width=150,height=100,left='+xOffset+',top='+yOffset;
function popIt(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function sizeIt(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');      
writeln('window.innerWidth=document.images["someImage"].width;');writeln('window.innerHeight=document.images["someImage"

].height;}}');
writeln('function writeTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!closeOffFocus) writeln('</head><body bgcolor=000000 scroll="no" onload="sizeIt();writeTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="sizeIt();writeTitle();self.focus()" onblur="self.close()">');
writeln('<img name="someImage" src='+imageURL+' style="display:block"></body></html>');
close();            
}}
</script>

Now your actionscript code would be:

on (release) {
getURL("javascript:popIt('yourImageName.jpg','Title to appear in title bar of window here.');");
}

-Sam
"I wanna study Theology - I've always been a big fan of the word 'the' and don't feel it's been properly defined yet." - Sam 1970-Still Kicking


0
 
sledgeAuthor Commented:
thanks sam85281.
I have no knowledge of javascript at all. what parts of your code do i change for my picture name and where it is in a sub directory?
0
 
nifmcmCommented:
try using "_self" for target.
0
 
nifmcmCommented:
... hmmm, on closer insepction... you need target in the actionscript call... and to possibly name your js window something else...

on (release) {
     getURL('javascript:window.open("pictures/building.jpg","pictures","height=360,width=480");','_self');
}
0
 
sledgeAuthor Commented:
managed it with this code found on the macromedia web site.

<HTML>
<HEAD>
<TITLE>getURL_javascript</TITLE>

<SCRIPT LANGUAGE=JavaScript>
function openNewWindow(URLtoOpen, windowName, windowFeatures) {
  newWindow=window.open(URLtoOpen, windowName, windowFeatures);
}
</SCRIPT>

</HEAD>
<BODY bgcolor="#FFFFFF">
<!-- URL's used in the movie-->
<A HREF=javascript:openNewWindow('/pictures/building.jpg','thewin','height=360,width=480,toolbar=no,scrollbars=yes') ></A> <!-- text used in the movie-->
<!--This button opens a new window method: getURL:"javascript" --><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
 WIDTH=400 HEIGHT=250>
 <PARAM NAME=movie VALUE="test.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="test.swf" quality=high bgcolor=#FFFFFF  WIDTH=400 HEIGHT=250 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>
</OBJECT>
</BODY>
</HTML>

actionscript:

on (release) {
      getURL("javascript:openNewWindow('pictures/building.jpg','thewin','height=360,width=480,toolbar=no,scrollbars=yes') ");
}
0
 
sledgeAuthor Commented:
Discovered this one:

<HTML>
<HEAD>
<TITLE>FSCommand</TITLE>
</HEAD>
<BODY bgcolor="#FFFFFF">
<SCRIPT LANGUAGE=JavaScript>
<!--
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function FSCommand_DoFSCommand(command, args) {
  var FSCommandObj = InternetExplorer ? FSCommand : document.FSCommand;
  //
{if(command=="openbuilding"){ openNewWindow()}}function openNewWindow(){setTimeout(window.open('pictures/building.jpg','newwindow',
'height=530,width=690,toolbar=no')),0}
  //
}
// Hook for Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
        navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
      document.write('<SCRIPT LANGUAGE=VBScript\> \n');
      document.write('on error resume next \n');
      document.write('Sub FSCommand_FSCommand(ByVal command, ByVal args)\n');
      document.write('  call FSCommand_DoFSCommand(command, args)\n');
      document.write('end sub\n');
      document.write('</SCRIPT\> \n');
}
//-->
</SCRIPT>

actionscript:

on (release) {
      fscommand("openbuilding");
}


Many thanks to all for your help.


0
 
Dushan De SilvaTechnology ArchitectCommented:
Sometimes following solution might help for you.

http://www.experts-exchange.com/Web/WebDevSoftware/Flash/Q_21816898.html#16474170

BR Dushan
0
 
sam85281Commented:
The javascript I gave you will work for any image, you don't need to designate the image in the javascript, only in the ActionScript:

Using your original example, the code would be:

on (release) {
getURL("javascript:popIt('pictures/building.jpg','This Is A Really Nice Building');");
}

-Sam
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.