Rollover buttons that play a movie clip.
Hello,
I am new to Flash and I am trying to accomplish a simulation such as this example, http://www.its-about-time.com/investinesart/coalplantvirtualtour.swf. I have all of my movie clips done, but how do I tell a rollover button to play a specific movie clip? I also want to have all the movie clips to play simultaneously via a rollover button as shown in the example. I've attached a captured image of my timeline, if that helps. I've tried everything so far, but nothing is working! What is the simplest way of doing this?
I have this inside one of the movie clips (mc_2) in a seperate layer under - (actions)
RO_btn.onRollover = function(){
mc_2.play();
On the main timeline I have an actions layer with this:
stop();
Thinking that this may stop all of my movie clips but it doesn't.
Should I make an actions layer in each movie clip with this syntax huh? stop();?
I'm frustrated!!
Thanks, if you can help!
MG
Hi,
I have made something that you are looking for.
It will be of help to you.
basically you will have to create a few movie clips namely:
2 buttons: (name them a_btn, b_btn, c_btn, d_btn, e_btn)
3 movie clips (I am taking example image1_mc, image2_mc, image3_mc)
in each of these movieclips.place 2 frames and on second frame put your movieclip(one in one).on both the frames put stop()
now click on a_btn and write this script
on (rollOver) {
_root.image1_mc.gotoAndPlay(2);
_root.image2_mc.gotoAndPlay(2);
_root.image3_mc.gotoAndPlay(2);
on (rollOut) {
_root.image1_mc.gotoAndPlay(1);
_root.image2_mc.gotoAndPlay(1);
_root.image3_mc.gotoAndPlay(1);
with this all 3 animations will work simultaneously. if you need to run any one of the movieclips at a time the you can address that mc in particular
.Say if you want only 1 mc to move at a time then put this on btn 2
on (rollOver) {
_root.image1_mc.gotoAndPlay(2);
on (rollOut) {
_root.image1_mc.gotoAndPlay(1);
.Dont forget to give proper instance names to movieclips.(they are in properties panel.)
Cheers!
Similar Messages
-
Play a Movie Clip on a frame In Main SWF from a button, within 2 MovieClips
I’m using AS2, Flash 8
I have a frame on my main Timeline Called “Gallery” within this frame I have 2 movie clips, which I need to work together:
One is called:
Gall_Lge_1
Which contains 37 frames.
Each frame has a different movie – basically 37 different photos which pop up on each frame.
(MC’s named Lge_1, Lge_2, Lge_3 etc)
The second Movie Clip I have on here is called:
gall_strip_mc
Which contains a movie clip called strip1 , (which is set to scroll its contents controlled by buttons on ”Gallery”- which works) inside that is a movie clip called strip_all , and contains one frame with 37 buttons/photo thumbnails, (Buttons named btn1, btn2, btn3 etc which I require to link each individual button to the corresponding photo/frame in Gall_Lge_1 …
So,
btn1 will go to and play Lge_1(Frame 1 of Gall_Lge_1)
btn2 will go to and play Lge_2(Frame 2 of Gall_Lge_1)
I’m stuck and can’t get it to work..
Here is the site – under ‘Gallery’ so you can see what I’m trying to achieve
http://www.blueshelldesign.com.au/draft/
(I’ve placed in Back and Next buttons next to ‘Gall_Lge_1’ so you can see how its suppose to look when the thumbnails from ‘gall_strip_mc’ are clicked)First, you do not use quotes when you are specifying a frame number, so try changing that first. The only time you use quotes for that argument is for frame label strings.
If it still won't play, are you sure that the button is coded properly and executes the function when clicked? You should put a trace in the function to make sure. Also, you could try using _root instead of _level0... I forget the difference, if any, but _root will definitely get you to the main timeline.
btn2.onRelease = function() {
trace("btn2 clicked");
_root.Gall_Lge_1.gotoAndPlay(2); -
Playing different Movie Clips onRollover?
I have several buttons that I would like to play different
movie clips
onrollover on the stage. So if button 1 is rolled over it
plays a clip
in the lower right corner and when rolled off it stops and if
button 2
is rolled over it does the same.
How is this done?
Thanks!This is the code I am currently using to play and stop a
movieclip:
myPlay_btn.addEventListener(MouseEvent.CLICK, playMc);
myStop_btn.addEventListener(MouseEvent.CLICK, stopMc);
function playMc(e:MouseEvent):void{
my_mc.play();
function stopMc(e:MouseEvent):void{
my_mc.stop();
1. How do I drag my movie clips onto the stage, but not have
them
display until the button is rolled over?
2. Would this code just be applied for each button and
modified from
CLICK to OnRollover?
Thanks!!!!
kglad wrote:
> assign a rollover listener to button 1 and in its
listener function apply the play() method to your right corner
movieclip. likewise for button 2. -
Buttons not working in movie clips
I have multiple movie clips on stage (all in separate layers, of course) as well as buttons on stage to play each movie clip. There are buttons inside each movie clip. The problem is that the buttons inside the top layered movie clip work, but the others in the movie clips below don't.
This is frustrating!! Can anyone help???It shouldn't matter which layer things are on. If they are separate movielcips, one should not impact another. What version of actionscript are you using? Do any of the movieclips have mouse interactive code assigned to them?
-
Playing a Movie Clip within a Movie Clip on load
Hi,
I'm trying to play a Movie Clip animation that is within a Movie Clip after a button has been pressed in a different Movie Clip.
The issue is that all Movie Clip animations are playing as soon as the SWF is loaded.
I have a separate Main.as file that contains all of the coding except for the animation stops:
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
var title1:Title1;
var scene1:Scene1;
var scene2:Scene2;
var scene3:Scene3;
var scene4:Scene4;
var scene5:Scene5;
var scene6:Scene6;
var scene7:Scene7;
var scene8:Scene8;
var scene9:Scene9;
var scene10:Scene10;
public function Main()
title1 = new Title1();
scene1 = new Scene1();
scene2 = new Scene2();
scene3 = new Scene3();
scene4 = new Scene4();
scene5 = new Scene5();
scene6 = new Scene6();
scene7 = new Scene7();
scene8 = new Scene8();
scene9 = new Scene9();
scene10 = new Scene10();
addChild(title1);
title1.buttonStart.addEventListener(MouseEvent.CLICK,onButtonStartClick);
scene1.buttonWalkOutside.addEventListener(MouseEvent.CLICK,onButtonWalkOutsideC lick);
//title
function onButtonStartClick(event:MouseEvent):void
addChild(scene1);
removeChild(title1);
Scene1(parent).gotoAndPlay("frame1")
//scene1
function onButtonWalkOutsideClick(event:MouseEvent):void
addChild(scene2);
removeChild(scene1);
So right now, I'm getting this error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@46534041 to Scene1.
at Main/onButtonStartClick()
Any help is greatly appreciated... I've been grinding at this all night.I had been trying a bunch of different methods after searching for clues on Google, so it probably doesn't make sense with the parent.
I replaced the code with what you wrote, and I am given this error now:
Main.as, Line 44
1120: Access of undefined property scene1Text1.
Is there somewhere I have to declare scene1Text1 in Main.as? -
IPhone (Cocoa Touch) Button that plays sound file on click?
Hello.
I am trying to create a button that, when clicked, it plays a given sound file in the app's filesystem.
This is what I have set up thus far:
Regular Rectangular button -> connected to NSObject Called "sounds" -> with the Event "playsound1" chosen as the event.
I then wrote the class files, brought them into Xcode file project under classes, and now I'm staring at sound.h and sounds.m with no idea what to do next.
I was able to create in a regular Mac OSX Cocoa, a button that plays the system beep using NSBeep. However, I don't know how to achieve this similar objective with using a given sound file in the iPhone Cocoa Touch.
ThanksI have tried so many things. I'm so lost.
-
Animated drop down buttons not working in movie clip
Hi,
I am working on this site: (AS2)
http://www.steamandclean.com/Index_w_1.html
I have two types of drop down menu. One under Commercial and one under Technical
The buttons are movie clips. The drop downs are also movie clips that start in frame 2 and are triggered on rollover.
The child buttons are buttons living on the drop down movie clips. They are set to getURL
As you see they are not willing to neither link to any url or will they run their move clip animation. One is a button and one is a movie clip.
The left movie clip has a mask, but it makes no difference if I remove the mask . It also has a emboss filter and no difference is I take that away either.
All of it is in one flash movie right now, but I will be splitting it up in a master navigation movie and individual swf's soon.
Right now I have the main movie, then the button MC then the dropdown MC and in the drop down MC I have placed either a animated (button) MC or a button. So it nested in nested in.......
In both cases I scripting the child buttons like this:
on (rollOver) {
gotoAndPlay(2);
on (rollOut) {
gotoAndPlay(6);
on (release) {
getURL("http://steamandclean.com");
I have also tried to use
_parent.getURL and _root.getURL in stead of just get URL, but it does not work.
The drop down buttons seem to be buried. In the left side the whole drop down panel seems to act like a link?
What am I doing wrong?
Can you help?
ggaardeHi Ned
Thank you for your reply again.
I figured it out.
Your reply prompted me to have my main button on rollover to go to a frame number on the main time line and then move the content of the drop down movie clip to that frame.
The drop down panel now work and the child buttons animation now work as well. I just had to find a way to make the drop down panel disappear on rollout. Since I could not script the actual drop down panel I created three skinny invisible buttons and placed them on the right, left and button of the drop down panel. I scripted them to go back to frame 1 on both rollover and rollout. Done.
See the result there:
http://www.steamandclean.com/Index_w_1.html
(Left side only)
Thank you for your help.
ggaarde -
TellTarget to play a movie clip within a movie clip
I currently have two movie clips in my scene with a button
that lies inside one of the movie clips. We will call this movie
clip for the sake of this post "ph." The button inside of ph has a
rollOver/rollOut movie clip called "Buick_rollOut" attached to it
as a parked movie clip through tellTarget. Currently Buick_rollOut
only works if I put the parked movie clip on the same level as ph.
I want Buick_rollOut to be within the movie clip, ph, that contains
the button. I want that button be able to tellTarget the location
of Buick_rollOut within ph. I hope this makes sense. Here is my
code for the button that lies within ph. (this code only works when
Buick_rollOut is located outside of ph on the same level).Is this code running on the button? What's the name of the
button?
Things would be a little clearer if you replaced tellTarget
with dot notation:
Buick_rollOut.gotoAndPlay("rollOver"); -
How to stop , play nested movie clips....
Hi all,
I'm calling a swf file in a container_mc, which is in
another swf file(Interface), by loadMovie() method. The Major
problem I've stucked with is that in the interface I'm having a
Play/Pause Button, which is not stopping the nested movieclips of
the external swf file which is loaded in the container_mc
movieclip.
The other major issue is that I'm not able to add a
progressbar(sliderbar) which runs according to the animation, to
this interface. Please help ASAPI have a similiar situation however the container_mc has me
puzzled, I'm not sure what that is - perhaps you can answer my
question:
I have a master swf called index.swf. The index.swf has a
main tool bar of buttons which load frames; each frame is named to
coincide with the main bar button (i.e. genInfo, setup,
mainentance, etc). This works perfectly. My problem is with Movie
Clips.
Each frame has a sidebar which loads external swfs (i.e.
genInfo.swf) - each external swf is made up of a series of Movie
Clips which run in succession along the timeline; each Movie Clip
belongs within its own frame (i.e. MCseg1 is in frame seg1; MCseg2
is in frame seg2, etc).
I need to pause and play each individual Movie Clip at will;
I have built two buttons (pauseBtn and playBtn) into a Movie Clip
called MCpausePlay. The first frame of MCpausePlay contains the
pauseBtn; this frame is coded with the global "stop();" In order to
move to frame(2) which contains the playBtn, the pauseBtn is coded
with -
on(release) {
gotoAndPlay(2);
The playBtn is coded:
on(release) {
gotoAndPlay(1);
When clicked, the MCpausePlay moves from pause to play.
That's all I have been able to get this to do.
How do I code MCpausePlay to pause and then play each
individual Movie Clip? (How do I get a Movie Clip to control other
Movie Clips?). Should I code the Movie Clip, the frames within the
Movie Clip, or each individual button within the Movie Clip? And,
does this MCpausePlay belong on the Index.swf file, or should it be
on each external swf? Or perhaps built in to every Movie Clip? I
have tried all and have not had any success. -
Stopping and Playing some movie clips?
I have a problem with some AS3 code and i don't understand why.. my code looks like this:
stop();
halt.addEventListener(MouseEvent.CLICK, stopplaying);
function stopplaying(event:MouseEvent):void {
MovieClip(root).stop();
MovieClip(root).gun.stop();
MovieClip(root).gun.gt1.stop();
MovieClip(root).gun.gt2.stop();
MovieClip(root).gun.gt3.stop();
MovieClip(root).gun.gt4.stop();
MovieClip(root).gun.gt5.stop();
MovieClip(root).gun.gt6.stop();
gotoAndStop(1);
That code is set to listen to a pause button to pause all movieclips when pressed but the last 2 rows "MovieClip(root).gun.gt5.stop();
MovieClip(root).gun.gt6.stop();" doesn't work and gives me this output:
TypeError: Error # 1010: A term is undefined and has no properties. third_fla at::ppBtn_20/startplaying ()
But there shouldn't be a problem with this, cause the movieclips are the same as the others and has an instance name of gt5 and gt6 just like the other movie clips, and the code is obviously the same?Try tracing the different objects on those lines and see if they are recognized. It may point to a misnaming or object absence.
function startplaying(event:MouseEvent):void {
MovieClip(root).play();
MovieClip(root).gun.play();
MovieClip(root).gun.gt1.play();
MovieClip(root).gun.gt2.play();
MovieClip(root).gun.gt3.play();
MovieClip(root).gun.gt4.play();
trace(MovieClip(root).gun.gt5, MovieClip(root).gun.gt6);
MovieClip(root).gun.gt5.play();
MovieClip(root).gun.gt6.play();
gotoAndStop(2); -
Play multiple movie clips - with sound
Hello Forum members,
I am a total new comer in terms of flash and action script,
self-educated and Adobe forum and internet educated. I can now
click a button and stop and start a movie clip, use attachMovie,
and even mute sound in a movie clip (not video). I am currently
using Flash 8, and waiting for CS3 (downloaded a trial, and like it
better than Flash 8).
Enough history - now to my question - I have an application
that had 3 scenes. I read in some Adobe article
"Flash Best Practices" that it was not a good idea to use
scenes in an application. I converted my Scene 2 and Scene 3 into
movie clips.
I figured I could either put each movie clip on a separate
layer in my timeline (mc_scene2, mc_scene3)
and play them, one after the other (did not quite work, more
later). Or...
copy the timelines from the scenes, and add those frames to
my Scene 1, making a application with both scenes staggered one
after the other in the main timeline. Or...
Keep Scene 1 and at the end of scene 1,
attacheMovie("mc_scene2", etc) and when scene 2 was done play and
or attach the final movie clip (mc_scene3).
I could not figure out how to tell when mc_scene2 was done
using the attacheMovie method, so I could then attach mc_scene3,
etc.
How would I be able to tell when one attached or loaded movie
clip is finished, and then start the next one?
Or what is the suggested way to use actionscript to load a
movie, play it, and when the clip is done, load and play the next,
etc.
Thanks for a good forum,
eholz1Hello Again - I guess there is much that I do not understand.
I followed the tip above - or so I thought.
I have "buttons" on my movie clips that play the clip when
clicked.
I have placed stop actions in frame 1 of each movie clip.
I tried placing mc_scene2 and mc_scene3 on their own layer
in the timeline,
and put the code above in my actions layer (Scene 1).
it seems that nothing really works - the _visible property
seems not to work,
etc - I must be doing something wrong. What layer should the
two mc's be
placed?
Thanks for the info
Eholz1 -
Play 2 movie clips in sequence
Hello everyone,
I am looking for a script that can let me do this:
If I click a button - 1 movie clip will play X number of frames, and then after it completes, a 2nd movie clip will play X number of frames.
It is important that I can do this in one script in the button.
Otherwise the easy way to do it would be add a command at the end of the 1st movie clip. Which I don't want to do because I am trying to create a conditional event thingy...
Any help/suggestions would be appreciated.
Thanksbtn.onRelease=function(){
mc1.play();
mc1.onEnterFrame=function(){
if(this._currentframe==this._totalframes){
this.stop();
delete this.onEnterFrame;
mc2.play();
mc2.onEnterFrame=function(){
if(this._currentframe==this._totalframes){
delete this.onEnterFrame;
this.stop(); -
Buttons actioning in different movie clips?
So ive set up some buttons into a movie clip, but i want to get them performing actions in a movie clip that is within another clip.
For example, the code below is what I have attached to one of my buttons. The Movieclip 2photosMC2 is inside a DIFFERENT movie clip to the ones where the buttons are stored. How can I script so that the button actions activate the correct clip?
on(release){
photosMC.gotoAndPlay("img 02");
With the code above, photosMC is the movie clip i want to play and img 02 is within this. The button with this code in is in a different movie clip to the one in which photosMC is held
Any ideas?
Many Thanks
DaveIf you get away from attaching code to buttons you might find it easier to manage that targeting you will need to do. If you assign instance names to your buttons and movieclips, then you can have your code in the main timeline and assign the interaction to the objects from there. As an example, le's say you have a button named "gtn" inside a movieclip named "btnHolder" that sits on the main timeline. And you want to have that button tell a movieclip named "mc" that sits inside another movieclip named "mcHolder" that is also on the main timeline. Then in the main timeline you could use...
btnHolder.btn.onRelease = function(){
mcHolder.mc.gotoAndPlay("img02");
To do it the way you want would require using _root or _parent targets, which is usually better to avoid...
on(release){
_root.mcHolder.mc.gotoAndPlay("img 02");
or maybe...
on(release){
_parent.mcHolder.mc.gotoAndPlay("img 02"); -
Button not working in Movie Clip
I'm building a small 'table builder' app for a client. This
is my first major project in flash and I've encountered something I
cannot figure out for the life of me.
In the .fla below there's a movie clip 'scroller' it has
buttons in it which load .png's to the main stage. Some of the
buttons work, some don't.... I can't figure out why. Even when I
duplicate a button sometimes it doesn't work.??? If I take a button
that's not working in the movie clip and cut/paste onto the main
timeline it ALWAYS works. I've been pulling my hair out over this
for the last two days . I have even started the whole project from
scratch just to try and find out where I went wrong... but to no
avail..... Any help would be GREATLY appreciated. I'm stuck on a
hump and I need some help to get off of it.
Here's a link to my file. I've stripped away all the styling
elements so it should be pretty clean cut when you see it. Thanks
for any help or guidance!
http://www.buddyscampfire.com/tableBuilder.zipA few errors: Scene 1 frame 1 Actions layer. You are
referring to buttons inside of the scroller, and you don't have
too. They aren't doing anything. All you need on that frame is:
function startLoading(whichImage) {
loadMovie(whichImage, "imageLoader");
_root.onEnterFrame = function() {
infoLoaded = imageLoader.getBytesLoaded();
infoTotal = imageLoader.getBytesTotal();
percentage = Math.floor(infoLoaded/infoTotal*100);
infoField.text = percentage+"%";
if (percentage>=100) {
delete this.onEnterFrame;
infoField._visible = false;
Then on the Scroller you have that function again. Remove it
from the scroller, as it does nothing there. Inside of the scroller
all you need is code to attach png files from pressing the buttons.
Make sure each button has a unique instance name, which isn't the
case right now. You have like three buttons called imgbtn1. Fix
that. -
Access Button contained in a movie clip
This is for beginners or those not familiar or having
diffculty with getting embedded buttons to work.
This is a how to on using actionscript in your main time line
that listens for events for button(s) located inside of a
movieclip.
I spent hours trying to figure out why I could not access my
button that was inside of a movie clip from the main ROOT or
_level0 of my scene. When I placed the AS inside the movieclip that
the button was inside of, the button worked but when I put the same
code, no changes, on the main timeline nothing happened.
myMovie_mc.myButton_btn.onRelease = function() {
trace("The Button Works!");
Your can also use onPress, onRollOver or any of the button
actions you would if you created the AS on the button itself.
myMovie_mc.myButton_btn.onRelease = function() {
function() part of the code can also be function():Void
First you tell flash where the button is located. Starting
from the main timeline you start with the name of the movie. This
is where I had trouble and why my buttons did not work. This part
of the code is the INSTANCE name NOT the label you named the movie
that displays in the library.
CREATE AN INSTANCE NAME on the movie clip. Select the movie,
in the properties bar you will see a field where you place the
instance name. I always end the name with _mc, or _btn to tell me
that it is a movie or a button so when I go back through the AS I
know what that object is that is being referenced.
myMovie_mc <-- This is the INSTANCE NAME of the movie clip
myButton_btn <-- This is the name of the button INSTANCE
NAME that resides inside the myMovie_mc movie clip
onRelease <-- This is the event listened for, it could
also be onPress, onRollOver or any other button events
= function() <-- This is needed and tells flash that this
code is treated as a function so that when the event happens, in
this case onRelease, the code inside the { } is executed. This
could also be = function():Void
All the parts before the set to symbol or the = sign needs to
be seperated with a period, though NOT between the event listened
for and the set to symbol or = sign.
myMovie_mc.myButton_btn.onRelease = function():Void
Put your code here that you want performed when button is
Released...
The reason my code didn't work was because I did not give an
instance name to the movie clip. You must give instance names to
ANYTHING you call within AS code. Including buttons, MC's, symbols
etc... or else nothing will happen.
Now, if you are having same problem I had, the AS worked on
the same time line level as the button was on but NOT when placed
in parent or main time line, you now know how to fix it.
This works in AS2, Flash8 and Flash9. I don't have AS3 yet
but the code should work in AS3 also.
Hope this helps someone, I searched for this info in the
forums and could NOT find it. I stumbled upon my error after many
hours of trial and error. So next time if I have this problem
again, a forum search will bring this post up in the results. LOL
Thanks.Nice post. One small addition to this is that you can also
just specify a function name instead of using "=function() {".
For example:
myMovie_mc.myButton_btn.onRelease = myFunction;
function myFunction():Void
Put your code here that you want performed when button is
Released...
This could be used in a couple of ways. First, the way you
mentioned in your post. Second, you can use this method to have the
program simulate a button press (even if the user does not click on
the button). Since the function will execute even if you just call
it like: myFunction();
Just my 2 cents.
Tim
Maybe you are looking for
-
Placing string item as a list option
hi forum users i want to place the string item code which retrives server info as a list option but i do not know how to go abt it can anyone help thanks . /*if (infopool.containsKey("ServerInfo")) {//server info res.removeCommand(Cont
-
SAP PI 7.1 Installtion ?
hi Experts Can Any One have SAP PI 7.1 Thank You praveen.tecnics at g m a i l . c o m Praveen G Edited by: praveen.tecnics on Mar 18, 2009 8:29 PM Edited by: praveen.tecnics on Mar 18, 2009 8:29 PM Edited by: praveen.tecnics on Mar 18, 2009 8:32 P
-
Lightroom 3.2 cannot display Nikon NEF file in Win7
I just upgraded my system from winxp to win7 64bit. I have used lr 2.x/3.x under xp without problem with my Nikon D80 raw picture. But now under win7 64bit professional lr 2.x still ok but 3.2 cannot process the nef file correct -- not display image.
-
5000 hits in document overview
Hi, When I clicked on "Document overview on" in (left side of) ME23N transaction , I am getting a pop-up saying that "You have limited selection to 005000 hits (Note that there are more hits)". Message no. MEQ010. I have more number of PO items to be
-
Invalid field format (screen error) on Table Control
Hello, When selecting a line or multiple lines on a screen made by me(using a Table Control), I get Invalid field format (screen error). Debugging the code it sends the message when looping the internal table on PAI to check if there were values chan