PDA

View Full Version : Spawning of new window


-[LoR]-
10-28-2002, 09:42 PM
id like to know if this is the right code for the button ive produced! ive gone through the tutorial on spawning a new window with the target http! but it doesnt work.......could someone help me out please, what ive done is below

on (release) {
getURL ("javascript:spawnWindow('c:\WINDOWS\Desktop\Stuff\d fasdf.html','','toolbar=no,location=no,status=no,m enubar=no,scrollbars=no,resizable=no,width=600,hei ght=400');
}

also where does the javascript go in the .html for the button or the main site?

could you please email me at wolfman_2100@hotmail.com as im likely to forget to check!

thanks

-[Lor]- (yes im a n00bie before any comment fly around)

CyanBlue
10-29-2002, 12:20 AM
Howdy... :)

There is no way to check if your JavaScript syntax is correct since you didn't provide the function you have used, spawnWindow... but read this thread out to see the right syntax...
http://www.actionscript.org/forums/showthread.php3?s=&threadid=17893

Oh... I am not emailing you because I think you don't want to know this since you know it already if you don't check it, right??? :) Kidding... Check out the forum from time to time... There are lots of places you can learn about Flash in this forum... Welcome to the club... :)

-[LoR]-
10-29-2002, 12:41 PM
thanks dude!

ohh and i tried what you said in that thread, and a error came up! on the tutorial it said to place this script somewhere

<script language="JavaScript">
<!--
function spawnWindow(URL,Name,features) {
window.open(URL,Name,features);
}
//-->
</script>


would that go in the HTML page that the button is OR the html page you want the button to load up?? ive put it in the HTML page i want the button to load up in! this is confusing lol! i went to another thread and tried this actionscript: -

getURL ("java script:window.open('c:\WINDOWS\Desktop\Stuff\dfasd f.html',width=600,height=500,toolbar=no,location=n o')");

that produced a error! soo i need a little help :D

-[LoR]-

ps- sorry for n00bie-ness

CyanBlue
10-29-2002, 03:49 PM
Howdy... :)

First of all... your spawnWindow() JavaScript show go into the HTML where your Flash movie that calls spawnWindow() function is embedded... For example, you have index.FLA which uses spawnWindow(), and the HTML file for that Flash movie is index.HTML, then that's where the JavaScript funcion should go...

Your window.open() function should go like this...
getURL ("java script:window.open('c:\WINDOWS\Desktop\Stuff\dfasd f.html','YourWindowTitleNameIsMissing_DoNotUseSpac eInHere','width=600,height=500,toolbar=no,location =no')");

Oh... if you see the error message, write it down so that people can see... Okay??? :)

-[LoR]-
10-29-2002, 05:41 PM
thanks alot! ill try it after i come back from going out! :)

Sfoxish
04-02-2004, 09:26 AM
Hi there, im kinda new to posting on this forum although Ive refered to alot of posts so far and found them to be very usefull.

Basicly im quite narked at the moment as to why the java script wont work, or to put it a better way Will work, fine, 100% fine, but only some of the time.

Ive used the above mentioned action/javascript and before you ask yes the javascript external to the swf, declareing everything, the buttons inside the swf linking to a different , url's / window's (which makes sense) But heres the thing, The moment you move from frame to frame, for example moveing from the black&white pictures page to the colour page (two different frames two different sets of buttons linking to two different sets of lets say for arguments sake sites/pictures) then back again, It does the most annoying thing possiable, It replaces url for the the window with the swf file in (the one which has the buttons, click them, they open in a new window, well least thats the idea) With the javascript! ! ...
Im guessing its something to do with where the java script it sending the url, but it doesnt make sense, click it the first time it sends it to a new window and works fine, go to a different frame (different page) then go back and click a different one, It gets sent to the Main window, even though the script hasnt changed.


Ive tried puting the javascript in the header for the html, ive tried puting it in the body, ive tried haveing the javascript pruely declared within the swf.

Ive tried
in the html
---------------
<script language="JavaScript">
function newWindow(theurl, windowname, features) {window.open(theurl, windowname, features);}
function newWindow2(theurl, windowname, features) {window.open(theurl, windowname, features);}
</script>

(different functions, with two different links/buttons pointing at them, I thought thta might get round this probably but no.)

That with this in the swf
-----------------------
on(release)
{
getURL ("javascript:newWindow('THEURLyadderyadder,'TheWindo wEtc','height=905,width=1001,resizable=yes,fullscr een=0,status=no,scrollbars=yes,toolbar=no,location =0,directories=0,menubar=no,left=80,top=100')");
}

----------------
And then if your intrested the javascript declared fully in the swf (no need for it in the html, in theory, which works, but not when you change frames, which seems just not logical)
------------------
on (release)
{
movieClip.prototype.centerRemote = function (theUrl, title, w, h, features)
{
var sysW = System.capablities.screenResolutionX;
var sysH = System.capablities.screenResolutionY;
var centterx = Math.round(sysW / 2 - w / 2);
var centery = 15;
getURL("javascript:void(window.open(\'" + theUrl + "\',\'" + title + "\',\'width=" + w + ", height=" + h + ", left=" + centerx + ", top=" + centery + ",screenX=" + centerx + ", screenY=" + centery + "," + features + "\'));","");
};
}

on (release)
{
centerRemote("THE URL etc etc ", "", 740, 555, "toolbar=no");
}


I'll be intrested to know if Im the only one on the planet with this bug, or if it is Flash being lame. As you can guess im a tad annoyed.
Anyone out there able to help?
-Sfox