Making Main Timeline Play From Button Inside MC
Hello,
i think the title says it all. I have done this a million times, but for some reason I seemed to have missed something.
My button is inside a movie clip, the AC on the button is this...
on (release) { gotoAndStop(6); _root.play(); }
_root.play(); isnt working....
FlashKit > Flash Help > Flash MX
Posted on: 11-11-2005, 11:24 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Making Main Timeline Play From Inside Mc In AS3
Hi
I'm primarily a motion graphics guy but am helping out a friend with some Flash web work. I have CS3 now but haven't touched the app since MX so Actionscript 3 is taking me some time to get to grips with - not that I was any more than a dabbler anyway.
I am simply trying to make the main timeline play when an MC on the stage reaches the end of its animation. I have tried variations of root.play("menu") or parent.play("menu") in the last frame of the MC but I get:
"1061: Call to a possibly undefined method play through a reference with static type flash.display:DisplayObjectContainer."
Also it breaks the previously ok code and the 'stop' on the 2 frames of the main timeline are now ignored.
Then I see stuff like this -
Button Inside MC Controlling Main Timeline
Hello,
I have a movie clip on Scene1 of my timeline and inside that MC is a button, how can I set it up so that when that button is clicked the main timeline moves ahead one frame? Everytime I try to advance the main timeline one frame it only moves the MC ahead one frame!
Thanks!
Talking To Button Inside Mc From Main Timeline
I am trying to talk to a button that is inside of a movieClip, but would like to do it from the main timeline rather than inside the movieclip. I am using flash 8 and can't remember how to do this. Any advise/methods would be greatly apreciated.
thanks
Button To Play Main Timeline?
Hi, I have a button that I want to continue playing the main timeline and I cant seem to get it to work From my understanding it should be pretty simple.
Button Inside Movieclip Cannot Control Main Timeline
I come accross a reoccuring problem, where a button nested inside a movieclip cannot control the main timeline, in terms of skipping to certain scenes or frames. I've tried
_root.gotoAndPlay("Scene2");
_level0.gotoAndPlay("Scene2");
but this action doesn't seem to affect the main timeline. Does anyone know how to select the main timeline as the object?
Kind Regards,
Scott Lahney
--
James Cook University
Townsville, Australia
[mx2004] Control Main Timeline From Button Inside Movieclip
I've created a movieclip with buttons inside that I want to use to navigate to different scenes on the main timeline. I have created a function() that loads the button movieclip into the main timeline, but if I try to write a function() to activate the button and move the main timeline to a different scene/frame label it doesn't work. I have tried various things:
navBack_mc.book_btn.onRelease = function() {
_root.gotoAndStop("book1");
}
I put the code above on the main timeline. It doesn't seem to work. Basically, I could put just an on(release) handler on the buttons, but I wanted to try to keeping all the AS in one place if I can.
Thanks in advance.
[mx2004] Control Main Timeline From Button Inside Movieclip
I've created a movieclip with buttons inside that I want to use to navigate to different scenes on the main timeline. I have created a function() that loads the button movieclip into the main timeline, but if I try to write a function() to activate the button and move the main timeline to a different scene/frame label it doesn't work. I have tried various things:
navBack_mc.book_btn.onRelease = function() {
_root.gotoAndStop("book1");
}
I put the code above on the main timeline. It doesn't seem to work. Basically, I could put just an on(release) handler on the buttons, but I wanted to try to keeping all the AS in one place if I can.
Thanks in advance.
Pause/Play Button Referring To Main Timeline...
I'm working on a site that includes a button that says "pause" - when the viewer clicks it, it switches to say "play." Right now, it's a two-frame movie clip that has one button on each frame. I know I need to specify that the Pause/Play action refers to the main timeline (possibly using "_root"?) but I have no idea where to place that. Here's the script for both frames:
Frame 1:
on (release) {
stop ();
}
on (release) {
this.nextFrame();
}
Frame 2:
on (release) {
play ();
}
on (release) {
this.lastFrame();
}
Am I on the right track? Would _root go before or after the command? It's switching from "Pause" to "Play" and back perfectly....
Thanks for your help....
Julia
Button To Play MC & Goto Point On Main Timeline
Hi
I have a button on my scene. When clicked on, I would like to play a MC and go to a specific point on the main timeline.
However, the MC it will play will depend which frame the movie is on, when the button is pressed. I have the script, which will help to explain my question: -
on (release) {
if (frame = 10) {
_root.About.play();
_root.gotoAndPlay("Overview");
}
if (frame = 20) {
_root.Client.play();
_root.gotoAndPlay("Overview");
}
The script doesn't work! Can anybody advise?
Thanks
MERRY CHRISTMAS!!!
Recognizing Within Main Timeline A Button Located Inside Externally Loaded .swf
Hello all. I'm using the preloader like the one rhamej posted here:
http://www.kirupa.com/forum/showthread.php?t=94888
The part of the code I need help with is as follows:
ActionScript Code:
//fire the MovieClipLoader and attach the listener to itvar container1:MovieClipLoader = new MovieClipLoader();container1.addListener(mclListener);container1.loadClip("1_movie.swf", container);//button actions_root.enter_button.onRelease = function() {container1.loadClip("tree20.swf", container);};
I realize the code is wrong. I wondered if it was possible after loading an external .swf ("1_movie.swf") within the container, if you could then press a button (enter_button) located within the external .swf ("1_movie.swf") , and use the preloader code to load another external .swf on release ("tree20.swf"). I'm having trouble because the preloader code is in the main timeline of my main flash file ("index.fla"), and I don't know how to make the preloader code recognize the button located within the external .swf, and use it to load another external .swf within the same movie clip. Any help would be appreciated.
Recognizing Within Main Timeline A Button Located Inside Externally Loaded .swf
Hello all. I'm using the preloader like the one rhamej posted here:
http://www.kirupa.com/forum/showthread.php?t=94888
The part of the code I need help with is as follows:
ActionScript Code:
//fire the MovieClipLoader and attach the listener to itvar container1:MovieClipLoader = new MovieClipLoader();container1.addListener(mclListener);container1.loadClip("1_movie.swf", container);//button actions_root.enter_button.onRelease = function() {container1.loadClip("tree20.swf", container);};
I realize the code is wrong. I wondered if it was possible after loading an external .swf ("1_movie.swf") within the container, if you could then press a button (enter_button) located within the external .swf ("1_movie.swf") , and use the preloader code to load another external .swf on release ("tree20.swf"). I'm having trouble because the preloader code is in the main timeline of my main flash file ("index.fla"), and I don't know how to make the preloader code recognize the button located within the external .swf, and use it to load another external .swf within the same movie clip. Any help would be appreciated.
Tweening External Dynamic Text Inside A MC Inside Main Timeline
I've seen a hundred and a half posts on similar subjects, but goshdarnit, I just can't make this work. Let me explain the problem, and I've included a link to a Zip file with my .fla file and the away.txt file I'm calling the variables from.
Basically, I want to create an interactive menu thing, that starts with a row of each of the 26 letters of the alphabet. When one clicks on a letter, the letter is tweened to a larger faded state, and so is the rest of the alphabet, and I want the names of the schools starting with that letter to then fade in. I have a movie clip inside the last frame of the main tween, which should then tween (fade in over 12 frames) the graphic symbol containing my dynamic text box, which is supposed to be linked to the text variables in the external file. The text variable is created on the first frame of the main timeline using Actionscript on the static header layer, and so I should be able to load it inside my movie clip (I think). Everything looks fine to me, but then I've only been using Flash for 2 weeks.
To sum up, I need to tween the graphic symbol. The graphic symbol contains the dynamic text which references the external text file. The graphic symbol is inside a movie clip, inside one frame of my main timeline. The text isn't showing up, only the empty text box is.
My Zipped source files can be found at: http://www.tolcs.org/athletics/away.zip
If anyone would be willing to download my source files and give some wonderful advice, I'd revere and adore them forever.
Play Movie In Timeline But Keep Main Timeline In Place
Hello,
Scenerio: You are at frame 1 of the timeline and it's stopped, you hit a button and it jumps you to frame 20 and then at frame 20 a movie clip plays.
Question. Can I have that movie play for however long I want (let's say it's a 100 frame movie) BUT have my main timeline still sit on frame 20? And then when the movie is done playing it goes to frame 21 of the main time line? Currently I have to make my main timeline be the same length as any movie I have in it, and so my main timeline ends up being an absurdly long.
Just a general answer will help - which action scripts would I be looking to use (I'm using Flash 8 Pro)?
Thanks
Button Inside Movie... Movie Is On Main Timeline
Hey all, I have this question that a lot of people have asked, but I never found an answer to this question.
I have a button, and that button is inside a movie clip, and this movie clip is on my main timeline. How can I reach the button?
Thanks and kind regards...
Somberlain
Mc Inside Mc Properties From Main Timeline?
is it possible to edit properties of an mc inside another mc, from the main timeline?? (Like how u can use _root to go from the mc to the timeline, does it work the otherway?)
thx
Adressing Main Timeline From Inside Mc
Hello, basic question here.
I want to advance the main timeline from inside a movie clip.
on (release) {
_root.gotoAndPlay(11);
}
If I do this the movie goes to frame 11 in the first scene, but I want it to go to the 11th frame in another scene. What's the syntax for this?
[F8] Main Timeline From Buttons Inside Mc's
OK, so I'm teaching myself actionscript. doing alright, running into frustration.
I've created drop menu's with each option as an individual button inside a movie clip on the main timline. All I want to do is control which frame on the main TL the scrubber goes to when the user releases on the buttons. This can't be that hard, but I can't figure it out. I've got three different books, one of which is "actionscript, definitive version" and hell if I can find anything that expains how to do this.
I understand I need to somehow call out the "_root", but every combination of code I can think of, or read from will not work.
All my different pages for the site are located in seperate frames on the main TL. All the animation is located in mc's on the first frame of each layer (seperate layer per interface component, btn's, bkgrnd, ect...) Everything is working like a dream with actionscript btw animations, but nav's are killing me.
please help.
Change Frame Inside Mc From Main Timeline
I've got screenshot on the main timeline with an invisible button. Floating over the screenshot is a mc containing text.
I would like to know how do I change the frame in the mc when I click on the button in the main timeline?
What is the syntax?
Actionscript Not Working Inside MC On Main Timeline
I posted this elsewhere, this is probably more appropriate...
I know this HAS to have been answered somewhere here before... I've been doing Flash on and off since it's creation, but it's been a while since I used it. I have Flash8 running on this dev machine and I am adding a little accordion to an old project. I have tried calling the accordion swf from the main movie and loading it in, but this is not working for me.
So, I tried copying all of the frames form the external SWF accordion (it's small), along with it's actionscript to a MC inside the main movie and placed that MC on the timeline in the main file. The MC shows up fine, but the action associated with it is not functioning.... basically I want the text button to pop up the accordion MC and allow interaction by the user to click through the slides within it.
A little definition:
KSB_MC = the container MC on the main timeline that displays the first frame of the MC which is: KSBbutton_MC
KSBbutton_MC = the text MC visible from the main timeline that should launch the KSBanimation_MC (which is the accordion)
This is the AS I have so far that is in the MC I placed on the main timeline:
//first we stop both animations inside KSB_MC from running
KSB_MC.KSBbutton_MC.stop();
KSB_MC.KSBanimation_MC.stop();
//then we make conditional, the button action so that if the button_MC is pressed, the button goes to frame 2 and the animation_MC plays or else stop both animations
KSB_MC.KSBbutton_MC.onPress = function(){
if(KSB_MC.KSBbutton_MC._currentFrame ==1){
this.gotoAndStop(2);
KSB_MC.KSBanimation_MC.play();
}
else{
this.gotoAndStop(1);
KSB_MC.KSBanimation_MC.stop();
}
}
.......first of all, the KSBbutton_MC on hover shows a finger cursor as it should, but does not activate when pressed. Nothing happens after that. I get no errors in the AS checker....
my problem is with layering or something st00pyd. Feelin kinda n00bysh.
Help a brothah out will ya guys?
Script To Control Main Timeline From Inside MC?
This is such a newb question and I'm sorry! I have a Movie Clip on the main timeline and inside that MovieClip are several buttons. I want the buttons to go to specific frames in the main timeline. I have:
on (release) {
gotoAndPlay("PowerPoint");
}
I know there needs to be something in there to tell it the main timeline. I searched for this very basic, simple question and couldn't find anything.
Thanks for any help.
Newbie: How Stop MC Inside Main Timeline?
Hello,
I'm not really that much of a newbie, except in AS. I'm sure I'm just looking at this problem wrongly, but I'm running out of time to hunt down the answer or use trial and error.
I have a movie into which I've put a small mc of an "electron" on its own level, in the main timeline. There are several other layers with animation on the main timeline too.
The electron MC is set to duplicate 50X.
Below is the AS on the main timeline, in the electron layer:
for (var i = 0; i<50; i++) {
particle1.duplicateMovieClip(1, i);
}
Inside the electon MC itself is AS to make all the duplicated electrons fly about "randomly".
Below is the AS attached to the single electron incidence visible in the main timeline:
onClipEvent (load) {
//movie width/height
height = 400;
width = 550;
//------------------------//
//makes everything random //
//------------------------//
this._x = Math.round(Math.random()*width);
this._y = Math.round(Math.random()*height);
var temp = this._alpha=Math.random()*100;
this._xscale = this._yscale=temp;
//setting initiaion position
cx = this._x;
cy = this._y;
}
onClipEvent (enterFrame) {
//causes the object to be offset
this._x = cx+(1+Math.random()*100);
this._y = cy+(1+Math.random()*100);
}
Everything works fine except:
When the main timeline movie ends the MC of the flying electrons continues indefinitely.
I'm looking for a simple stop for the duplicated, flying electrons about half way into the main movie.
TIA
Les
Watching MC's Inside-animation On The Main Timeline
Can anyone please tell me how to be able to see what animation is playing inside a MC, that is placed on the main timeline in Scene1, by scrolling the timeline back and forth on Scene1, in stead of entering the MC it self?
The reason I ask is that I have some MC's that move on the Scene1 and I need to make perfect timing of MC's animation together with tweening movement of that MC on the main time line
Thanks
Newbie: How Stop MC Inside Main Timeline?
Hello,
I'm not really that much of a newbie, except in AS. I'm sure I'm just looking at this problem wrongly, but I'm running out of time to hunt down the answer or use trial and error.
I have a movie into which I've put a small mc of an "electron" on its own level, in the main timeline. There are several other layers with animation on the main timeline too.
The electron MC is set to duplicate 50X.
Below is the AS on the main timeline, in the electron layer:
for (var i = 0; i<50; i++) {
particle1.duplicateMovieClip(1, i);
}
Inside the electon MC itself is AS to make all the duplicated electrons fly about "randomly".
Below is the AS attached to the single electron incidence visible in the main timeline:
onClipEvent (load) {
//movie width/height
height = 400;
width = 550;
//------------------------//
//makes everything random //
//------------------------//
this._x = Math.round(Math.random()*width);
this._y = Math.round(Math.random()*height);
var temp = this._alpha=Math.random()*100;
this._xscale = this._yscale=temp;
//setting initiaion position
cx = this._x;
cy = this._y;
}
onClipEvent (enterFrame) {
//causes the object to be offset
this._x = cx+(1+Math.random()*100);
this._y = cy+(1+Math.random()*100);
}
Everything works fine except:
When the main timeline movie ends the MC of the flying electrons continues indefinitely.
I'm looking for a simple stop for the duplicated, flying electrons about half way into the main movie.
TIA
Les
How Do I Play One Frame From The Main Timeline From An MC ?
as the title sais , i am in a movie clip and when i click on this button i wanna gotoandstop a frame that is on my main timeline. I cant put this
on (release) {
_root.gotoAndStop (framenumber);
}
because i want it to go to the main timeline in the second scene , but when i put _root... it goes to the root of the whole prject i want it to go to the root of the second scene
Unload Mc And Play Main Timeline?
I have a main movie "main.swf" and in an empty movie clip (instance name "empty") on that timeline, I have it loading another movie ("continue.swf") that takes you to the end of the presentation...
This is the action on frame 1 of "empty":
loadMovie("continue.swf", 1);
I need the entire presentation to loop. I have a frame labeled "startsite" where I need the movie to start over from on "main.swf"
So at the end of "continue.swf" I need an action that tells it to go to "main.swf" and play frame labeled "startsite," right?
I've tried:
_parent.gotoAndPlay("startsite");
I've tried:
_root.gotoAndPlay("startsite");
I've tried unloading the movie clip "empty" from the main.swf with:
this.removeMovieClip()
but everything I try only loops the "continue.swf"???
Can someone please help?
Play/Stop Flv From Main Timeline?
http://studio34design.net/aleks/aleks_chem3.html
about 30 seconds into this flash, there is an FLV of a computer screen. The problem is, when I pause the swf, the flv keeps going. How do I get around this?
1. Is it possible to convert the flv to swf?
OR
2. Is it possible to control the flv from the main timeline?
thanks people!
Making Movie Clip Effect Main Timeline
I want to make a movieclip of a guy shooting a rifle. I am making the guy have button attributes so that when you click on him, he dies. In order to save time and space I want to make it a movie clip. How can I make it so that if you miss the guy and he shoots you, it does a goto and play in the main timeline?
Control Main Timeline From Clip Inside Movie
Have a movie clip on my timeline(its a button)
_root.home.onRollOver = function(){
_root.home.gotoAndPlay("over");
_root.home.back = false;
_root.home.play();
}
_root.home.onRollOut = function(){
_root.home.gotoAndPlay("out");
_root.home.back = false;
_root.home.play();
}
_root.home.onRelease = function(){
gotoAndPlay("main", 1); }THIS IS WHAT I CANT GET TO WORK
When I click the button nothing happens. Ive tried..
_root.gotoAndPlay("main", 1);
gotoAndPlay("_root.main", 1);
gotoAndPlay(_root."main", 1);
Ofcourse none of theese worked.
Linking To A Variable On Main Timeline From Inside Clip?
I guess the title says it all, but if I have a frame script that's a couple levels in (inside 2 movie clips), how can I link to a variable on the main timeline?
On the frame inside the clips is just a simple "var mainvariable = 3;"
But the Dynamic text field named "mainvariable" resides on the main timeline.
I can't really figure out how I'd use a _root or anything to get there. I'm sure I'm missing something obvious. Can you help?
Thanks!
Action On MC To Play A Frame On Main Timeline
Flash 8
I'm trying to get a Movie Clip (in the 1st frame of the main timeline) to end by going back to frame 10 of the main timeline in Scene 1. I put an action in the MC's last frame
gotoAndPlay("_parent", 10); but nothing happens
I also tried "scene 1" " _root1" "_level1
Is there a way to navigate from the Movie Clip to the main timeline of Scene 1??
Thanks
Loadmovie On Main Timeline, Play, Then Continue...
Work on my Flash site is going great, but like most newbies it feels like I'm literally pounding this thing into shape with a sledgehammer.
I've got a simple question (aren't they all), and I swear I've searched the forum but to no avail. The answer is out there, but for some unGodly reason I can't find it.
I've got a main timeline with, say, 55 frames. There's a brief animation tween in the first 10 frames. At frame 11 I'd like to stop the main timeline, load a movieclip called mcPort (SWF would be fine as well) and have it play AUTOMATICALLY, and then restart my main timeline at frame 12 once mcPort is finished.
mcPort is basically a long slideshow type movieclip. I plan on adding 1 or two others of this type into my main timeline. I realize that I could just do all of this slideshow animation stuff within my main timeline, but it just gets unmanageable.
I gotta think this is possible. My search reveals people wanting to do the same thing, but always with a button action. My hunch is that a container is used, but I've not used one yet.
Thanks much
Play A Movieclip Once, Then Go To The Next Frame On The Main Timeline
Hello, I'm sorry for the long topic's title.
I have an animation I'd like to use as an INTRO in my flash movie. I will joint it inside a movieclip, giving it the istance name "INTRO". And I position it in the first frame of the main timeline.
How can I make possible that played once my intro (my movieclip) the player jumps to the second frame of the timeline, named by the istance "HOME".
Is it possible?
Thankyou very much for your help,
and great things.
Stebianchi
MC Instance On Main Timeline Play In Order
I don't know if my title is clear enough, but I'll try to clarify.
I have one MC on the main timeline, and duplicates of the same MC one after another. So basically 8 of the same MC lined up beside eachother.
Now the tricky part. I want halfway through the original MC, to jump to the second MC instance and start from frame1. Now the dilema is, that if I make an actionscrpit on the MC, it affects all the MC lined up together, because they are an instance of the original.
Could I use the duplicateMovieClip command, and how?
MC Instance On Main Timeline Play In Order
I don't know if my title is clear enough, but I'll try to clarify.
I have one MC on the main timeline, and duplicates of the same MC one after another. So basically 8 of the same MC lined up beside eachother.
Now the tricky part. I want halfway through the original MC, to jump to the second MC instance and start from frame1. Now the dilema is, that if I make an actionscrpit on the MC, it affects all the MC lined up together, because they are an instance of the original.
Could I use the duplicateMovieClip command, and how?
How Do I Recerence Movie Clips On The Main Timeline From Inside A Class?
Hey everyone, this might be a stupid question but I thought I'd ask cause it's making me nuts. I'm all of 2 days into AS3 (coming from not using Flash at all in YEARS) so feel free to consider me ignorant. I do have plenty of application development experience in other areas though.
I can't seem to create a class that can reference an instance of a movie clip on my main timeline. I'd post code of what I've tried but I've gone through so many desperate edits & wild guesses that it was just garbled junk before I deleted it all.
Basically here's how I figured Flash could work, though maybe it doesn't work this way at all.
I'm assuming that with AS 3 being so big on being a true object oriented environment, I wouldn't need to mix my code and interface together. Preferably I'd be using the Flash authoring tools just to design my interface. Create a button... place it somewhere... give it an instance name. Roughly the equivilant of Apple's InterfaceBuilder for those of you that might be familiar with Cocoa development. I can see maybe having to put a few lines of ActionScript onto frame 1 (though really I'm hoping Flash would have a better method of kicking off the application at this point that using code tied to frames) to load my classes & such, but after that I'd like all of my code to be held in external class files.
So maybe I've got:
Interface.fla - My interface
--- Button_1
--- Button_2
--- TextField_1
Main.as - My main controller class using to handle all of my applications behavior
SomeClass.as - Some helper Class
SomeOtherClass.as - Some helper Class
Main.as would have instructions in its initialization method to go ahead & attach events to buttons & initialize anything else that needs to happen when the application starts. From there on it would all be objects communicating back & forth. Button_1 would get clicked with would fire Main.someMethod(). Main.someMethod() would then do it's thing and set the value of TextField_1. All very clean & code is very separated from interface.
Unfortunately I can't for the life of me figure out how AS3 classes reference each other like that. There doesn't seem to be any kind of a global 'root' or '_root' I can use to locate any movie clips on the stage. I've searched the help & the web for any kind of simple tutorial but to no avail. My job has tasked me with building a flash app for a project but I'd really rather not have a tone of ActionScript just shoved into frame 1. That just seems... ugh! (::shudder::)
Can someone maybe point me in the right direction here? I'm really willing to do my homework but I can't seem to locate the info I need to get started. Also, is there an ActionScript IRC channel or something maybe?
Thanks,
Cliff
|