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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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-
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?
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-
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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.
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


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?
nifmcmCommented:
try using "_self" for target.
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');
}
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') ");
}
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.


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
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
CetusMODCommented:
PAQed with points refunded (300)

CetusMOD
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.