controlling a movieclips timeline from within itself


How do I control the timeline from a movieclip from within itself

I made a menubutton for a school assignment.
To make it, I created a movieclip of the button's graphic, with on the second frame the button again but with the menu open (haven't added anything in it yet).

Opening the menu is as easy as
Code: menu_mc.addEventListener(MouseEvent.CLICK,openMenu); function openMenu(evt:Event):void{ this.menu_mc.gotoAndStop(2); } Inside of the menu is a CLOSE button (just a movieclip) that should, when clicked, take menu_mc back to frame one.

A simple gotoAndStop() doesn't work. Using a parent to issue the order to the movieclip doesn't work either.

-How can I make menu_mc go back to frame 1 when clicked on inside itself

note: I am also open to the suggestion that I'm just going the wrong way about this. I'm really learning as I go here.

Posted On: Thursday 25th of October 2012 09:50:44 PM Total Views:  258
View Complete with Replies

Related Messages:

flash as3 Custom slider for controlling movieclip animation   (198 Views)
hi I need, flash as3 (In Flash cs3 version ) Custom slider for controlling movieclip animation.
Flash [HELP] [REQUEST] Keyboard tapping actionscript to controlling flash game speed   (176 Views)
I am currently doing a project in college and I have trouble on actionscripts. Apparently, I am not good in scripting and I really need some help out here. I am wondering is there any script that allow me to play a game such as a car racing game/running game by just controlling the speed by tapping the keyboard key. the faster I tap the faster the car/character runs. Any recommendations
AS3: controlling child frame while parent playing/TWEENING   (138 Views)
EveryBody, I stucked again, I have a MovieClip named "all_Pages" inside of it has timeline tweening on its child "pg" which has sets of pages as child of pg on frames Here is the problem I am trying to execute the code written on all_pages first frame which is 6th frame; while executing all_pages.gotoAndPlay(1); // timeline tweening i.e if ( == "txtField1") {; all_pages.gotoAndStop(1); } else if( == "txtField2") {; all_pages.gotoAndStop(1); } else if ( == "txtField3") {; all_pages.gotoAndStop(1); } else if ( == "txtField4") {; all_pages.gotoAndStop(1); } but everytime "all_pages.gotoAndPlay(1)" executes it plays its first frame( 6th frame only). I want it to play pages at specific frame with its parent tweening
Movie clip button controlling main timeline issue   (138 Views)
I was wondering if I could get some help. I'm in the process of designing this site as a portfolio for my art and am in the process of creating and laying out the galleries. My idea was to create movie clip animated buttons that would react to the roll over stuff. I got that part to work the way I wanted it. But now, I can't seem to figure out how to put a "Gotoandplay" type of code on the buttons so that the timeline would jump to the appropriate frame and play. (I put an "on(release) gotoandplay" on it the way I would put it on a button but it never responds. I have a couple of buttons that work fine with a "geturl". so I thought a "gotoandplay" would work fine. but I must be doing something wrong. If this can be figured out in a way that I can easily use it for all buttons with just the frame number needing alteration, that would be best. After you click the splashpage door jpg, there will be a piece of paper on the floor. That is a button which should trigger the animation that starts at frame 114. When clicked, the page lifts up and spread open to two pages. But it never reacts Any ideas Here's my site: Thank you ahead of time.
controlling flv playback component skin x and y   (185 Views)
Hi , Is it possible to control the x and y of the video component skin I can see Code: which will trace out the actual .swf file of the skin, but not sure how i can adjust the x and y. I mainly want to adjust the y position of the skin and I've done quite a bit of research but can't find this issue specifically. Anyone
controlling a list of movie clips   (184 Views)
hi im trying to get a button to move a list of movie clips up and down how would u go about this e.g i have a button at the top of the stage and a button at the bottom and when the top one is clicked it moves up one movie clip till last one is hit. and if the bottom one is hit it moves down one until it hits the last one any help im not very good at explaining my self sorry
controlling external mp3 sound clips with keyboard commands   (196 Views)
Hi all, I am new to kirupa and new to as3! I'm trying to control my mp3 sound clips with keyboard commands and have managed to get this to work with internal sound clips: //************************************************** ************* var note2:b = new b(); btn2.addEventListener(MouseEvent.MOUSE_DOWN,playNo te2); function playNote2(event:Event){ playSound(note2); } function playSound2(soundObject:Object) { var channel:SoundChannel =; } //************************************************** ************* //btn2 btn2.addEventListener(MouseEvent.MOUSE_UP, bOut2); btn2.addEventListener(MouseEvent.MOUSE_DOWN, bDown2); function bDown2(event:MouseEvent):void { btn2.gotoAndStop(2); } function bOut2(event:MouseEvent):void { btn2.gotoAndStop(1); } btn2.buttonMode = true //keyboard****************************************** *********** stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown2); function myKeyDown2(e:KeyboardEvent):void{ if (e.keyCode == Keyboard.W){ playSound(note2); btn2.gotoAndStop(2); } } stage.addEventListener(KeyboardEvent.KEY_UP, myKeyUp2); function myKeyUp2(e:KeyboardEvent):void{ if (e.keyCode == Keyboard.W){ btn2.gotoAndStop(1); } } however I cannot seem to get this method to work using external sound clips. here is my code so far: var note1:Sound = new Sound(); note1.load(new URLRequest("un.mp3")); btn1.addEventListener(MouseEvent.CLICK,playSound); function playSound(e:MouseEvent):void{; } //hovers btn1.addEventListener(MouseEvent.MOUSE_UP, bOut1); btn1.addEventListener(MouseEvent.MOUSE_DOWN, bDown1); function bDown1(event:MouseEvent):void { btn1.gotoAndStop(2); } function bOut1(event:MouseEvent):void { btn1.gotoAndStop(1); } btn1.buttonMode = true //keyboard stage.addEventListener(KeyboardEvent.KEY_DOWN, myKeyDown); function myKeyDown(e:KeyboardEvent):void{ if (e.keyCode == Keyboard.Q){ playSound(note1); btn1.gotoAndStop(2); } } stage.addEventListener(KeyboardEvent.KEY_UP, myKeyUp); function myKeyUp(e:KeyboardEvent):void{ if (e.keyCode == Keyboard.Q){ btn1.gotoAndStop(1); } } I have searched all over the forums and the internet and cannot seem to find an answer for my issue, any help that one could offer would be greatly appriciated!
controlling loaded external swf   (188 Views)
it should be very very easy but i can't understand what i did wrong. i loaded an external SWF, and i want to control it's current frames.. how can i do it i'll be very
Flash keyboard event and controlling timeline   (286 Views)
I am very new to AS3. I have not wanted to migrate to it, but have been forced to do it for a current project which uses AS3 components. I am creating a slideshow (full screen) and will be creating each slide as a separate SWF file. I have been successful in loading and unloading the slides (SWF's). I need to use the arrow keys to move through the slides. I have that working, but want to load the slides without hard coding everything in each frame of the main timeline. I am using a var to get the currentFrame value. is well exept that if the left arrow key is pressed and the main timeline is on FRAME 1, the playhead seems to think it can go backward to frame zero and then into negative numbers with each press of the left arrow key. I need to be able to stop the timeline from advancing backward at frame one. I have tried several methods that either do nothing or cause the right arrow key to work unpredictably and keep returning to FRAME 1 no matter what if statement and evaluation I perform. Here's the current code on FRAME 1 of the main swf: Code: stop(); stage.displayState = StageDisplayState.FULL_SCREEN; import; import flash.display.Loader; import; import; var swf:MovieClip; var loader:Loader = new Loader(); var defaultSWF:URLRequest = new URLRequest("slide1.swf"); loader.load(defaultSWF); addChild(loader); var currentFrameNumber:Number; currentFrameNumber = currentFrame; function setup() { stage.addEventListener(KeyboardEvent.KEY_DOWN, useKeys); } setup(); this.stage.addEventListener(Event.ENTER_FRAME, checkFrame); function checkFrame(e:Event):void { if (MovieClip(root).currentFrame
controlling public embeds (turn on/off)   (195 Views)
This isn't directly AS3-related, but I'm not sure of the best mechanism to do this, so apologies if this isn't in the right forum. We have a video player that we will soon allow others to embed freely with our content. We need some sort of mechanism to be able to turn off the embedding by either a certain video (globally, all embeds of that video), or by a specific embed (one instance of a specific video on a specific site). For instance, if one of the photographers we work with comes back to us and says that we can't allow their work to be embedded on another site, we'd like to be able to turn that specific video off globally in embeds. Instead of the video, an image directing the viewer to our site (where they *can* see the content) might be shown. In another instance, some other site might be showing one of our videos in a manner we don't feel is appropriate, or in violation of our terms. We'd like to be able to turn that specific video off on that specific site only. Can anyone think of a good way to approach this The only thing I can think of is to generate and include a unique ID with each piece of embed code, which we'd have to then track and control via some sort of backend tool. Each time one of our videos is shown, their server has to connect with ours in order to validate the unique ID based on its state (on/off), and then the player is given the OK to play. Another options that would give us much less control, but wouldn't require the same level of technical wizardry, would be to maybe disallow access from a specific domain via the .htaccess file. Any other thoughts
Extending events, passing parameters to event handlers and controlling MCs   (236 Views)
Ok, I assume this issue has been covered to death, but I'm still lost. In my application, I have numerous buttons which, when clicked, will activate numerous movie clips. To avoid having to create individual event ahndler functiosn for each button, I would like to be able to pass parameters to the event handler so it knows which movie clip to activate. In other words, here's what I'd like to do: Code: for (i=0; i
controlling an object placed by a class   (222 Views)
sorry if duplicated... i have two movieclips on stage, one load as a class an mc with animation, the other load a can i send the message, comunicate both clases to let the button start the animation
Problem controlling an embedded SWF   (238 Views)
everybody! I'm having some trouble with a video (FLV) that I am trying to play while inserting an other layer above it. I want my output SWF file to contain the whole video inside. The only method of doing so was to convert the FLV file into a SWF file, and embedding the SWF: [Embed(source="file.swf")] The embedded video is uncontrollable. I can't stop or mute the embedded swf.... Even before adding it to the stage, the video's sound is heard. Am I doing something wrong Could there be a different method to embed a FLV file so my output SWF file will contain it (and there won't be a need to load it through a URL).
controlling divs in dreamweaver with flash buttons   (254 Views)
Hi all, thanks in advance for your help. This is the situation: I have created a website in Dreamweaver and it functions entirely upon hiding/showing divs, using the appropriate behavior (very basic html knowledge on my part So it's just one page in which layers are alternatively hidden and shown. I have created a set of flash buttons (they are all in one file, because a very basic Flash animation is supposed to make them fade in one by one when another flash button inserted in the html page is activated). Now, I have two problems regarding this: 1. On page load, this "animation" (the buttons which fade in successively one after another) appears automatically, even though it is located inside a div which is invisible by default and should only be visible at the trigger of a button. This is not acceptable for me because it is a submenu which should be invisible at first. 2. Let's suppose item #1 is resolved. Different html divs are supposed to appear/be hidden when rolling over each of these Flash buttons, and I haven't been able to find out how to do this. I know I should work with the Flash code in order to do this, "on (rollover) {//no idea what to place here to call the Javascript function from dreamweaver which I don't know how to create, if it's not applied directly to an object//} So if anyone can help me out with this, I'd really appreciate it! Don't hesitate to ask for clarifications... thanks! ps: This is the site: www(dot)wise-ls(dot)comlu(dot)com (I'm working on expanding the width, that's why it looks funny The section in question is "soluciones", and what I want to do is replace the text links with Flash buttons.
AS3:KEEP DYNAMIC BUTTONS DOWN when controlling image galle   (265 Views)
, please help me on this last part of my project. I'm sure it's really simple but I can't seem to figure it out: I have dynamically loaded buttons (thumb) and images (galImage) going to container_mc and full_mc containers respectively. I can't get the buttons to stay down when pressed using MOUSE_DOWN and MOUSE_UP. When I use CLICK instead, they all stay pressed. Please help! //Load Gallery Images and Thumbs for (var i:Number = 0; i <; i++) { //Load Gallery Images var galImage:Loader = new Loader(); var galUrl =[i]; galImage.load(new URLRequest(galUrl)); //Create Thumbs var thumb = new ThumbButton(); thumb.image = galImage; = i; thumb.y = 20*y_counter; thumb.buttonMode = true;,0xFFFFFF);,0);,0,15,15);; y_counter++; //Add Thumbs to Container container_mc.addChild(thumb); thumb.addEventListener(MouseEvent.MOUSE_DOWN, showFull); thumb.addEventListener(MouseEvent.MOUSE_UP, stayClear); function stayClear (ev:Event):void {;,0xFFFFFF);,0);,0,15,15);; } function showFull (evt:Event):void { full_mc.x = 420; full_mc.y = 100; full_mc.addChild(;,0xFFFFFF);,1);,0,15,15);; }
movieclips, parenting and armatures   (102 Views)
Hi . I'm currently experimenting with adding things to armatures. My aim is to try to figure out how to attach a DisplayObject to an armature, to allow it to move properly with that armature. For instance, putting a gun in a figure's hand. I'm running into some basic problems though that I'd hope you can help with: 1. How do I convert an instance into a new library object, within flash This is only somewhat related, but I'm experimenting with manually adding a gun movieclip as a child of one of the hands (which I could later modify by script) and because my hands are instances of a generic circle symbol, the gun appears on all instances of it. 2. General issues with relating an armature and movieclips. See my thread here for info: What I'm generally having an issue with, is figuring out which armature is inside which movieclip, as the armature class doesn't seem to support the parent property. A solution I can think of so far, is using appropriate names of the armature and the movieclip, and comparing those to link them together. But I'm not seeing how well this would work with multiple instances of a movieclip and it's contained armature. 3. Issues with referencing nested movieclips. Something I haven't quite figured out. I have a thread about it here: Been having problems accessing movieclips which are only present on a specific frame of another movieclip. I'm still trying to figure out other conceptual problems and bring this all together. Getting armatures working properly seems to be a constant uphill slog, not helped by the deafening silence from every AS3 forum on the internet. If anyone can provide any help, advice, vague hints, guesses, links to useful sites you saw one time, or anything else that might be helpful, please do post!
Stringing together movieclips after preloader   (126 Views)
, I've been struggling with this seemingly simple task. I have a fla that starts with a preloader that works properly. I then addChild a movie and it plays. I would like to have another movie load on a separate upper layer (so you can see the movie below it, like a background) with three different movies that can be advanced by a button. Here is my code so far. It loads the preloader up, then advances to drawing the graph. From here I've been adding a conditional checking to see if the movie is done playing -- playGraph.addEventListener(Event.ENTER_FRAME,check done,false,0,true); was the tip I was given -- but if I use an if statement, it loops over and over Here's the code. Hopefully it makes sense. PHP Code: stop(); this.addEventListener(Event.ENTER_FRAME,loading);//Eventlistener functionloading(e:Event):void{ vartotal:Number=this.stage.loaderInfo.bytesTotal;//TotalsizeofFLAfile varloaded:Number=this.stage.loaderInfo.bytesLoaded;//Totalbytesloaded preloader_logo.bar_mc.scaleX=(loaded/total)*100* 1.5;//Growtheprogressbar--1.5 //addedtomakethebar //slightlywider preloader_logo.loader_txt.text=Math.floor((loaded/total)*100)+"%";//Loadpercentagetxt if(total==loaded){//checkwhetherloadedornot; //removeeventlistenerandplayifso play(); this.removeEventListener(Event.ENTER_FRAME,loading); stop(); } vargraph=newGraph_mc(); graph.x=280; graph.y=180; addChild(graph); } } } From the addChild I assume that I want to do 'if graph is done playing, start with the first part of the movie', but it gets caught in a loop if I trace 'done'. I'm at a loss.
Functionality question, best way to deal with multiple movieclips inside of one.   (286 Views)
, I have a functionality question, hopefully someone can give me their advice on how to do this best. I have three movie clips on my stage. Each one of those movie clips contains two child movie clips. I want to fade in/out the children movie clips so that one is visible at a time. What I figured was to make a main movie clip Code: movieclip_holder1 and inside of that, have Code: box1 and box2 and then fade box1 in and out as often as I'd like. Then of course repeat these steps for my other two main movie clips Code: movieclip_holder2 and Code: movieclip_holder3 Is there a better way to accomplish this
Overlapping movieclips when zooming   (194 Views)
I have function to zoom in and out a movieclip in one frame. Problem is that when i click on a button for another frame, where i have another picture, this from frame one, overlap. Code: koszula0.addEventListener(MouseEvent.ROLL_OVER, zoomIn_0); koszula0.addEventListener(MouseEvent.ROLL_OUT, zoomOut_0); function zoomIn_0(ev:MouseEvent):void{ this.setChildIndex(this.getChildByName(, this.numChildren-1);, 1, {scaleX:3, scaleY:3}); } function zoomOut_0(ev:MouseEvent):void{, 1, {scaleX:1, scaleY:1}); } i have no idea how to unriddle this... thx. for any idea.
controlling an external SWF   (256 Views)
I can't find a way to control an external SWF in AS3 like I used to be able to in AS2. This used to be a real simple way (among others) in AS2: loadMovieNum("yourMovie.swf",1); onMouseDown = function(){ _level1.stop(); } onMouseUp = function(){; } Unfortunately this has been abolished in AS3 . To load a SWF externally from a separate SWF file (on a separate CPU) in AS3, you now must now use a URL request along with a load request. However, the SWF is tied into this loader object of which's class does not contain "play", "stop", "currentFrame", "nextFrame", "prevFrame", "gotoAndPlay", "gotoAndStop", etc..... According to the help panel, you can target any of the loader's child's methods by virtue of calling "loader.content".... but it doesn't work. When I trace my "loader.content".... all I get back that it is an [Object Main Timeline] when I would expect it to be [Object MovieClip] if it were to have the methods I need. Inevitably.... I need to do all sorts of gotoAndStop / gotoAndPlay functionality with external SWFs on another CPU. I have a nice XML server running successfully... I just hit this brick wall.... any suggestions thx