How to target button in movieclip back to main timeline
Hello!
I have some submenu buttons in a movieclip on the mainline. My first level of navigation in on main timeline. The submenus are grouped in movieclips on the main timeline. I basically used the same code on the main navigation for the sub navigation except the code for the submenus is in that movie clip. My trace statement reads the button is clicked (which was a quantum leap for me) but I know I need some kind of _parent code in there so it knows to go to label back on main timeline. Can anyone help?? I feel like I am so close.
Also is this an ok way to set this up? I couldn't figure out how to do it in one frame. Any help would be so appreciated. I didn't realize this basic framework was going to be so difficult.
Here is link:
http://www.sandraschmitt.com/coclico/index2.html
Thanks!!
Sandra
Here is my code that is on the submenu movieclip:
Code:
stop();
fall.addEventListener(MouseEvent.CLICK, clickSection);
spring.addEventListener(MouseEvent.CLICK, clickSection);
function clickSection(evtObj:MouseEvent){
//trace shows what's happening... in the output window
trace ("The "+evtObj.target.name+" button was clicked!")
//go to the section clicked on...
gotoAndStop(evtObj.target.name);
One reason I'll never win any awards for my design outlook is because I often follow... if it works, use it. There are many ways to approach a design and yours is just fine if you understand it. If it was going to crash something, it would have happened by now. Some people will go to the extreme of having absolutely no code in a file, some even no library content, writing it all into class files, and not out of necessity, but out of simply believing it's the better way, or a challenge to prove their abilities... They can have it. There is a practicality involved with design that allows one to make judgement calls, and if you judge that your design approach is practical for what you understand or for what meets the needs of the project, then you have every right to follow your own path.
That said... in the event someone should inherit your work somewhere down the road, that's when your approach may fall victim to judgement... if someone cannot follow it or is having trouble putting all the pieces together, or finding them, then you become the fall-person for the whining that ensues. But you're not likely to have to hear about it. Still, someday, if you find yourself in a position where you inherit someone's design... and you start whining about how they did it, you'll come to appreciate the reasons for giving consideration to how you approach your designs.
Similar Messages
-
Help with button that goes back to main timeline from movieclip
I have a movie created that is broken down into sections on the timeline (home about contact etc)
Each section has a movieclip
I want to be able to be in the about movieclip and click a button that will bring you back to the main timeline contact section
Heres is the actionscript I am using to navigate the main timeline for each section
stop();
//handle events for buttons...
index.addEventListener(MouseEvent.CLICK, clickSection);
about.addEventListener(MouseEvent.CLICK, clickSection);
wind.addEventListener(MouseEvent.CLICK, clickSection);
turbines.addEventListener(MouseEvent.CLICK, clickSection);
services.addEventListener(MouseEvent.CLICK, clickSection);
invest.addEventListener(MouseEvent.CLICK, clickSection);
contact.addEventListener(MouseEvent.CLICK, clickSection);
function clickSection(evtObj:MouseEvent){
//go to the section clicked on...
gotoAndStop(evtObj.target.name);if that code is on the timeline of a movieclip whose parent is the main timeline, use:
MovieClip(parent).gotoAndStop("frame label in main timeline"); -
How do I set a variable on the main timeline from within a symbol?
Just getting started with Animate and coming to it from Flash, as may be apparent from my question. How do you set a variable to the main timeline from within a symbol?
I have 24 pairs of clickable elements, each in their own symbols, and all 24 of those symbols sit inside another symbol. I want all 24 to be able to set the same global variable when clicked. I can't find that this question is addressed anywhere, which makes me think I may be stuck in a Flash mindset and approaching the task in the wrong way. (There are however MANY discussions of how to address objects at different levels in the hierarchy. That's well covered.)
Relatedly, how do you access a function on the main timeline from within a symbol?
Adobe should consider putting together a support page (or pages) just for folks migrating form Flash. In the materials I've encountered so far there seems to be a studied effort to refrain from mentioning Flash in any way. I imagine there are a lot of people out there like me who have a deep background in Flash coding, but are just getting started with Animate. We don't need help with most of the basic concepts, but we may still have some pretty basic questions about how to accomplish some things in Animate because our Flash knowledge is getting in the way.Hi Bill,
There are plenty of threads on here about scope, but here's one way to create a global variable:
// code on Stage.compositionReady
sym.myGlobalVar = 1;
Then, anywhere in your project, you can check/set that var like so:
sym.getComposition().getStage().myGlobalVar = 2;
And here's one way to create a global function:
// code on Stage.compositionReady
sym.myGlobalFunction = function(){
console.log('myGlobalFunction');
Then, anywhere in your project, you can call that function like so:
sym.getComposition().getStage().myGlobalFunction(); -
Can't get button in sub movie to link back to main timeline
Hi All.....
First, thank you for helping me! I am pulling my hair out. I
know there is an easy answer to this question, but I can't figure
it out.
I have my main timeline (Scene 1) and then on frame 5, I have
a movie that plays for about 70 frames (within itself). On the main
timeline it is only 3 frames long, and I have an action at the top
layer to stop at the first frame.
At the end of the 70 frame movie, I have a "next" button; the
action is in normal mode;
on (press) {
gotoAndPlay("Scene 1", 11);
I am ultimately telling this button to go back to the main
timeline (scene 1) and continue on with the next movie.
When I publish, the movie goes through just fine, gets to the
next button, I press it and it goes to the 11th frame of the that
same movie, instead of the 11th frame of the main timeline (scene
1).
Help! I appreciate it...let me know if I left anything
out...........
Aubryaubrycan wrote:
> Ahh!
> Thank you! It worked!
>
> You have saved me. :-)
better yet label the frame you like to target and target that
label
_root.gotoAndPlay("labelNameHere");
There is no scenes in SWF file upon export. So if you have 10
frame in scene 1
and 10 in scene 2, the frame 10 in scene two become frame
number 20.
The action sugested by FamousSeamus is not really correct
even tho it might work,
but as soon as you try to target frames across multiple
scenes, you can't refer to them
by their numbers unless it's one long scene only.
Best Regards
Urami
<urami>
If you want to mail me - DO NOT LAUGH AT MY ADDRESS
</urami> -
I was playing a game. Game response was sluggish. I pushed button to exit game and go back to main screen. Took several times to get a response from iPad. The response was a black screen with horizontal colored lines similar to horizontal roll on an old TV. Screen went black and will not come back on. Attempted sync, but iPad no longer shows up in iTunes. Help!
Have you tried a reset ? Press and hold both the sleep and home buttons for about 10 to 15 seconds, after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.
-
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,
CliffI worked with the problem last night and the solution I
started coming to involved creating my own custom document class
based off which extends MovieClip. My thought is that way I have
access to the initialization routine of the timeline itself and
that all of the elements on the main timeline should be
"properties" of my custom class.
Is this correct? Is there a down side to doing this & if
so what is it & why?
Also, just for my reference, the last time I did anything
with ActionScript I think I was using '_root' to target the main
timeline. WHat are the global variable names in AS 3? Is it just
'root' & 'stage' or 'Root' & 'Stage' or what? -
How to link from a movie clip to main timeline?
My problem first appeared very simple, but I have spent a
while on it and can't think how to solve it. I must say that I am
very much an amateur in designing in Flash and ActionScript.
I created a movie clip containing an embedded video and a
sound clip. In the main timeline I inserted the movie clip into a
keyframe. When I found the movie clip didn't play, I discovered
that the only way of making it play was to place a Stop action in
the keyframe of the movie clip, and also set the whole movie to
loop. The Stop action stopped the whole movie from looping, but
instead made the movie clip loop. If the keyframe is on frame 456,
how do I make it advance onto frame 457 once the movie clip has
finished running?
I've tried various ways around the problem, including placing
a button inside the movie clip to Go to and Play frame 457, but
instead it plays frame 457 in the movie clip.
Can anyone help me with this please?Hello,
You need to tell flash the "target" you want to play. If not
specified
it will think it is the target you are calling from which in
your case
is the movie clip.
So to go back and play one level up would be:
_parent.gotoAndPlay(457);
If the movie clip was inside another movie clip then it would
be:
_parent._parent.gotoAndPlay(457);
or you can just referent the root of the movie directly:
_root.gotoAndPlay(457);
Search the help file for timeline target and you should find
more about it.
Incubusguy wrote:
> My problem first appeared very simple, but I have spent
a while on it and can't
> think how to solve it. I must say that I am very much an
amateur in designing
> in Flash and ActionScript.
>
> I created a movie clip containing an embedded video and
a sound clip. In the
> main timeline I inserted the movie clip into a keyframe.
When I found the movie
> clip didn't play, I discovered that the only way of
making it play was to place
> a Stop action in the keyframe of the movie clip, and
also set the whole movie
> to loop. The Stop action stopped the whole movie from
looping, but instead made
> the movie clip loop. If the keyframe is on frame 456,
how do I make it advance
> onto frame 457 once the movie clip has finished running?
>
> I've tried various ways around the problem, including
placing a button inside
> the movie clip to Go to and Play frame 457, but instead
it plays frame 457 in
> the movie clip.
>
> Can anyone help me with this please?
>
> -
Attach a movieclip from the main timeline inside another movieclip.
I need help with the game I am working currently. On the main timeline Actions frame I have a loader class called myLoader. I attached that to a movieclip called currentSWF. I have a movieclip called SpinningCard in the library which I dynamically attached to the stage. Inside the SpinningCard movieclip there is another movieclip Card. In the Card movieclip I have 10 frames and on each frame I want to attach a different instance of the movieclip currentSWF. How can I do achieve that?
here's what I have till now...
On the main timeline Actions frame...
var loader:Loader=new Loader();
loader.load(new URLRequest("CardGraphics.swf"))
var currentSWF:MovieClip;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
function swfLoaded(e:Event):void {
currentSWF = MovieClip(loader.contentLoaderInfo.content);
addChild(currentSWF);
Inside the Card movieclip on the first frame I have this code...
var a1:MovieClip = MovieClip(parent.parent.getChildByName('currentSWF'));
CardFrame1.addChild(a1);
//CardFrame1 is an empty movieclip which is there on the frame 1 of Card Moveiclip.
I am getting error : Parameter must be non-null. How can I solve. Can anyone please help me.Hi Nabren
I'm also looking to load a library based movie-clip into a stage based movie-clip, so that I can inturn swap it with other movie clips to act as different pages (page2_mc etc) which will be used in different sections of the application to give chapters as such.
I've had a go at the above but can't get a result, though it did not throw an error. I also had a trace() on each side and both of those triggered.
The stage based mc I called pageMC and the content mc I called content the same as your example
trace('loader - cx');
var loader:Loader=new Loader();
var pageMC:MovieClip;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
function swfLoaded(e:Event):void {
pageMC = MovieClip(loader.contentLoaderInfo.content);
pageMC.name = "pageMC";
addChild(pageMC);
trace("Menu 4");
I'd appreciate some assistance. I would like to use internal MC's as I want to put the application to iOS and Android and believe by using movieclips I should be able to have some code with them whereas importing swf's I can't.
Thanks -
How can a button be turned back into regular object
Once an object is converted to a button how can it be changed back (have the button properties removed?) There doesn't seem to be an obvious way to do this, but I can't imagine Adobe hasn't allowed for this...
@Steve – yes, but only the active state will be converted and survive.
All other states (and their objects) will be removed.
I hope Adobe will change this in a future version. A good example for releasing states are MSOs (Multistate Objects) where you can release all states at once without losing objects.
@Jennifer – In InDesign a Button object can consist of max. 3 states:
"Normal", "Mouse Over" and "Click".
To retrieve all 3 states, have your Buttons Panel and your Layers Panel open.
1. Select your button
2. Go to the Objects menu chose Select => Contents
OR: go to the Layers Panel, flip open the tiny triangle on your Button object and select the state, eg. "[Normal]"
3. Now copy/paste to the page or hold down the alt key and drag out a copy of this state to the page
4. Ungroup the pasted object (states in essence are groups, even if they consist of one single object)
To retrieve the next state, go to your Buttons Panel, select the next state and repeat steps 3 and 4.
From my German UI of InDesign CS5.5:
Whole Button selected:
[Normal] State selected:
[Mouse Over] State selected:
[Click] State selected:
When working with states you'll never see all states at the same time in the Layers Panel.
Adobe should change that, too…
Uwe -
Button action to go back to main timeline movie container
i made a movie clip "container" on my main nav which pulls
every other page into it. i have a progressive preloader on the
portfolio section and if you click to go to another page while it
is loading, it spazzes out. so for the portfolio section i took the
buttons off the main nav and put them in the portfolio section. I
can't just put a script to load the new movie because the buttons
have brackets that move and close the word of the page you are on.
I need a script that says on release to go to and play a
label on the main nav with the movie container.
to pull the movies into the main nav i made a movie clip
container and put script on the buttons to gotoandplay a movie
which loads the new swf after is plays using this action:
_root.loader.loadMovie("port_remodel.swf");
i thought i could just use:
on(release){
_root.loader.gotoAndPlay("homel.swf");
in the portfolio section but it doesnt work.
please help if this makes sense!what do you mean by, "go to and play a label on the main nav
with the movie container"?
it us clear what it means to "go to and play a label on the
main nav", but it's not clear what a movie container has to do with
that statement. -
How do you transfer material from "events" to main timeline?
I am new at editing at iMovie so i am still learning. I began to edit my stuff in the "Events" and then noticed that a tittle for my video could not be transfered into the events so i started pulling stuff from the events into where the tittle was on the top. (hopefully that made sence) See? And i got to a point where it didn't let me move any more stuff over to the top. There was no error message or anything. I just couldnt move anymore. Why ? Please help! Thanks
-Macbook pro ; iMovie 2011It looks like the top window (which is called the Project Browser) has filled up, you might need to scroll down in that window to drag clips to the end of the timeline. But there's another way to do it too. You can select another piece of video down in the Event Browser, then hit the letter "E" for the Edit Tool. That will automatically take the selected video and add it to the end of your project without you have to drag it up to that window at the top.
-
Goto next frame in a movieclip from main timeline button
So what I have is a button (named Next) on the main timeline. I have a movie clip on that frame (on the main timeline) and the movie clip has 3 frames that I want to be able to cycle through using the "Next" button that is on the main timeline. How can I go about doing this?
Thank you,Thanks kglad! Works like a charm. :-)
I had already named the instance of the movieclip and button so I just needed to change the code to match and it's working great.
One other issue I've come up with now is that when it goes to the 3rd frame of the movieclip and I click next, it doesn't do anything. shouldn't it go back to frame 1 of the movieclip? -
Button on main timeline control movieclip
Hello,
I have a stop on my main timeline. At the stop I have a movieclip play. In the movieclip I will have a video play. After the video plays I have a button for the user to continue play until the end of the movieclip. Once the movieclip is done I want to resume back to a specific frame in my main timeline.
I can't figure out how to make this work. Anyone have any ideas?
Thanks in advance,
PaulNed,
Thanks for the reply and the help.
I actually got everything to work the way I need it to. I simply had my button in the movieclip continue play then at the end of the last frame, applied a little voodoo and I was all smiles after I tested my Movie. Here's what I did...
x_btn in movieclip (not on main timeline) -
x_btn.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler10);
function mouseDownHandler10(event:MouseEvent):void {
gotoAndPlay(41);
last frame in movie clip -
MovieClip(root).gotoAndStop(130);
Paul -
Button inside MovieClip don't work...?!
Hello,
I\m traying to create AIR for Android app & I have 2 MovieClips in the main timeline the first in frame 35 and the second in frame 99 with the name of quary_mc. Inside the second movieclip there is a button with the name of sID_btn. When i addEventListener in frame 1 of the main timeline it display:
Error #1009: Cannot access a property or method of null object reference
This is the code:
quary_mc.sID_btn.addEventListener(MouseEvent.CLICK, displayData);
function displayData(evt:MouseEvent):void
trace("Hello");
Regards,You will be unable to add the event listener to the button until frame 99 when it actually exists.
Alternatively, you can just add the button on frame 1 at an alpha of 0 and then set it to 1 at frame 99. However, it will still get mouse input so you will need to set quary_mc.visible = false on frame 1 and quary_mc.visible = true on frame 99 to solve that issue. -
Trying to make the switch from AS2 to AS3 and like many
before me, becoming confused.
I've laid out three movieClips on my main timeline (named,
"main") and spaced them five frames apart, nice and tidy, like I
like to do. Each frame on the main timeline containing a movieClip
has been given a unique frame label. My problem is, I want to have
the movieClips jump to the next targeted movieClip on the main
timeline after clicking a button, or upon entering the last frame
of its predecessor, in some cases. In AS2 the was easy to do this
was by using the gotoAndPlay function and targeting to the_root
timeline. Now I can't figure out what to do. I can make any button
inside a movieClip target a specific frame within that same mc, but
cannot make a jump to the main timeline to play the next movieClip.
What am I missing here? I'm a noobie at AS3 and fumbling my
way forward. (should be obvious now) Is there a simple way to refer
back to the main timeline, which is only one level up? What am I
missing?
Here's as far as I got with the AS3 code within the mcs:
stop();
cont5_mc.addEventListener(MouseEvent.CLICK, onClick2);
function onClick2(event:MouseEvent):void
trace("test");
cont5_mc.buttonMode = true;
The trace function runs true so it's a matter of telling the
player how to get to the main timeline and frame label.
TIA for your help, all you flashy genius . . . Speak to me
like I am a three year old. -grin-
thokittskglad:
Thank you for your instant reply. I see you sent it out last
night. Really appreciated. Got my button in movieClip1 to refer
back to movieClip2 on the main timeline with your help but now am
presented with the issue of having the last frame of movieClip2
automatically taking the viewer back to the main timeline to begin
playing movieClip3, located on frame label "gsm".
Again, I know this should be easy, but conceptually I am
having a problem with how to do this. I don't have a button to
attach the AS3 to and this new syntax is confusing to me. Nor do I
want this to be a button based decision on the viewer's part. How
do I attach this automatic jump back to the main timeline, frame
label "gsm"? By an enterFrame event, which seems old school AS2? or
stage.addEventListener? Is enterFrame even the way to do it
anymore?
Lynda.com tutorials are great but I'm struggling with this.
TIA
Thomas
Maybe you are looking for
-
Dreamweaver MX 2004 - "An Unidentifed Error has occorred." - Please help!!
Hi folks. I have scoured the internet for a fix to this problem. Most of the posts I read are unanswered or the solution does not work. I am hoping a guru reads mine and has the magic answer - I am ready to chuck the project altogether if I can't fin
-
Ipod shuffle 2ng gen . No Set Up Assistant wnats to init an unknown disk
My e-mac with latest OS and Itunes will not recognize the ipod shuffle 2nd gen on any USB. Mac says it has detected a corrupted ipod. I have done the 5 R's, the Ipod reset utility to no avail. My ipod mini 1st gen and ipod nano current gen all work f
-
External monitor as second desktop
Hello I have a mbp late 2011 and I run os X 10.9.5. I run an external monitor (BenQ T903) beside my macbook and I would love to be able to access the external monitor the way you access a 2nd desktop: by using three fingers and swiping them to the r
-
Hi, Can you please provide the Std web services available for Purchase order creation and Goods receipt creation? Is any link where i can check for this related information? Thanks Srini
-
Soundtrack Needs to be Lengthened - How
I converted a 1080i video to 24P and need to bring the soundtrack aiff file into sync by slowing it down 4%. I searched the forum and tried every suggestion with no success. The aiff file is 9m:00 seconds, and it needs to be 9:18. I bring it into ST,