Trying to connect buttons to a movie clip
Hi all,
I need step by step instruction on how to attech control buttons to a movie clip.
I imported the .MOV clip (a 3D rotation) into the library, and I would like to be able to control where the rotation stops, by use of a slider or clicking a button. Can some one please tell me how to do this in an easy way if possible?
Any help would be greatly appreciated so much.
Many thanks,
drag your movieclip to the stage and assign it an instance name, say movMC. create your button and give it an instance name, say btn. you can then use:
btn.onRelease=function(){
movMC.gotoAndStop(your frame label or number here);
Similar Messages
-
Problems coding a button within a movie clip to navigate scenes
Hello there! I've got another probably noobish question to ask about CS6.
My goal is very similar to the one mentioned in this previously discussed forum question: http://forums.adobe.com/message/837995#837995 and also in this question http://forums.adobe.com/message/4172919#4172919
I am attempting to make a button inside a movie clip in my first scene go when clicked to the first frame of my second scene. I named the button's instance menu_button_1 and I believe Scene 1 and Scene 2 are the names of the scenes. (If they should have special names or instance names, I did not see where to type them.) Because of the similarities, I attempted to follow the suggestions on those pages. However I probably did some small thing wrong, (Or heck, maybe a huge thing.) which I what I'd like help with to find.
stop();
myButton.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(evt:MouseEvent):void {
gotoAndStop(1, "Scene 1");
This seemed to be what was suggested to enter. I attempted to modify it to work for me as well. This is what I typed for the button's action.
menu_button_1.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(evt:MouseEvent):void {
gotoAndPlay(1, "Scene 2");
(I removed the stop function because I have music looping in the movie clip that I want to play until the mouse is clicked.) (Also, I picked gotoandplay because I wanted scene 2 to start playing immediately when clicked rather than stopping.)
I tried variations, including "2" instead of "scene 2" and whatnot. I also tried linking it to differnet places just to see if that would work. It seems like it could link if I only asked for a frame within the movie clip itself, but it couldn't go to any other frames in scene 1 or scene 2. When I attempt, this message is displayed in the output:
ArgumentError: Error #2108: Scene 2 was not found.
at flash.display::MovieClip/gotoAndPlay()
at interactivestgermant_fla::menu_1/clickHandler()
It seems it cannot find my Scene 2. (It also cannot seem to find Scene 1 when I prompt it to do that.) I'm afraid I'm not sure of what I've entered incorrectly, though I'd imagine it involves how I typed the scene navigation. Should it have an instance name or something? I'd very muchappreciate a push in the right direction. If you need any more info I'll be happy to provide it. Thanks for the help! I very much appreciate it.I bet you're absolutely right. However I am not sure how I am misnaming it, as to my ametuer eyes, it seems to be entered properly into the properties box? It does show up as "menu" written in white over the keyframes and also in the properties slot. I can include some images here to help out in correcting me.
http://girlfoxgirl.deviantart.com/art/Flash-Help-1-395704638 This image shows my movie clip. This seems to be the problem it's having, identifying "menu." Did I do that incorrectly? It looks to be in order.
http://girlfoxgirl.deviantart.com/art/Flash-Help-2-395704633 This is inside of the movie clip named menu. You can see I did the same to name the button menu_button_1.
http://girlfoxgirl.deviantart.com/art/Flash-Help-3-395704627 This shows the action I gave to menu_button_1 in which I attempt to have it naviagte to Scene 1 frame 493.
http://girlfoxgirl.deviantart.com/art/Flash-Help-4-395704623 This shows where I'd like the button to go to. (It is hard to tell if that's frame 493 or 492. I figured that it should be ok either way and if this frame is 492 then it's easily changed once I get the darn thing working in general) (Also, I named the layer "peanuts." I tired entering the name "peanuts" as well but it didn't seem to work either, so I figured "493" is easier since I know that you can go to a specific frame by doing gotoandplay("scene 1" , #) and I'm not sure if it requires any additional stuff to go to a name.
http://girlfoxgirl.deviantart.com/art/Flash-Help-5-395704687 These are the errors I get. I totally agree with you- It seems very much to be an issue of getting it to recognize the "menu." However I am unsure where I named something wrong. Is this enough info to help you perhaps point out where that is? -
Button within a movie clip not working
Hiya,
I have a movie clip within my swf website that is basically
an icon that you roll over to produce the menu. The movie clip has
coding inside it to produce the rollover effect. This is as
follows:
stop();
this.onEnterFrame = function(){
if(rewind == true){
prevFrame();
this.onRollOver = function(){
rewind = false;
play();
this.onRollOut = function(){
rewind = true;
Whilst this coding works fine for this movie clip, for some
reason the buttons within the movie clip that appear as you
rollover them will not work when pressed. I am trying to get them
to navigate the main timeline, i.e. coding as follows:
on (release) {
_parent.gotoAndPlay("home")
_parent should be correct, I've tried it without and with
_parent._parent however still it has no effect. From what I can see
everything should be working fine.
Is there some reason why buttons will not work within this
sort of roll over effect movie clip?
Thanks for your help.you can't assign mouse handlers to a parent movieclip and
expect a child movieclip to respond to mouse events: the parent
will intercept those events.
to remedy, either assign all your mouse handlers on the child
generation movieclips or use a hitTest() for one of the
generations. -
Problems with button inside draggable movie clip
I am building a click through presentation that has some small text in it. To maintain the design and allow for readability, I have added a zoom feature.
Here is the structure of the movie,
Stage - contains pages movie clip and forward/reverse click buttons for changing pages
pages_mc - contains 24 frames, one page per frame and buttons
There is a button at the _root level that uses a tweener to scale the pages_mc up to 170%. When this is clicked, it allows the pages to be dragged around the screen so you can look at different sections. When you click the button again, it returns the pages back to their original size stops drag.
My problem is, on the pages, there are buttons with links to external sites. Once startDrag has been invoked, I cannot touch the buttons inside the movie clip. Is there a way to make these buttons work?
I need the finished quickly so any assistance is welcome.
Code below
magUp_btn.onRelease = function() {
this._visible = false;
TweenLite.to(pages_mc, .25, {_x:-250, _y:-193, _xscale:170, _yscale:170});
TweenLite.to(magUp_mc, .75, {_alpha:0});
TweenLite.to(magDown_mc, .75, {_alpha:25});
magDown_btn._visible = true;
pages_mc.onPress = function(){
this.startDrag();
pages_mc.onRelease = function(){
this.stopDrag();
pages_mc.onReleaseOutside = function(){
this.stopDrag();
pages_mc.useHandCursor = false;
TweenLite.to(instr_mc, 1, {_alpha:100});
magDown_btn.onRelease = function() {
TweenLite.to(pages_mc, .25, {_x:0, _y:0, _xscale:100, _yscale:100});
TweenLite.to(magUp_mc, .75, {_alpha:25});
TweenLite.to(magDown_mc, .75, {_alpha:0});
this._visible = false;
magUp_btn._visible = true;
pages_mc.onPress = function(){
this.stopDrag();
TweenLite.to(instr_mc, 1, {_alpha:0});
I don't know how to turn drag off when I zoom out without using the onPress command, but I know that this is probably what is getting in the way of the button working?
Thanks!One option is to make the background of the pages be the draggable parts rather than the movieclips that contain the pages and buttons. That way, the buttons could be atop the background and not have their access blocked.
Instead of coding the pages_mc, you would essentially have the background coded for the drag...
pages_mc.bkgnd.onPress = function(){
startDrag(this._parent); -
I have been tring to have a button in a nested movie clip move the timeline along using a class script attached to the nested movie. I can get the buttons to work on the main timeline with another similar class script, but when I have a button within a nested movie and attach similar code to the movie, it doesn't seem to want to work. This is the class code attached to the nested clip.... I guess can an active listener be called if the button isn't yet being visible yet, and should this be done on the Main class script page for the main timeline? Any help would be great!! Thanks
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Animation extends MovieClip {
public function Animation() {
gotoAndStop(1);
negBackground_btn.addEventListener(MouseEvent.MOUSE_UP, buttonPressedNegBackground);
private function buttonPressedNegBackground(e:MouseEvent):void {
negBackground_btn.visible = false;
gotoAndStop("negChar");Hi,
Your question is bit confusing, try to explain it. According to what I unsrestand you should use the particular movieClip name with the code to make it happen properly.
Like :
(movieClip_Instance).gotoAndStop("negChar"); -
Simple Button to Control Movie Clip
Hello,
I was relatively comfortable with AS 2.0, but am having a
hard time warming up to 3.0. I feel that this should be something
simple to find help online with, yet I'm finding it difficult to
get a simple answer.
I have a button that is inside a movie clip within another
movie clip:
mainMenu_mc > whoBtn_mc > whoButton
This button appears to work fine controlling a movie clip on
the same timeline. This is the code so far (on an Actions frame in
WhoBtn_mc):
whoButton.addEventListener(
MouseEvent.CLICK,
function(evt:MouseEvent):void {
whoGlow.gotoAndStop("click");
I have another movie clip on the main timeline that I would
like to control with this button:
blackFadeBottom_mc
What would the code look like for this?
Any help is appreciated - Thank you.Thanks, I was able to place the code on the main timeline and
get a trace when I clicked on the movie clip instance itself. I
probably didn't explain what I was trying to do very well, so I
apologize.
What I need to do is to control this movie clip that is
physically placed on the main timeline (fadeBlackBottom) with the
button that is buried under two other movie clips
(mainMenu_mc>whoBtn_mc>whoBtn).
I would like the whoBtn to tell the fadeBlackBottom movie
clip to (what used to be)
_root.fadeBlackBottom.gotoAndPlay("play"); This will drop down a
box that will contain the content of my 'Who' link.
How can I accomplish this?
Thanks again,
Chuck -
Can't get Simple button to Load Movie Clip
Hi I've looked around for the answer to my question on this
forum
but havent found it so here it goes. I am working on this
company's
Flash site that was built by an outside studio. I am using
CS3.
The url to the site is
http://www.bubbakeg.com.
(this link will take you to the main page click the shadow
graphic
on the left under Bubba and this will take you to the site I
am speaking
of. The site is basically 5 different pages or movie clip.
What I am
trying to do is basically change the "Spring Break" middle
graphic
(which is a Movie Clip) on the HOME page and add a simple
button
that will direct the user to a new page. When I replaced the
graphic
with a new Movie clip there was no problem but I have added
a
button to load a new page (movie clip) and nothing happens.
This
button is in the movie clip of the new graphic which is
called up
when the page loads. If i take this button and just put it
on the
Main Stage in Scene 1 by itself it works and loads the page
(movie clip). It does not however when it is embeded in the
Movie
Clip. The Flash site is basically 5 different Movie Clips
loaded into
an "Empty Clip". This empty clip has a timeline with each of
the
clips labeled and with their respective sized placeholders.
And
when you click on either the links on the Nav bar or the
graphic
for each page it loads that movie clip on the main page. It
seems
like the button only wants to work on the main timeline. I
have
even replaced the code for the "Contact" button with the code
for the new button and it worked (opening new page). Here is
the
code for the new button that does not work:
on (release) {
_root.contentHolder.myHeight = 307;
_root.contentHolder.newLoc = 9;
heightAnimation();
I know the location and height from the above code are
referring to the placement and sizing of each movie clip
in the "Empty Clip". As i said before this heightAnimation
and the resizing of the new clip works fine when the
button resides in Scene 1 on the Main Timeline but not
within the new movie clip (graphic Ive created.)
I will upload the main chunk of the code that resides
in Scene 1 on the first frame of the "Actions" layer.
If anyone has any ideas I would appreciate it very much!
Please let me know if I can provide anymore info.
Thanks!
Gregchange:
function newLayerBT_CLICK(MouseEvent):void{
to:
function newLayerBT_CLICK(e:MouseEvent):void{ -
Buttons in a movie clip don't go to frame Labels
Hello, I have 1 button inbeded in a movie clip named mcintroclp that is on frame 1 of my main timeline, Frame 2 is labeled port_btn on the main timeline. In the timeline of the movie clip mcintroclp I've put the code:
stop();
function buttonClick(event:MouseEvent):void
gotoAndPlay(event.target.name);
port_btn.addEventListener(MouseEvent.CLICK,buttonClick);
The problem is that when the port_btn is pressed the playhead starts from the beginning of the main timeline not at frame 2 with the label port_btn. does anyone know what I am doing wrong, Thanks
SQwhat timeline contains your code? (that's the same timeline that contains those two buttons, correct?):
The timeline that contains the code is the movie clip named mcintroClip I've put the code on an actions layer on the last frame of the MC timeline. Which is the same timeline that contains the two buttons.
what timeline contains mcintroClip?
mcintroClip is on the first frame of the main timeline (whaich has a label home but I dont think that matters)
what timeline contains intro_mc?
intro_mc is the instance name for the movie clip mcintroClip on the main timeline. I tried to put that in the code because I don't relly know what I'm doing.
what timeline has labels that match your button names?
The main timeline contains the labels that match the button names, at this point frame 2 is labels port_btn
The only othe code I have is stop(); on frame 1 and 2 of the main timeline.
Thanks much for all your help on this. -
Moving the play head in the main timeline from a button in a movie clip
I have a movie clip that loads and when it is done playing it has a close button that unloads the movie clip... I want to add code to this button that moves the play head to frame 20 of my main timline using actionScript 3.0
Tried that but dose not work think its because I am loading the movie this way...
Play button "playFinal"
function lastQuestion(event:MouseEvent):void{
var Info:final1 = new(final1);
this.stage.addChild(Info);
Info.x=511
Info.y=340; }
So I tried using the Name "Info"
//example...... MovieClip(Info.root).gotoAndStop(20);
And I tried the name of the clip in the library "final1"
//example...... MovieClip(final1.root).gotoAndStop(20);
Is it because im loading it with actions script instead of having it on the timeline? -
Button w/in movie clip not working
I know this question has been raised before and it usually
just boils down to using the frame #'s and labels. But, even with
that it is not working.
I have a map of the US and when each state is rolled over I
would like a menu to appear - this menu is a list with several
options and all of the options are buttons. I have it set up so
that each state is its own MovieClip and each has an invisible
button over it for the hit area and the menu to appear. (i didn't
want it to be simply when it rolls over the state movie clip
because the hit would be square, covering other states and causing
a mess of pop up menus)
Anyway, the menu pops up fine, but the buttons within do not
work. Any ideas of what I'm doing wrong? Thanks Much!!!!
wi_mc.stop(); // wi_mc is the state movie clip
wi_btn.onRollOver = function(){ //wi_btn is the invisible
button
wi_mc.gotoAndStop(15); //frame 15 is where my menu resides
wi_btn.useHandCursor = false;
wi_mc.onRollOut = function(){
wi_mc.gotoAndStop(1);Alright, I've made adjustments to how I've got it all set up.
I've made the menu it's own swf file, (seeing as how I'm going to
have 48 of them in total I figured it was less messy to have each
as their own file). Anyways... here's the current problem and I'm
hoping someone has a good explaination for why this would be
happening...
on my main file I have 2 invisible buttons - 1 is calling the
movie to load when rolled over and the other is calling the movie
to unload when a roll-out occurs. RollOver works great - fully
functional menu shows up. Roll out, however, is having some issues.
The invisible button is in the same location of the menu, same size
etc. so that when the user rolls away from this the menu should
"unload".
For some reason it's acting as if the hit area for the roll
out is off. I did a trace to find out where it's saying the rollout
areas are and the first is actually when I roll onto it, then only
again when i roll out from the left side of the graphic. I've tried
deleting the button and creating a new one but the same thing is
happening.
Any ideas for a very confused person trying to complete this
simple task of unloading a swf via rollout? MUCH appreciated!!!!
this.createEmptyMovieClip("ExternalSWFHolder",
this.getNextHighestDepth());
var SWFLoader:MovieClipLoader = new MovieClipLoader();
wi_btn.onRollOver = function(){
SWFLoader.loadClip("wi_menu.swf", ExternalSWFHolder);
wi_rollout.onRollOut = function (){
SWFLoader.unloadClip(ExternalSWFHolder); -
Link a button inside a movie clip to a scene
I am trying to link a button that is inside a movie clip to a scene. The button has the instance name "cosmetic_btn" and the scene is called "Cosmetic Treatments".
On my main timeline I have the code:
cosmetic_btn.addEventListener(MouseEvent.CLICK, clickHandler);
function clickHandler(evt:MouseEvent):void {
gotoAndStop(1, "Cosmetic Treatments");
And on the timeline inside the movie clip I have this code:
MovieClip(root).gotoAndStop("Cosmetic Treatments");
When I run the document I get the following error:
Home, Layer 'actions', Frame 101, Line 1
1120: Access of undefined property cosmetic_btn.
I have the instance name "cosmetic_btn" set on the button so I am unsure what is wrong here?
http://img600.imageshack.us/img600/3236/gp2g.pngOne other thing you should correct is to add a frame number/label for the line....
MovieClip(root).gotoAndStop("Cosmetic Treatments");
otherwise you are likely to get an error regarding there not being a frame with that label -
Hi,
I had previously posted a discussion entitled "how to link a
button to a .swf file" and after some feedback, decided to try and
create multiple movie clips (which were actually to be individual
site pages) which could be accessed by clicking on a particular
button. The last response I left was this:
Okay, here I am again. So I created a movie clip called
ENERGYwhiteTransparentBoxMC. On my Sustainability page, there is a
button called Energy Services. When I click on that button, I would
like it to go to the ENERGYwhiteTransparentBoxMC and begin (which
is a page that is laid out identical to the Sustainability page
only with a new image, new text, etc.)
In my button movie clip which contains the Energy Services
button (as well as 2 other buttons), I applied the following
actionscript in the first frame.
import flash.events.EventDispatcher;
import flash.display.MovieClip;
this.stop();
function startMovie(event:MouseEvent):void
this.gotoAndPlay(ENERGYwhiteTransparentBoxMC);
btnEnergyServices.addEventListener(MouseEvent.CLICK,startMovie);
A couple of things...
1.) it doesn't work and go to the Energy Services movie clip
when the Energy Services button is clicked.
2.) my stop action that had previously been applied doesn't
work (the links fade in and drop, the transparent box slides
in...but they are supposed to stop and now they don't). So, I'm
confused as to where to apply the stop action for this now.
Am I close at all?????
I would also add now that I wasn't sure what to insert here:
this.gotoAndPlay(
TextENERGYwhiteTransparentBoxMC);
...I would like it to go to the movie clip that is called
ENERGYwhiteTransparentBoxMC.
It might help to check out my original post as I explained it
better there what I was trying to do. I last posted on it today,
November 19. Any help would be greatly appreciated!
Thank you!Just a suggestion: maybe the preloading could be done in a
movie script of the new movie and the particular cast member sent
to the new movie in a global variable. -
Ok, i'm new at action script so i have a problem
I have a sound inside a movie clip (sound_MC) in the main
timeline, and i have another movie clip with a button inside, and I
need that button to control that sound movie clip
on (release) {
gotoAndStop("off_radio"); // this goes to another frame in
the movieclip with the button (works fine)
on (release) {
_root.gotoAndPlay("stop_loop"); // this goes to another
frame of the sound MC (doesn't work)
// i have this in the stop button
on (release) {
gotoAndStop("on_radio");
on (release) {
_root.gotoAndPlay("start_loop");
// and this for the play button
whats the code for that ?
what should i do?i solve the problem !! :-D
but now i hold like to now how i make a fade out sound
command when i enter a frame and a fade in when i enter in another
frame
here are the examples:
http://tubo_centeno.web.simplesnet.pt/problem/problem.html
http://tubo_centeno.web.simplesnet.pt/problem/problem.fla
can anyone help me? -
Trying to change text in a movie clip
i'm trying to replace text in a dynamic text field within a movie clip, and it seems as if it's treating it like static text. Is there a way around this?
theBtn1.addEventListener(MouseEvent.CLICK, adjustText1);
theBtn2.addEventListener(MouseEvent.CLICK, adjustText2);
function adjustText1(e:MouseEvent):void
textField1.text = "Foo"; // this works
function adjustText2(e:MouseEvent):void
theMC.getChildByName("textField2").text = "Bar"; // this doesn't
It throws this error:
1119: Access of possibly undefined property text through a reference with static type flash.display:DisplayObject.You don't need to use the "getChildByName" function.
Try:
theMC.textField2.text = "Bar"; -
Overlapping buttons within a movie clip
I am using Flash CS3. Within a movie clip, I have a button
symbol on one
layer and an invisible button, which covers the whole canvas,
on another
layer. Regardless of top-down order, the big invisible button
works and the
button symbol (simple text rollover with link) will not work.
If I put the
button on the main timeline it works fine.
What's the solution or what is a good way to have canvas
coverage, plus
individual links?
Thanks for the help.See, I thought of that. It only works on the main timeline,
not within the
movie clips.
If you look at
http://www.graceweb.us/flash/precepts_090310.swf
and mouse
over the right-hand rectangle you'll see the top "blog" link
is on the main
timeline, the second blog link is two MCs deep, and the
bottom two links are
in the same clip as the invisible button.
The actual FLA is at
http://www.graceweb.us/flash/precepts_090310.fla
Thanks again for the help
"NedWebs" <[email protected]> wrote in
message
news:gpqvok$d45$[email protected]..
> Place all of you individual links/buttons on a layer
above the stage one
Maybe you are looking for
-
*New Dates For* Upcoming Support Webinars & Info About Support
Dear Oracle Primavera Customers: As of November 2009, the Oracle Primavera software support team has completed the migration and integration to Oracle Global Customer Support. This is an exciting time for the support organization, as we will now util
-
D-Link DI-624 WEP wont connect to my iMac
When i start up my iMac, I login and then I click on the airport icon and turn it on. Then, I click open network preferences. Then i click on the drop-down and select Join Other Network. In that window, I type the network name, select the security wh
-
Auto Confirmation of PICK TO's with Handling Units !!
I want to Create an Outbound Delivery. I then want to automatically create pick transfer orders, in the background. I then want to automatically confirm these transfer orders, in the background. I am creating my Outbound Delivery with reference to a
-
External programs using in Java
Hello I am wondering how to do this: How can I call some (in this case console application) applications from my Java code and then handle that application;s output. For example: Netbeans, IDE written in Java is using Java compiler, external console
-
Problem to Instal Windows 7 64Bit on HP 250 G2 F0Y78EA
Hi, i bought notebook hp 250 g2 F0Y78EA... this is freedos and when i insert win 7 64bit...on the monitor when try to install comes wrote "starting windows" but STOP and does not go forward... Sorry for english, but i'm italian boy. i have try to loa