Helpful Information
 
 
Category: Flash
Flash button with popup question

Hi,

I have the following code for my flash button:

on (release) {
getURL ("javascript:NewWindow=window.open('http://www.test.nl','newWin','width=400,height=300,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
}
This creates a popup window from the flash button. Now it loads a picture in this popup, but is it possible to make this an invisible popup? So that you see no borders, only the picture, so invisible borders.

Perhaps a transparent draggable block that loads the picture in it...

Null

You are speaking of chromless windows and no, because of security issues no browser supports them.

Your other option is to load the pop up inside your main movie and sort of "fake" it.

And how would I do that?

Or is it possible to not make a javascript popup but a dhtml popup? All from the button ofcourse

No, what you would do is make your pop up a movie clip instead of a separate file. Then add code to the MC to close on click, or make another button on the pop up.

On your button you would put the code to open the MC.

To have a picture load in the pop up you would just make the MC an empty MC with an array to scroll through the pictures, or to load a random one each time the button is clicked.

I am at work and this is a rather complicated coding process... I will try to look through my online file to find it as I have done this a few times. I will try to post back soon with some useful snippets for you.

Okay, I can't access the pop up codes I was reffering to above.

However, as with almost anything in Flash, there is yet another way. Allbeit this wont be as pretty as the original idea, you can tweak and poke and adjust each frame I describe here to your exact liking, instead of forming each thing to a 300400 square.

Okay, lets describe this process:

1. Open your movie and create a new Movie Clip, registration point center, give it a name.

2. edit the MC adding a blank keyframe for each picture you would like to display. For the length of this post we will stick with one picture to show in the popup.

So we have a MC with 2 blank keyframes. Next you need to add another layer to the MC, call it "scripts" or the like, and in Frame 1 of the Scripts layer put this code:



stop();


Go back to layer 1, Frame 2, and now bring in your picture you want to show in the "pop up" Adjust it how you like, size, shape, colors, etc **

when that is done, go back to your main timeline and the next step:

4. Drag your MC from the library to the stage where ever you would like the "pop up" to show up. Keep in mind you have NOTHING in the first frame of this MC, so you wont be able to see it. Use the registration point when dragging to help guide you where to place it.

5. Once it is placed on the stage add this code to the BUTTON you want to use to open the "pop up"



on(release){
nameOfMovieClip.gotoAndStop(2);
}


Basically that is it. Now you have a button that will take your MC to the frame where you loaded the picture and it will just "appear" giving the effect of a pop up. Now we just need to jazz it up a bit.

You can do a few things here, first we will need to remove the pop up. The EASIEST (and most boring) way is to make another button with the following code:



on(release){
nameOfMovieClip.gotoAndStop(1);
}


Obviously this will take the MC back to the black frame and thus give the effect of "closing" the pop up.

However, too many buttons might just be something you don't want. We can use AS to keep a "click count" and reset the count to 0 when we want the pop up to disappear.

You could also make a frame counter (if you have multiple pics to show in one pop up) and do a random array and show a random pic on each click, which you could make cycle through each picture and then "close" by going to frame 1 (the balnk one)

Many options. :D

** You also have the option of creating a second MC in which you can make tweens and effects or splashes, etc, then just drag that MC into Frame 2 of this MC. Doing so will make the pop up appear when the button is clicked, and it will then play the tweens or whathaveyou of the secondary MC :)










privacy (GDPR)