Movie clip inside a movie clip
Hi everybody,
I'm creating a slideshow with Flash, like the ones done with Powerpoint. I would like to create a movie clip inside another movie clip, that is, say I have a clip called button1, and when I click it, frame number 2 in this clip is displayed, and then more information appears. Inside this frame 2, there are other clips, for example an X button to close and return to frame number 1 in the clip button1, as the image shows:
What I have done is convert the button1 text into a movie clip, and assign an action to it:
on (press){
gotoAndStop(2);
When frame 2 is displayed, I would like to click to the X-button to get back to frame number1, so what I've done is, again, convert it into a movie clip and assign the following action:
on (press){
_root.gotoAndStop(1);
But this doesn't work. I've been trying as well changing other things, but no way... At first I thought it had something to do with the _root or _parent, but now it looks as when using gotoAndStop in the "parent" button (button1), no actions work for the "child" buttons.
I've loaded the fla and the swf files here, just in case someone would like to check.
Thank you very much in advance for your help. I've been checking other posts, but apparently I couldn't find the appropriate info.
"_root" is only used to reference the very first level of your flash file. Right now you are telling flash to go to the second frame in your root timeline but you want to go to the second frame in your button1 timeline.
Change the code that is on the X-button to
on(press){
gotoAndStop(1);
Remove the "_root" and it should work.
If it still doesn't work, make sure the button has an instance name of "button1" and use this code.
on(press){
_root.button1.gotoAndStop(1);
This is using "_root.button1" as the 'address' of your movieclip and it wont matter where the code is.
Similar Messages
-
Target a movie clip inside a movie clip
When I go to the symbol editing mode on the first movie clip, I drag the instance of my 2nd movie clip to the stage. I then am duplicating my work, (it is over lapping) not sure what I am doing wrong here? and I am finding that my child movie clip is taking on the parent movie clip properties. How do I stop this from happening? I thought they are to remain independent? Any help is greatly appreciated. TY.
Will the child timeline be independent of the parent timeline. My pend_mc is the child and has taken on the hand_mc properties. Also why is there brackets around some and not the others? Thank you so much for your time.
-
Targeting a movie clip inside a movie clip inside another movie clip with a twist
Thanks to ned. Im able to link to a movieclip inside a movieclip.
Unfortunately one of the movieclips now are a scrollbar and scroll. Now the actionscript isnt working?
Has anyone wany ideas? Please
cal.onPress = function() {
gotoAndPlay(2);
message1.contentMain.message.total = unit1;
ThanksI wish i could say it wasnt named message 1 but it is. The code works without a scroll bar.
As soon as i put the target in a scrollbar it doesnt work?
This is my code for the scrollbar if thats the problem? maybe
scrolling = function () {
var scrollHeight:Number = scrollTrack._height;
var contentHeight:Number = contentMain._height;
var scrollFaceHeight:Number = scrollFace._height;
var maskHeight:Number = maskedView._height;
var initPosition:Number = scrollFace._y=scrollTrack._y;
var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
var left:Number = scrollTrack._x;
var top:Number = scrollTrack._y;
var right:Number = scrollTrack._x;
var bottom:Number = scrollTrack._height-scrollFaceHeight+scrollTrack._y;
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-scrollFaceHeight);
scrollFace.onPress = function() {
var currPos:Number = this._y;
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
dy = Math.abs(initPosition-this._y);
contentMain._y = Math.round(dy*-1*moveVal+initContentPos);
scrollFace.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
btnUp.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y+speed<maskedView._y) {
if (scrollFace._y<=top) {
scrollFace._y = top;
} else {
scrollFace._y -= speed/moveVal;
contentMain._y += speed;
} else {
scrollFace._y = top;
contentMain._y = maskedView._y;
delete this.onEnterFrame;
btnUp.onDragOut = function() {
delete this.onEnterFrame;
btnUp.onRelease = function() {
delete this.onEnterFrame;
btnDown.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y-speed>finalContentPos) {
if (scrollFace._y>=bottom) {
scrollFace._y = bottom;
} else {
scrollFace._y += speed/moveVal;
contentMain._y -= speed;
} else {
scrollFace._y = bottom;
contentMain._y = finalContentPos;
delete this.onEnterFrame;
btnDown.onRelease = function() {
delete this.onEnterFrame;
btnDown.onDragOut = function() {
delete this.onEnterFrame;
if (contentHeight<maskHeight) {
scrollFace._visible = false;
btnUp.enabled = false;
btnDown.enabled = false;
} else {
scrollFace._visible = true;
btnUp.enabled = true;
btnDown.enabled = true;
scrolling(); -
Referencing _root.Button from a movie loaded inside another movie
I have the following situation
MainMove.swf is doing a loadmovie of SecondMovie.swf
The Button that loads SecondMovie.swf also disables other buttons in MainMovie.swf
on (release) {
_root.intro_btn.enabled = flase;
loadMovieNum("SecondMovie.swf", 2);
How do I Re enabled the Buttons in MainMovie.swf from a Button within SecondMovie.swf???
Using AS2 is this current project
ThanksYou might be able to use the same line of code setting the enabled value to true. If you have not locked the root of the loaded swf, the _root should till be pointing at the main movie.
_root.intro_btn.enabled = true; -
News theme, clip inside of a clip
On the demo on the apple site for the news theme there is a boy talking with a video in the upper right of a windmill. How can I do this in iMovie?
This is a picture in picture effect. Drag the PIP video onto another clip and select the effect in the shortcut menu that appears.
-
How do i reference a movie clip instance name from inside child movie clips.
I have a label I am referencing form a movie clip inside the movie clip which contains the "label_2."
Here is the code I used:
MovieClip(parent.parent).gotoAndPlay("return_2");
Now I need to reference a instance name of a movie clip in side the same scene.
What would the code be?You should probably start by reading the docs and/or google:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/Event.html
http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9 b90204-7fca.html
http://www.google.com/search?hl=en&q=AS3+events
Once you got the basics down, look into creating/using your own custom events:
http://www.google.com/search?hl=en&q=AS3++custom+events
http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html
Event dispatching and event handling is one of the most important things about ActionScript. The sooner you get into them, the better. -
How can I load an external SWF into a movie clip that's inside other movie clip?
Hi.
I creating my first flash (actionscript 3.0) website but I'm
stuck with a visual effect I want to create.
I have a window on my website called contentWindow. Every
time you click a button this window is supposed to leave the stage,
load the requested content and return to the stage.
The sliding window is a movie clip with 83 frames, 21 to
enter the stage, 21 to leave the stage again, 20 for nothing (its
just to simulate the loading time) and 21 to return to the stage.
Now my goal is, when the user clicks on a navigation button,
the window exits the stage, loads an external SWF with the content,
and then returns to the stage.
I've the "window" movie clip with an instance name of
"contentWindow". Inside there is another movie clip with an
instance name of "contentLoader". The content that the user
requested should appear inside the "contentLoader".
Now, when the contentWindow leaves the stage, I get this
error message:
quote:
TypeError: Error #1009: Cannot access a property or method of
a null object reference.
at rwd_fla::MainTimeline/trigger()
If I switch
"contentWindow.contentLoader.addChild(navLoader);" for
"contentWindow.addChild(navLoader);" it works fine, but the
external SWF doesn't move with the window.
How can I load an external SWF into a movie clip that's
inside other movie clip?Hi,
Recently, I have been putting together a flash presentation.
And I am just wondering if the following might help you, in your
communication with the said swf file:
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
onComplete);
function onComplete(event:Event):void
event.target.content.thinggy_mc.y -= 100;
Not the best example, but this allows you to target a mc
within an external swf file. I think if you look up this code, you
will have an answer ;)
Kind Regards,
Boxing Boom -
Button no longer works when inside a Movie Clip?
Again I turn to the almighty Adobe forums for help...
So basically, I've had this problem for over a day now, and I've posted on Experts-Exchange.com... to no avail really.
So here we go:
I have a button in a Flash project I've made. It's used to jump to another place on the root timeline, labelled "Why". It used to work perfectly.
I have now placed the button inside a movie clip (it has to be in an animated sequence), but now it no longer works. It appears to work fine, the rollover state works and all. But when clicked it does nothing.
The code I use to work the buttons goes on the main timeline, the code for this button is:
mc_anim_backdrops_menu.btn_subsection1.onRelease = function() {
gotoAndStop("Why");
_global.swfloaded = "";
Why does it no longer work? and what can I do to fix it?
The question is posted here over at Experts Exchange - http://www.experts-exchange.com/Software/Photos_Graphics/Web_Graphics/Macromedia_Flash/Act ionScript/Q_24888850.html
what we've tried there is tracing the problem. The code seems to be pointing to the right place, but none of the actual function works.. as you'll be able to see if you open up the attached file (and change it's extension from .txt to .fla to get it working)
So would someone be able to open it up, have a look and tell me what's wrong? Because I'm stumped. And frustrated.My guess is that you have a scope problem. By putting the button inside a movieclip you have made the buttons scope the same as that clip.
So if you add a trace inside the release event handler, what do you get?
trace("My current scope is: "+this);
I'm guessing it is "_level0.mc_anim_backdrops_menu," right?
So since you are using the global function of gotoAndPlay() it is looking for that label in the current timeline and not finding it.
You should probably use the MovieClip method and specifiy which timeline it should look in.
_root.gotoAndPlay("Why");
_level0.gotoAndPlay("Why")
_parent.gotoAndPlay("Why");
both would probably work. I would never use the first two, other than to make sure that there wasn't something else going on... -
Going Back to the main frame, from inside a movie clip time line.
In flash CS5 I want to go back to the main time line, from inside a movie clip button, so when i click the the movie clip it goes to another frame on the main time line..
Can anyone help me?
Thanks
Daniel Derrickyour can use _root to reference the main timeline from anywhere though that can lead to problems if your swf is loaded by another swf. because of that eventuality, it would be better to use a relative path back to the main timeline.
so, from a movieclip's timeline (when the movieclip is on the main timeline), you can use _parent to reference the main timeline.
but even better would be to use no code on that movieclip's timeline and keep all your code on one timeline (the main one). -
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? -
Editable text inside draggable movie clip
I am dinamically creating textfields inside movie clips.
Those movie clips are all dragabble (startDrag).
The problem is that those textfields are supposed to be
editable (input type) but once I attach startDrag to them, it's
impossible for them to get the focus, hence they are not editable.
I tried manually setting the focus on release, but it didn't work
(Selection.setFocus(_root.movieclip.textfield)).
Any help will be rrrrreally appreciated :DWell there does have to be some pixels in the bg clip! (Got
to tease you just a bit, because I run into this ALL the time.)
Some how folks don't take the method at its word.
createEmptyMovieClip() does just that. It creates and empty movie
clip. There are no pixels in it so there is nothing to onPress.
Also I've got a little trick for you – you didn't ask
for it, but it is still free. :)
If you use the MovieClip class' method for
createEmptyMovieClip() it will return a reference to the newly
create clip. You can assign that reference to a variable and use it
again and again. To my eye it makes the code easier to read and
maintain. So your code would change to something like:
var curClip=this.createEmptyMovieClip("mc"+i,1000+i);
curClip.createEmptyMovieClip("bg",100);
curClip.createTextField("myText",2,20,20,"auto","auto");
curClip.myText.text="default value";
curClip.bg.onPress=function(){
this._parent.startDrag();
and so on.
Also I personally think getNextHighestDepth() is a disaster
waiting to happen so I personally never use it. -
Next/previous inside the movie Clip.
Hi,
I try to made Next/previous inside the movie Clip.But When I try to this next previous animation inside movie clip but not working.
I have attached both sample files.
The files are on following link:
http://www.4shared.com/file/125612766/28c58a99/fla.htmlyour code was _root.gotoAndStop(contor+1); but your root level only had 1 frame. I took out the "_root." and it worked fine. Here is the working file.
-
Tooltips not working inside Embedded Movie Clip but works on main stage
Hey,
I have a movie clip that is a navigation window and I am trying to have some tooltip hover over the buttons inside the navigation window.
If I create a button on the main stage it hovers and works fine but if I create the same clip inside the embedded navigation window the tooltip does not show up. I do not have any error messages but it is not there that I can see.
Any ideas?
Thanks!Even you place your mc within another clip for example NavWindowMC:
Write the code in the maintimeline as
import fl.transitions.easing.*;
import fl.transitions.*;
NavWindowMC.mc.addEventListener("mouseOver", mouseRollOver);
NavWindowMC.mc.addEventListener("mouseOut", mouseRollOut);
NavWindowMC.mc.addEventListener("mouseMove", mouseMove1);
var tooltip:Tooltip = new Tooltip();
tooltip.txt.text = "Design";
tooltip.x = stage.mouseX;
tooltip.y = stage.mouseY - NavWindowMC.mc.height;
function mouseRollOver(e:MouseEvent):void {
addChild(tooltip);
var myTween:Tween = new Tween(tooltip, "alpha", Regular.easeIn, 0, 1, 0.5, true);
function mouseRollOut(e:MouseEvent):void {
removeChild(tooltip);
function mouseMove1(e:MouseEvent):void {
tooltip.x = stage.mouseX;
tooltip.y = stage.mouseY - NavWindowMC.mc.height; -
Unable to expand movie clip inside of scroll
I inherited a .fla file with a scrolling thumbnail image
movie clip that moves horizontally inside of a "scroll" behind a
mask, with the use of right and left buttons. < > The
thumbnail movie clip is much wider than the movie's dimensions. I
think it was made in Flash 5. I added about 30 new thumbnails to
the movie clip for my client, but now it won't expand anymore.
Before, all I had to do was put the thumbnail into the edge of the
clip and it would expand to include it. I can get the invisible
right and left "scroll" movie clips to scroll even beyond the movie
clip by adjusting the numbers in the ActionScript for those two
instances. I am not a "programmer type" so this probably is hard to
understand. If I try to change the width of the movie clip in the
properties box it comes up with an "invalid size and position"
error. Actually I think all it would do is stretch-distort the clip
anyway, which is not what I want. (if I put in a lesser number it
squishes the clip). I just want more space right and left.
Any ideas?
-SueHow do I attach a file to this? All I see is a button to
attach code. Sorry, I've rarely use this forum.
-Sue -
TextArea link inside a move clip
The actionscript calls textArea to have a rollover action and
then link to another site when released. However when placed inside
a movie clip the rollOver works but not the link. I need someone to
tell me what syntax I'm missing. It's gotta be possible.
Please help.
Here's the Code:
var feature_styles:TextField.StyleSheet = new
TextField.StyleSheet();
feature_styles.setStyle("backgroundColor", 0x000000);
feature_styles.setStyle("mainbody", {color: "#333333",
fontFamily: "FFF Hero", fontSize: "8", display: "inline"});
feature_styles.setStyle("a:link", {color: "#333333",
fontFamily: "FFF Hero", fontSize: "8", display: "inline"});
feature_styles.setStyle("a:hover", {color: "#FF0000"});
background1_mc.textbox_1.links_1.label.condenseWhite=true;
background1_mc.textbox_1.links_1.styleSheet = feature_styles;
background1_mc.textbox_1.links_1.wordWrap = true;
background1_mc.textbox_1.links_1.html = true;
background1_mc.textbox_1.links_1.label.selectable=false;
background1_mc.textbox_1.links_1.editable=false;
background1_mc.textbox_1.links_1.vScrollPolicy = "off";
background1_mc.textbox_1.links_1.hScrollPolicy = "off";
background1_mc.textbox_1.links_1.embedFonts = true;
background1_mc.textbox_1.links_1.text += "<a
href=\"Fall08images/downloads/FALLOUT_1600x1200.jpg\"
target=\"_blank\">1600 x 1200</a><br>";
_global.styles.TextArea.setStyle("backgroundColor" , "none");
_global.styles.TextArea.setStyle("borderStyle", "none");
_global.styles.TextArea.setStyle("borderColor", "none");
stop();Try:
background1_mc.textbox_1.links_1.htmlText += "<a
href=\"F...
Maybe you are looking for
-
Did you know you can Edit Buttons??
OK, who knew that you can EDIT the buttons on the bottom of the screen in You Tube and Music? Can rearrange or replace with different buttons. Is this New News, or was everyone aware of this already and I'm late for the party? Gunny
-
SOME Windows machines can't browse for Mac printers
I have a Mac mini with an HP 5940 attached to it. I also have three Windows machines hanging around: my laptop, my wife's laptop, and my wife's desktop. My laptop and my wife's desktop are running XP Pro SP2. My wife's laptop is running XP Media Cent
-
Can't reinstall OS X, will download but does not restart
So my internal harddrive was screwed. First, I booted with Mac's recovery, erased everything and tried to reinstall OS X. It downloaded but didn't restart like it was supposed to and just took me back to the utilities screen. Next, I installed OS X
-
Why i cant log onto apple store from my apple touch everything is correct but cannot connect
trying to log on to itune and cannot everything is right
-
Video recording Blackberry 8900 resolution
Recently bought an 8900 curve as an upgrade to my contract and it says on the Blackberry website that the 8900 curve records video at 480x352 resolution. Looking in the options on video recorder the most I can set it to is 240x180. I have noticed tha