PDA

View Full Version : opening links in presized windows??



toadclipper
September 10th, 2002, 09:51 PM
I have all my links and swf files set up like this for the links:

on (release) {
getURL("flash/MCTransitionsButtonsMove.swf", _blank);

}

what I want is to have the swf files open in smaller sized windows with a button to close the window.

Could someone tell me how to do this?

thank you

lostinbeta
September 10th, 2002, 10:16 PM
You mean like a pop-up window with a close window link inside that window?

If so, I have included the popular pop up window text file I wrote for someone else on this forum that needed to know how to do it. That will teach you how to create a pop-up window.

as for closing a window it goes like this...


<A HREF="javascript:close();">Close Window</A>


PS: I am moving this to the HTML/Javascript forum.......

toadclipper
September 10th, 2002, 10:23 PM
A HREF="java script:close();">Close Window</A

on the button action itself. I am only opening swf file' that are not contained in html. Do I create a button as with the others and as for the action of that button put that line of code. Also, is this PHP?

This is javascript. What Im looking for is a way to close a window from within an swf movie.

lostinbeta
September 10th, 2002, 10:25 PM
Oh ok, I thought it would be HTML... in that case...



getURL("javascript:close()","_self")


Or something along those lines.

This isn't PHP, but as you can see, the only way to keep HTML from converting is to use the PHP tags to show it.

toadclipper
September 10th, 2002, 10:30 PM
I'll try it now:)

lostinbeta
September 10th, 2002, 10:36 PM
Let me know if it works. And if there are any problems I am sure I will be able to help you out.

toadclipper
September 10th, 2002, 10:37 PM
that did not work;
I tried it like this:

getURL("java script:close()","_self")

and got this error:

"Scene=Scene 1, Layer=Layer 1, Frame=1: Line 1: Statement must appear within on handler
getURL("java script:close()","_self")"

Then like this and it says it can't find the url:
on (press) {
getURL("java script:close()","_self")
}

What am I doing wrong?

lostinbeta
September 10th, 2002, 10:44 PM
Are you testing this in Flash or on the Published HTML page? If you test from inside Flash, it will not work. If you test it on the HTML page that you publish, it will work.

Your last method was correct. The on(press) one.

<B>EDIT:</B> Why are you loading the .swf files into the pop-up windows? You should load an .html file that contains the .swf. Is it because of the white margin around the movie? If so, I will tell you how to get rid of that.

toadclipper
September 10th, 2002, 10:57 PM
It is because of that margin that i did not want to open in html. Please tell me how?

thank you

lostinbeta
September 10th, 2002, 11:01 PM
Ok, getting rid of the margins in HTML are very easy. You will need to open up your .html file (an basic text edit works, even WordPad). Find the tag that says


<body>

and change it to say


<body topmargin="0" leftmargin="0">

If you want to go all out and wipe out everything about margins it goes like this...


<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0">

I hope this helps you out:)

toadclipper
September 10th, 2002, 11:34 PM
I will try this now

lostinbeta
September 10th, 2002, 11:41 PM
Let me know how that goes.

toadclipper
September 11th, 2002, 12:09 AM
I have now published (only the first link to test it) and when I click the close button I get an error page stating "The page cannot be found" instead of the main web

Would you mind checking it out to see what I mean?
page.http://www22.brinkster.com/laranelson/

lostinbeta
September 11th, 2002, 12:17 AM
Which link on your site do I click on to test it?

toadclipper
September 11th, 2002, 12:21 AM
load multiple SWF's then that will load the html file that contains the swf file. I published it and put it up in html as you suggested.

lostinbeta
September 11th, 2002, 12:31 AM
Ehew, I see what is wrong here. When you copied and pasted my code, for some reason the board put a space between java and script

it is one word...

javascript:close()

...like that

toadclipper
September 11th, 2002, 12:33 AM
"it's the little things that make us appreciate life" That is funny, I can't believe I did not even think of that. I will fix it now. Thank you

