[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

open picture using getURL (two parter)

Posted on 2006-04-17
15
Medium Priority
?
556 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:sledge
  • 5
  • 2
  • 2
  • +3
13 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 16475508
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
 

Author Comment

by:sledge
ID: 16475601
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
 
LVL 49

Expert Comment

by:Roonaan
ID: 16475610
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sledge
ID: 16475639
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
 
LVL 16

Expert Comment

by:sam85281
ID: 16475642
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
 

Author Comment

by:sledge
ID: 16475756
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
 
LVL 3

Expert Comment

by:nifmcm
ID: 16475782
try using "_self" for target.
0
 
LVL 3

Expert Comment

by:nifmcm
ID: 16475808
... 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
 

Author Comment

by:sledge
ID: 16475950
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
 

Author Comment

by:sledge
ID: 16476054
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
 
LVL 17

Expert Comment

by:Dushan De Silva
ID: 16476265
Sometimes following solution might help for you.

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

BR Dushan
0
 
LVL 16

Expert Comment

by:sam85281
ID: 16479537
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
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 16814215
PAQed with points refunded (300)

CetusMOD
Community Support Moderator
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses
Course of the Month18 days, 15 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question