Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop ups.....

Status
Not open for further replies.

natedeia

Technical User
Joined
May 8, 2001
Messages
365
Location
US
Well i am sure my answer is written in this forum somewhere but have not found exactly what i need.
I am looking for the best way or a couple ways to have something pop up, such as text and pics at the same time that will stay as you click on a button. So each button, while staying on the same page will display the information for each button and stay after pressed. Can someone please tell me how to do it best. I tried, what i thought would work is on the "down" in the button edit sec., i pasted the pics and text but does not work that way. Please help!!
 
Hi Natedeia,

You need to use the TellTarget command in the actionscript to control other items such as text and images from a button. For instance, if you wanted an image to pop up and stay there after pressing a button you would first make a new movieclip. Make two frames, leave the first one blank and put the image you want to popup in the second frame. On the first frame put a 'Stop' action. Go to your main stage and place a copy of the movieclip on the screen. Rightclick on it and select properties, and then type a name in the 'instance' box (something that makes sense like Image1 or whatever you can remember). If your using Flash 5 use the Instance popup panel to do the same thing. Now your movieclip is set up to be targeted.

Open the actions panel of your button and enter the script:

On (Release)
Begin Tell Target ("../Image1")
Go to and Stop(2)
End Tell Target
End On

Where 'Image1' is the instance name you typed in. What this does is switch the movieclip from frame 1 (invisible) to frame 2(visible). The Image will stay there until you tell it to disappear via another TellTarget command (at which point you simply tell it "Go to and Stop(1)".)

You can use this principle to control text, images, animations or whatever you please, and you can add as many TellTarget commands to a buttons actions as you like, as well as triggering events when the button is rolled over, or rolled out of.

Hope this helps ;-)


Nick Price
nick.price@misuk.net
 
Thanks for the time to write all of that, I will certianly put it to use as soon as i get home. I will let you know how it goes.....
 
hi guys

Nick: spot on.

But I thought I'd better point out for the benefit of F5 users that targetting in F5 (as opposed to F4) involves a much reduced script:

You can either use (which Macromedia are encouraging usres to emply rather than 'tell target':

Code:
with (_root.Image1) {
    gotoAndStop (2);
}

Or streamline it even more:

Code:
_root.Image1.gotoAndStop(2);

The 'Tell Target' action is being pushed out in favour of the 'with' statement by Macromedia.

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Thanks dave, i hope to be up to scratch on flash 5 scripting just as soon as it arrives - Macromedia has kept me waiting for a month now when they said it would be here within a week (something about the free version of freehand that comes bundled with it not being ready for release or some equally poor excuse)! LOL Nick Price
nick.price@misuk.net
 
HowardMarks: or whoever can answer this question.

Where do i put the Target to or the other commands above to get the effect i am looking for. i have a button and i would imagine it would go on the DOWN or HIT part of the button editor timeline. i understand the code but do not know where to put it exactly. i put it in the instance box.......
 
Right-click your button on stage. Select actions. Set the above script in the actions box... & not while in edit mode of that button!

;-)
 
OLDNEWBIE:

i tried what you said and it still did not work for me. untill i get my Flash 5 book next week i will not know exactly what i am leaving out. i have the button, i right clicked on the button, added the above commands (tried two of them) and nothing. besides, the movie i am attaching this button to for the disjointed roll over is going to be located the the right of the button, not even touching it. can you or someone go into just a tad bit of detail that can be easily over looked. sorry about having to take so many entries!!!
 
Can you make your .fla available in the next few minutes?
I'm waisted tonight! And won't last much longer!

;-)
 
I assume you followed Nick's advice, and that you have dragged and named the instance of your mc Image1, and that you're repeating that exact same name in the actionscript!

;-)
 
I think Old is probably right; i noticed you said you put the script in the instance box- the only thing that goes in there is name you want to give that movieclip instance. (what i called Image1 in my example). You must make sure that the name in your actionscript matches exactly to the instance name of the movieclip you're targetting, otherwise it aint gonna work. Nick Price
nick.price@misuk.net
 
answer me this, i have made many buttons w/flash and have prepared it as that by putting my blank keyframes in the four spots (up, over, down, hit) preparing it because i do have a over reaction to it. i would like to ask, "do i need to add the keyframes in the down and hit, also when i get the above to work, it will not put my MC exactly where i am wanting it, right? i will make it avail later today when i get home because i absolutely want to get this project out the door. i have been using Fireworks to make most of my site projects and decided to use Flash instead to decrease the size of my site! Thanks to all the great advise out there!
 
OK Natedeia i think theres a bit of confusion here.

The picture that you want to appear is not contained within a button, but within a movieclip of its own, and is simply 'controlled' by a button.

The movieclip should have 2 frames. The first frame should be blank, but with a 'Stop' action. (Rightclick on the frame, select actions from the list, then put 'Stop' into the box.)

The second frame should contain your image, in the position you want it to appear.

Drag a copy of this movieclip onto your stage; as i said before type a name like 'Image1' in the instance box and remember what you called it.

Drag a copy of the button onto the stage.
Right-click on the button and select Actions from the list. Enter the action from a few posts back above, making sure where it says 'Image1' that you type in the exact name that you entered into the instance box for your image movieclip.

Now test your movie. When you click your button, the image should appear.

If this still doesnt answer your question you're gonna have to post the fla for us to look at cause i can't really see where you could have gone wrong.

:-) Nick Price
nick.price@misuk.net
 
well i just tried opening my fla. file. nothing goes right. it opens, then i try to test it and it acts weird. i am going to go out and price a Flash 5 book RIGHT NOW! try it and see if you can test movie?
 
hi again nat

I forgot to mention. I noticed from your FLA that you were editing your actions in Expert mode. In my opinion I would strongly suggest you start using Normal mode and utilising the actioning options in the left hand panel until you have a 'very' firm grasp of actionscripting.

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Hi HowardMarks,

Hey, the code you gave me above works great. Flash 4 players will not support it. Any advice? I am still needing the same effect. Actually, that code you posted, you just have Flash 4, right? Hmmmmm....well when i put it in 5.0....i dont know......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top