lostinbeta
September 11th, 2002, 12:35 AM
Let me know how it goes after you fix it:)

I remember learning Javascript. Even a missing ";" (or an extra one) can make or break your code. It drove me nuts, but I got the hang of it. I love Javascript now:)

toadclipper
September 11th, 2002, 12:55 AM
do I use _blank, _top? in the code to close the window? I have tried this on the movie with the frame action to load all the movie on level one w/ all the buttons, I tried putting a button on the level 0 movies, I tried with it as an html and as an swf. I am totally doing something wrong. Right now it is in an html and the button to close is on level one(the one that loads the movie w/ all the buttons)

http://www22.brinkster.com/laranelson/

any Ideas??

lostinbeta
September 11th, 2002, 12:59 AM
I would think either _self or _top. If it doesn't create an error, then don't put anything there at all and try that.

toadclipper
September 11th, 2002, 01:08 AM
maybe i will just put a js link to close in the html for now:)

lostinbeta
September 11th, 2002, 01:10 AM
Hold on, I am going to figure this out RIGHT NOW. I am opening up Flash as we speak.

lostinbeta
September 11th, 2002, 01:16 AM
I included a .zip file. It works like a charm.

Code use =


on (release) {
getURL("javascript:close();", "_self");
}

toadclipper
September 11th, 2002, 01:16 AM
THis is what I have now.

toadclipper
September 11th, 2002, 01:18 AM
thank you

lostinbeta
September 11th, 2002, 01:21 AM
The file attached works great now!

toadclipper
September 11th, 2002, 01:29 AM
it is closing out the main page, my page. What i was hoping for is that the files could be viewed and can just close the window when done then choose another file to view, but this closes the whole browser session. Thank you tho, we are gettin' closer:)

lostinbeta
September 11th, 2002, 01:30 AM
I thought you were going to pop open your experiments in a pop-up window. That is why I sent my popups.txt file in the beginning of this thread.

It would be easier that way.....load it up....close it out.

lostinbeta
September 11th, 2002, 01:33 AM
If you aren't popping up windows, try using this on the button instead....

on (release) {
getURL("java script:history(-1);", "_self");
}


This acts like the Browsers "Back" button and will take the viewer back 1 page.

toadclipper
September 11th, 2002, 01:44 AM
"The page cannot be found" I tried _self and _blank.

lostinbeta
September 11th, 2002, 01:48 AM
You have to go to that page from another link first. If you just go to it, then it won't work because it is taking you to a page that never existed.

So if you were to click on the link from your site and open up the .html page. Then click on that link. It will bring you back to your main page.

Try it:) It should work.

toadclipper
September 11th, 2002, 02:21 AM
it's late here and I am toast. I think i may be making dumb mistakes cause im tired. I so appreciate your time, thank you. Tomorrow I'm sure I'll get it working. I learned a lot tonight, thats the important part:)

lostinbeta
September 11th, 2002, 02:24 AM
Glad I could help. Good luck tomorrow. You can always post questions here and I will get to them when I can:)

toadclipper
September 11th, 2002, 02:32 AM
thanks again. I am soooo ready for sleep lol.

flex
September 11th, 2002, 07:57 AM
If you want html windows that open with javascript, then lostinbeta's bethod is fine. If you want "flash" windows that pop up, that can be resized, dragged, minimised, scrolled, etc. and can load external content which can be formatted with HTML, then let me know and I'll post the component here.

Admittedly some componets are not required because of the actionscript alternatives, but I think this one saves a lot of time...

lostinbeta
September 11th, 2002, 11:44 AM
Hey flex, I would be interested in checking out that component. I was working on maye doing something like that for my flash site, but if there is a component to save me time I might use it.

I am not sure if I will follow through with using it, but I definitely want to check it out:)

flex
September 11th, 2002, 12:35 PM
Hello there,

I've posted it in a new thread in the MX forum.