Just learning...help on movie clip buttons
I've tried tons of tutorials and i cant seem to get my movie
clip button to work when i put the mouse over the button.
i have included a screen shot of my time line and code.
Layer 10 frame 1 is where all the script is.
"actions" layer has my "stop" codes in frames 1 and 20
time
line and code
Thanks for your help.
ok if i change "home" to "this" in my code, do i also have to
change my instance name for my button layer from "home" to "this"
as well?
and how do I cast e.currentTarget as a movie clip?
sorry this is only my 3rd day playing around with Flash.
Thanks!
Similar Messages
-
Hi, i am a bit of a newbie at AS & need some help applying it to a movie clip button
I have created a movie clip button but am stuck with the actionscript. I have created the rollover and rollout for this movie clip button but i want it to do 2 things after this i want it to go and stop on the first frame of a movieclip which has my content on it called portfoliogallery_mc (which is also the same instance name for it) when you then click the button i want it to go and play frame 11 of that movie clip portfolio gallery_mc.
Here is my current actionscript i HAVE Flash 8 on my comp that i am currently using.
Please note my actions are on a layer called actions and not on the movieclip button itself.
nxtimagetwo_mc (is the movie clip button/instance of mc)
THE CODE I HAVE USED
this.nxtimagetwo_mc.onRollOver = function() {
nxtimagetwo_mc.gotoAndPlay("_over");
this.nxtimagetwo_mc.onRollOut = function() {
nxtimagetwo_mc.gotoAndPlay("_out");
portfoliogallery_mc.gotoAndStop(1);
portfoliogallery_mc.gotoAndPlay(11);
currently it is playing to frame 11 not stopping at frame 1 and stops on frame 20 where i have a stop action. I also have a stop action on frame 1 of that movie clip.
What I want it to do is first stop at frame 1 of that movie clip and when the button is clicked again to go and play frame 11 of that same movie clip.
Basically what i want the mc button to do is 2 things automatically stop the mc for the first content and when button is clicked let the content fad out and play to where the next stop action is set to in the Movie Clip.
Nothing to with the above www.rsquareme.co.uk is my current portfolio website if you would like to check it out it is not fully complete yet.it doens't make sense to execute:
portfoliogallery_mc.gotoAndStop(1);
portfoliogallery_mc.gotoAndPlay(11);
only the 2nd line of code will be effected.
i know you want to control 2 movieclips. what are the instance names of the two movieclips and what do you want to occur in each of those movieclips.
or, do you want to control 1 movieclip and have it play a certain sequence of frames followed by another sequence of frames? -
hey, i'm pretty new to flash and i'm attempting to create a
site with different scenes representing different pages.
i have four movie clip buttons. One of these buttons should
link to the "about me" page, which so far only has another movie
clip with pictures. from the main page i'd like a user to be able
to click on the about me button/movieclip and the pictures should
appear.
i've been using the code:
on(release){
_root.gotoAndPlay("about_pictures")
however whenever i run the preview, nothing happens when i
click the button.
main timeline includes :
about me > pictures with a motion tween(pictures_about_mc)
> the movie clip of pictures(pictures_mc).
background
buttons
actions
any help would be appreciated. thank you in advance.If you are genuinely using scenes, then your gotoAndPlay()
call needs to include the scene name and the frame...
gotoAndPlay("about_pictures", 1)
and "about_pictures" needs to be the name you assigned to
that scene in the scenes panel.
Using scenes and the way you coded the button are both not
clean ways to code--things end up being hidden from plain site.
Instead of scenes, just use the one maintimeline. Instead of
on(release, etc) use myBtn.onRelease = function (){...} in the
actions layer.
Makes life so much easier in the long run, especially a year
from now when you're trying to change some code and can't find
where you hid it. -
Movie Clip Button - Action Script issues
This is a two part question:
1. I have my movie clip button, "mcAboutus" then inside my
movie clip I have 5 layers: actions, labels, text, animated
rollover("mcAboutusover"), animated rolloff("mcAboutusoff"). On the
labels layer I have _up, _over, _off. On the _up is the text layer,
on the _over is a movie clip of the animated
rollover("mcAboutusover") which is 90 frames, and I want to loop as
long as the mouse is over the text. And the _off has the
"mcAboutusoff" movie clip.
So I was able to have the rollover work, but when I roll off
the rollover animation continues on until the end of the animation.
I understand it has to do with the fact that it's a movie clip, but
how do I point it to go into the movie clip and read the animation
and that on the last frame of the animation I have a
"gotoAndPlay(1);" to have the animation continue looping as long as
it's in a rollover state?
here is the code I have for the _root:
this.mcAboutus.onRollOver = function() {
mcAboutus.gotoAndPlay(_over);
this.mcAboutus.onRollOut = function() {
mcAboutus.gotoAndPlay(_off);
The other problem I am having is that once the I have rolled
over the animation once, the button dies and won't let me rollover
it again?
Aside from the "stop();" action in the mcAboutus movie clip
symbol, I don't have any other actions, should I put items in the
different movie clips I have set up?
ALSO.... The reason that I have the main movie clip button,
and two movie clips residing in the mcBtn is I wanted light rays to
be glowing from the text, and I was having a hard time getting what
I wanted from Flash, so I created in After Effects and exported two
.SWF files. So those .SWF files are the _over and _off states in
the mcBtn. I am having a very hard time controlling those Movie
Clips within the main MC Button. Please, any help would be greatly
appreciated.quote:
Originally posted by:
kglad
mcAboutusover should be a movieclip that has your over
animation and it should have a stop() on its last frame. it should
be placed on your _over frame in mcAbousus' timeline. you should
then use:
Ok, so I have my main timeline, in it has my
mcAboutus>> then inside that I have three labels. _up which
has the static text then on frame 5 I have the _over which has the
keyframe for the mcAboutusover, this animation is 90 frames, then I
have on frame 10, the _off for the RollOut state, and I have a 10
frame animation on that one. I still can't get it to continue on
after the initial rollover, the button still dies down.
I am going to redo everything in a presentation timeline,
based on Total Training and see if that helps my problem out any,
and will get back to you tomorrow with more info. Thanks -
Movie Clip Button not working within an Movie Clip
Hi,
I'm trying to create a movie clip on my my main timeline that has a movie clip button within it that pops up a box in the middle of the site that contains text and links. On Frame 1 I have the Up state, frame 2 the roll over state, and frame 3 my Down State (where Box appears).
on (rollOut) {
this.gotoAndStop("1");
on (rollOver) {
this.gotoAndStop("2");
on (release) {
this.gotoAndStop("3");
I have stop(); on each of the 3 keyframes
The problem is that on the main time line, the button is clickable but doesnt do anything
Any suggestions, what am i missing?
CheersOk, i have this assigned to a movieclip, is this wrong? Especially for MovieClip Buttons. Anyway, just tried this and it works!
on (rollOut) {
this._parent.gotoAndPlay(1);
on (rollOver) {
this._parent.gotoAndPlay(2);
on (release) {
this._parent.gotoAndPlay(3); -
Cursor stops movie clip buttons
I have animated movie clips as buttons. When the animation
reaches the point where the cursor sits on the button it vanishes.
Here is the script I have on the main time line:
//news_mc is the instance name of my movie clip button
news_mc.addEventListener(MouseEvent.CLICK, newsPage);
news_mc.addEventListener(MouseEvent.MOUSE_OVER, newsRollOn);
news_mc.addEventListener(MouseEvent.MOUSE_OUT, newsRollOff);
news_mc.buttonMode = true;
function newsRollOn(event:MouseEvent):void {
news_mc.gotoAndPlay("in");
function newsRollOff(event:MouseEvent):void {
news_mc.gotoAndPlay("out");
function newsPage(event:MouseEvent):void {
gotoAndStop("news");
I know there is something about
news_mc.mask = ??? I'm not sure if I sure what part of the
mask I use. I have a layer that has the button background (instance
name - background) and then the 2 layers that form the animated
mask - the mask layer contains a copy of the button background
(instance name - background2) and then the animated later of the
mask contains a gradient that slides over the button (instance name
- masker).
What is happening?ROLL_OVER and ROLL_OUT rather than mouse_over and _out did
the trick! -
Movie Clips/buttons HELP!!
I have 4 movie clips on a stage that are supposed to act as
buttons(About, Resume, Work, Contact) When I roll over one movie I
want the movie to play and stay on the screen. When the user goes
to the next button and clicks and releases I want the previous
movie clip that was on stage to disappear. I have tried with
success with this code on the main stage but it only works for
rollovers. I want releases. Here is the code.....
b1. onRollOver = over;
b1. onRollOut = out;
b2. onRollOver = over;
b2. onRollOut = out;
b3. onRollOver = over;
b3. onRollOut = out;
b4. onRollOver = over;
b4. onRollOut = out;
b5. onRollOver = over;
b5. onRollOut = out;
function over() {
this. gotoAndPlay(2);
function out() {
this. gotoAndPlay(3);
Any help is appreciated!!Assuming that frame 1 is the "hidden" state for the clips,
just change the code as follows:
// add a variable to the root timeline
var currentClip;
// add function
function click() {
this._root.currentClip.gotoAndPlay(1);
this._root.currentClip = this;
// add code to buttons
b1.onRelease = click;
b2.onRelease = click;
// and so on...
if frame one is not the hidden state, just change the first
line of the click() function:
this._root.currentClip._alpha = 0;
// then change the over() function
function over() {
this._alpha = 100;
this.gotoAndPlay(2);
Hope this helps,
Albee -
Noob help: Triggering Movie Clips with Buttons
Hi guys,
I'm taking an intro Flash and Action Script class and for my final I need to create a portfolio project that contains 5 unique buttons that trigger 5 unique movie clips. I'm having a hard time with this. I've been able to trigger the 1st movie clip with the first button (although I can't stop it) but I can't trigger any ohter movies with any other buttons.
Here's my code:
stop();
chuck1_btn.addEventListener(MouseEvent.CLICK, playMovie);
function playMovie(event:MouseEvent):void
spaceship_mc.play();
chuck2_btn.addEventListener(MouseEvent.CLICK,playSaucers);
function playSaucers(event:MouseEvent):void
saucers_mc.play();
Nothing happens when I click on chuck2_btn when I test the movie. I think I need to create a variable or class but I'm not sure. I'm a super noob with this stuff. Any thoughts? Thanks!
RickYou should learn how to use the Help documentation to find answers like how to use the visible property. For the code you showed earlier, here's what you can try in frame 1 to replace it.
stop();
spaceship_mc.visible = false;
saucers_mc.visible = false;
slideshow_mc.visible = false;
chuck1_btn.addEventListener(MouseEvent.CLICK, playMovie);
function playMovie(event:MouseEvent):void
spaceship_mc.visible = true;
saucers_mc.visible = false;
slideshow_mc.visible = false;
spaceship_mc.play();
chuck2_btn.addEventListener(MouseEvent.CLICK,playSaucers);
function playSaucers(event:MouseEvent):void
spaceship_mc.visible = false;
saucers_mc.visible = true;
slideshow_mc.visible = false;
saucers_mc.play();
etc...
It could be refined, like having a function that hides everything and using that every time before making the one you need to show visible. You might find it necessary to include telling the movies to gotoAndStop(1) as well.
That's about as generous as I'm going to get. It's important that you learn things, and handing you a solution isn't going to help do that. -
Hello im trying to develop a small swf file that the user can
control a video that gives the impression of rotation and
transparency using arrow buttons. I have a 2 small movie clip files
that are currently spread across the timeline exactly 200 frames.
the videos are controlled by means of fast forward and rewind this
gives the impression of rotation (backwards and forwrds) i have
already got the fast forward and rewind function working i would
like another set of arrows that control the transparency or alpha
of the second movie clip so that when the user presses either an up
or down arrow button the transparency goes up or down. Im very new
to action script so any basic explanation help would be great. The
code for the forward and rewind buttons is as follows (ignore the
play function as this button is hidden off stage):
stop();
play_btn.onRelease = function (){
play();
pause_btn.onRelease=function(){
stop();
forward_btn.onPress=function (){
_root.createEmptyMovieClip("controller_mc",1);
controller_mc.onEnterFrame=function(){
_root.gotoAndStop(_root._currentframe+3);
if (_root._currentframe+3 > _root._totalframes){
_root.gotoAndStop(_root._totalframes);
forward_btn.onRelease=function (){
controller_mc.removeMovieClip();
forward_btn.onReleaseOutside=function (){
controller_mc.removeMovieClip();
rewind_btn.onPress=function (){
_root.createEmptyMovieClip("controller_mc",1);
controller_mc.onEnterFrame=function(){
_root.gotoAndStop(_root._currentframe-3);
if (_root._currentframe-3 < 1){
_root.gotoAndStop(1);
rewind_btn.onRelease=function (){
controller_mc.removeMovieClip();
rewind_btn.onReleaseOutside=function (){
controller_mc.removeMovieClip();
}//button is released and increases the Movie Clip's current
alpha value by 10%
increase_alpha_btn.onRelease=function(){
if(MovieClip._alpha<100){
MovieClip._alpha+=10;
//button is released and decreases the Movie Clip's current
alpha value by 10%
decrease_alpha_btn.onRelease=function(){
if(MovieClip._alpha>0){
MovieClip._alpha-=10; -
I am making a website based in flash actionscript 3.0 i have a button nested in its own movie clip, because I have the button expanding to be able to read it i have figured out the only way to do this is by creating it as a movie clipa nd inside the movie clip creating it as a button
I added an event listener to the blog button by saying,
blog.addEventListener(MouseEvent.ROLL_OVER,gotoblog);
function gotoblog(evtobj:MouseEvent){
gotoAndStop(2)
this part of the code works it goes to the 2nd frame of the timeline it is in and stops wich is a blown up version of the origanal symbol
i added on frame 2 a second command
blog.addEventListener(MouseEvent.CLICK.gotoblogpage);
function gotoblogpage(evtobj:MouseEvent){
gotoAndStop("blogframe")
trace("the blog button was clicked")
i have named the symbol blog and have name the frame of where the blog page is going to be "blogframe" this line of code at the bottom is where i run into trouble the output window in Flash is saying "The blog button was clicked" just like i want it to. no errors are accouring why than is the playhead not going to frame "blogframe"? if the button is working when i click it the code is right i belive the problem here is it does not want the playhead to go to the frame i want it to. So i gues my question is, how can i make a button withing a movie clip interact with the main timeline?I have a similar problem if could please help me i'd really apreciate it!!
So i have a looping animation of some thumbnails, the hierarchy goes like this
Scene1(main timeline) -> imgBar(MC)->imgBarB(MC within the imgBar MC)
My buttons symbols are in the last MC "imgBarB" where i have this code:
ss1.addEventListener(MouseEvent.CLICK, OneButtonClicked);
function OneButtonClicked(event:MouseEvent):void{
MovieClip(root).gotoAndStop("ssbox1");
I want to control the Btns in my "imgBarB" MC to play a labeled frame(named "ssbox1") on another MC on the main timeline,this other MC goes like this:
Scene1(main timeline)->ssbox_mc(MC where my labeled frame is) -
Hi -
I'm having a problem with my movie clips playing
simultaneously and cannot, for the life of me, figure out what I
have done wrong. I'm new to flash, so I may have set something up
incorrectly, but here's what I have so far:
11 layers, total: 1 layer with 10 control buttons, each
button with the following actionscript:
on (release) {
gotoAndPlay(85);
Where the number changes in relation to which keyframe the
next movie is on.
I have 10 movies, total, but they are only movie clips,
essentially photo slide shows with audio, made all in the library.
The problem happens when I click on a the second or third
button. Not only does the movie that I have selected begin to play,
but all of the previous clips do as well, so it all sounds quite
garbled. I don't know what I am missing in the action script, as my
Action Layer has a stop command on it at each keyframe where there
is a new clip to play.
I have tried to add a stopAllSounds command, but I'm afraid
that doesn't do anything because it is not a "sound file" per se,
playing in the timeline.
I'm at the end of my rope and really need some help in
figuring this one out. My project is hanging in the balance on
this, as I have scripted everything else correctly and it runs
beautifully.
Please help!
Thanks,
CarolineThey do not have to be on the same layer, but they should not
exist on the timeline for the entire movie, just where they are
necessary.
Lets say you have three movieclips ten frames apart on the
timeline. Mc1 (movieclip1) is on frame 1, Mc2 is on frame 11, and
Mc3 is on frame 21. Mc1 should only be on the timeline from frame
1-10, then it should not exist on frame 11. This way if you jump to
frame 11 only Mc2 will play, because Mc1 isn't on the timeline
anymore.
They do not have to be on the same layer.
It may help if you email me the file. My address is on my
name on the lefthand side of this forum post. -
I know this is probably something really easy to do I just
for whatever reason cannot make this work. I am new to flash and am
building an entire website. I used a template that I purchased and
have been messing around with it and changing it. Problem is the
buttons that are made are movie clips not actually buttons. I want
to create a duplicate button, so I created a duplicate of the movie
clip in the library. Problem is when I drag the movie clip into the
movie and run the flash preview the new movie clips do not work
like the other ones – meaning the other ones behave like they
should – as a button (when I move my mouse over it the action
works) but the new ones just appear as images. I know this must be
a very easy fix and I must be doing something wrong. Any help would
be greatly appreciated – (I might not have explained the
problem accurately, so if more clarification is needed or an
example needs to be uploaded let me know)
Thanks a lot!!!Thanks that worked great, hope that wasn't too noob : (
Well another problem as come up, I made another flash movie
containing content in an xml file. When the swf is hosted and in
the browser it works fine. However when i put that same swf in an
html document and host it the xml never loads. Am i doing something
wrong?
Thanks in advance,
~Rob -
Urgent Need of Help Playing Movie Clips
I'm a complete noob when it comes to AS. I know basic things like stop(); and gotoAndPlay.
Here's my dilemma.
Dearest Professor has given us a task of creating a website in Flash. You need to have 15 links, or 15 pages. He states that you can only go frame by frame on the main timeline with no tweening spaces in between. So I'm virtually creating all of my animations in symbols.
This isnt such a problem... I created a short introduction title video in Flash using a Movie Clip Symbol... placed it on the main timeline on the first page, and then called ActionScript to play the video.
Here's the problem... So.... the movie will play, but it will continuously loop... I've tried putting stop(); on the home page, under the AS... I'm just completely lost on how to get this to play the short clip and go straight to the home page... Could someone PLEASE, direct me on how to do this and give me an explanation as to why this way is the way it is... I would very much like to understand how it works.
Thanks
The Flash NoobThanks Rob!
I did what you suggested but I think I may have messed it up...
Here's the output error I have going on right now.
TypeError: Error #1034: Type Coercion failed: cannot convert flash_website_template2_fla::MainTimeline@7fff0d7aea1 to openingtodogwood.
at openingtodogwood/frame9()[openingtodogwood::frame9:3]
In the end of the timeline of the movie clip I put this:
stop();
openingtodogwood(parent).play();
I think that might be wrong but I'm unsure on what I should have really put. I was also reading that having the name of the movie clip the same as the class in the properties panels is not a good idea?
Thank you so much for your help! -
Flash Newbie needs help with Movie Clips/Action Scripting
Hi -
I'm having a problem with my movie clips playing
simultaneously and cannot, for the life of me, figure out what I
have done wrong. I'm new to flash, so I may have set something up
incorrectly, but here's what I have so far:
11 layers, total: 1 layer with 10 control buttons, each
button with the following actionscript:
on (release) {
gotoAndPlay(85);
Where the number changes in relation to which keyframe the
next movie is on.
I have 10 movies, total, but they are only movie clips,
essentially photo slide shows with audio, made all in the library.
The problem happens when I click on the second or third
button. Not only does the movie that I have selected begin to play,
but all of the previous clips do as well, so it all sounds quite
garbled. I don't know what I am missing in the action script, as my
Action Layer has a stop command on it at each keyframe where there
is a new clip to play.
I have tried to add a stopAllSounds command, but I'm afraid
that doesn't do anything because it is not a "sound file" per se,
playing in the timeline.
I'm at the end of my rope and really need some help in
figuring this one out. My project is hanging in the balance on
this, as I have scripted everything else correctly and it runs
beautifully.
Please help!
Thanks,
CarolineEach layer has a blank keyframe before and after each
movieclip. Each movie clip is at a different frame. Even with the
blank keyframes added, the second video starts to play and then the
first video begins to play. Same happens if I click on the third
button. Third plays, and starts 1st and 2nd shortly thereafter. Is
there an action script I can put in that will tell the timeline
that, when a button is clicked, no matter where the movieclip is,
it will stop and start the newly selected movieclip? -
How do I stop a Movie Clip (Button) from working once clicked?
Ok,
I'm using a movie clip as a button to show content on a page, effectively its like a new page of the website. Problem is, with the script im using for it, once the content is show, the button is still active and if clicked again, will re-load the content. I want a way to effectively disable the button whist the content is shown.
Thanks.
this.services_inner.buttonMode = true;
this.services_inner.addEventListener(MouseEvent.MOUSE_OVER, rollOver_services);
this.services_inner.addEventListener(MouseEvent.CLICK, onClick_services);
function rollOver_services(evt:MouseEvent):void {
this.services_inner.play();
function onClick_services(event:MouseEvent):void {
MovieClip(root).mov.backgrounds.colour.gotoAndPlay(2);Thanks, that does stop it, however, i now need it to work again if a different button is clicked... there are 4 buttons (movie clips) in total, so I assume I'd just need to add the event listener back again on click of the others?
This is the "Services" Button, with the event listener removal.....
this.services_inner.buttonMode = true;
this.services_inner.addEventListener(MouseEvent.MOUSE_OVER, rollOver_services);
this.services_inner.addEventListener(MouseEvent.CLICK, onClick_services);
function rollOver_services(evt:MouseEvent):void {
this.services_inner.play();
function onClick_services(event:MouseEvent):void {
MovieClip(root).mov.backgrounds.colour.gotoAndPlay(2);
this.services_inner.removeEventListener(MouseEvent.CLICK, onClick_services);
This is the "Contact" Button, which when clicked would need to "re-activate" the Services button.
this.contact_inner.buttonMode = true;
this.contact_inner.addEventListener(MouseEvent.MOUSE_OVER, rollOver_contact);
this.contact_inner.addEventListener(MouseEvent.CLICK, onClick_contact);
function rollOver_contact(evt:MouseEvent):void {
this.contact_inner.play();
function onClick_contact(event:MouseEvent):void {
MovieClip(root).mov.backgrounds.art.gotoAndPlay(2);
this.services_inner.removeEventListener(MouseEvent.CLICK, onClick_contact);
Maybe you are looking for
-
Another java.lang.NoClassDefFoundError problem
C:\tinyos\cygwin\opt\tinyos-1.x\contrib\cotsbots\tools>java -jar RobotCmdGUI.jar RobotCmdGUI: Using group ID 125 Exception in thread "main" java.lang.NoClassDefFoundError: RobotCmd/RobotCmdGUI$ 1 at RobotCmd.RobotCmdGUI.initComponents(RobotCmdGUI.jav
-
Tape size parameter in initsid.ora file for 200/400 GB
Hi Experts, I have a ECC 5 system running on Windows 2003 Enterprise Server with Oracle as Database. I have installed an HP Ultrium Storageworks 460 tape drive on the server. It accepts a 200/400 GB tape cartridge. What value should I set for the par
-
Hello everyone, My friend bought an iphone from UK and he is using it in Turkey. He did registration of iPhone. it was working on iOS 4. he updated phone to iOS 5 now it doest see any cellphone provider it updated baseband it self to 04.11.08 but in
-
I recently bought the newly released single for a new album that was coming out. I just bought the album but the song that I bought ahead of time still shows as a single; apart from the rest of the album in my music library. How do I get it to appe
-
Sorry for my English.... I like to open the same RAW a second time on Photoshop 11. Earlier in the Day it works to open the same file it a second time. I can open the Same Raw twice with different Setting. You know what i mean? Since a few Minutes, i