Play a frame in timeline from inside 2 movieclips.

Hi. I have tried everything but it just isn't working.
On my main timeline I have a MC called "rainbow." Inside "rainbow" I have a MC called "greenbow."
Inside "greenbow" I have a MC called "meetbtn2"
I want it to play frame 134 on the main timeline when you click "meetbtn2."
my code inside greenbow is as follows:
meetbtn2.onRelease = function () {
_root.gotoAndPlay(134);
however it doesn't work! is it because i am inside two MC's?
I have also tried
_root.rainbow.greenbow.meetbtn2.onRelease = function () {
_root.gotoAndPlay(134);
any help? Thanks!

i believe you miss understood me. the actionscript and the MC are on the same frame on the same timeline.
however
on the main timeline: the MC "rainbow" doesn't appear til frame103
inside "rainbow": the MC "greenbow" doesn't appear til frame 48
inside "greenbow": the movieclip that acts as the button"meetbtn2" doesn't appear til frame 11
however all instances have been named correctly and all actionscript is on the same frame-space as its objects....

Similar Messages

  • Change Stage Frame From Inside MovieClip?

    How Do I Change Stage Frame From Inside MovieClip?
    Heres my code so far:
    hh.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
    function fl_MouseClickHandler(event:MouseEvent):void
        gotoAndStop(2);
    i tried (root).gotoAndStop(2); but i got an error , #1061 ..
    Thanks in Advance...
    ASAP would be nice..

    well your a smart *** now arnt you   Haha..
    I missed 1 painful word in that line of code thanks heeps..

  • Changing stage timeline from inside a movieclip button

    I create a movieclip button, and I want to change main timeline from it. what should I do ?
    Is it useful to use MovieClip(root).gotoAndPlay(...) ; ?
    Is there any other way to change main timeline?

    Example:
    Add something to trigger the event in the child:
    dispatchEvent(new Event("eventTriggered"));
    In your parent swf, listen for the event using a listener for the child with a corresponding event handler...
    childName.addEventListener("eventTriggered", eventHandler).
    function eventHandler(event:Event):void {
        trace("child dispatched an event");
         // gotoAndPlay(etc);

  • 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.

    if your buttons are true buttons use:

  • StageWebViewBridge from inside MovieClip [HELP]

    I'm trying to implement stageWebViewBridge from inside of a movieclip ..   It's generating this issue because stage is null.     Does anyone know how to implement this inside a movieclip ?
    Error: StageWebViewDisk.initialize( stage ) :: You must provide a valid stage instance
    // this is our main view
    var view:StageWebViewBridge;
    //**** STAGE WEBVIEW BRIDGE
    /* init the disk filesystem */
    StageWebViewDisk.addEventListener(StageWebviewDiskEvent.END_DISK_PARSING, onInit );
    StageWebViewDisk.setDebugMode( true );
    StageWebViewDisk.initialize(stage);

    well your a smart *** now arnt you   Haha..
    I missed 1 painful word in that line of code thanks heeps..

  • Play timeline from inside symbol

    I saw a post on this issue but was not sure where to put the code I read there. I would appreciate if you can tell me how exactly to edit this code line to work
    I am inside a symbol "oneAnimation". At the end of the animation "backBtn1" appears. Inside this button, I have added an event on click. I want the stage timeline to play from the label "startNumber" when this button inside the symbol is clicked.
    So far it's not jumping back to the main time line.
    sym.getComposition().getStage().play("startNumber");

    The label seems to be in that symbol, so all you need is sym.play('startNumber');
    You code is to play a label on the same timeline.
    See my blog on edgehero.com
    http://www.edgehero.com/articles/scope

  • Controlling the root timeline from inside a MovieClip

    [preface] I'll apologize in advance. I'm a designer, not a
    developer. I know very little about actionscript so if you
    can help me out, please pretend like I know nothing.
    [/ preface]
    I just need actionscript to check the value of a variable
    when the end of a movie clip is reached and then call an action.
    Here's what I've got and it doesn't work. Please don't laugh.
    if (p == 1){
    tellTarget (_root) {
    play();
    else if (p == 0){
    stop();
    (the "stop" on the "else if"
    is referring to the movie clip's timeline, not the root
    timeline... in case you're wondering)
    Any help would be greatly appreciated. Thanks!

    No it's not a school project. Good guess though. It's
    actually a self-promo piece for the ad agency I work for. I'm an
    art director expanding my horizons. I would take a class or run
    through one of the good actionscript books but unfortunately, I
    don't have time.
    Thanks for the help again kglad.
    btw, I've used tellTarget successfully in a few projects in
    the last few months. I'm using Flash 8.

  • Play animation on main timeline from within a mc

    this is probably the most basic question of the day, but how
    do you get the main timeline to play from within a mc?
    say I have a mc called jolly_mc and within it is an action on
    it's timeline at keyframe 10. That action needs to jump to a
    certain frame on the main timeline and play.
    I've tried
    _level0.gotoAndPlay(492);
    _root.gotoAndPlay(492);
    _level0.gotoAndPlay("animation");
    _root.gotoAndPlay("animation");
    and non of these work, can anyone clear the haze in my day :)
    thanks in advance.

    _root.mainText = "Obtain 0.2 grams of Ascorbic Acid using the
    Spattula.";
    This line is fine. It's fine to have full-stops inside a
    string. It doesn't effect the code.
    this._root.bkg.gotoAndStop(3);
    Your pathing is a little strange in this line. As you can't
    go any further up the hierarchical tree than _root, if you're
    referencing objects via the root, it should be the first object in
    the target. So if you want to refer to your target using an
    absolute reference(ie by using root) then your line should read:
    _root.bkg.gotoAndStop(3);
    alternatively, since your AS is in a movieclip inside bkg,
    you can refer to your target using a relative reference like so:
    this._parent.gotoAndStop(3);
    this._level0.bkg.power.powerOne.gotoAndStop(2);
    similar story here. _level0 is the highest up you can go, so
    putting this before it is a little strange. Fixing this using
    absolute referencing:
    _level0.bkg.power.powerOne.gotoAndStop(2);
    or:
    _root.bkg.power.powerOne.gotoAndStop(2);
    or relative referencing(assuming the movieclip where the AS
    is is not power):
    this._parent.power.powerOne.gotoAndStop(2);
    if it is power then you could have simply written:
    powerOne.gotoAndStop(2);
    yes, the syntax you suggested for trace is correct.
    but anyway, i don't think that any of this advice is helping
    you with your problem. sorry i can't see the solution with the
    information you've provided. maybe upload?
    how'd you go with sourcing a flash book?

  • Attempt to move main timeline from inside a movie clip breaks menu buttons.

    I am attempting to have the main timeline move from a stopped position over a movie clip to frame 1, where my start menu is.
    The code I'm using does move the timeline but in doing so it somehow breaks the 4 buttons I have in frame 1.
    My code in the movie clip:
    stop()
    function replayMovie(event:MouseEvent):void
    MovieClip(parent).gotoAndStop(1);
    Menu.addEventListener(MouseEvent.CLICK, replayMovie);
    My code in frame 1 of the main timeline:
    stop();
    function bo(event:MouseEvent):void
    gotoAndPlay(21)
    SoundMixer.stopAll()
    espesp.addEventListener(MouseEvent.CLICK, bo);
    function ho(event:MouseEvent):void
    gotoAndPlay(31)
    SoundMixer.stopAll()
    espeng.addEventListener(MouseEvent.CLICK, ho);
    function yo(event:MouseEvent):void
    gotoAndPlay(41)
    SoundMixer.stopAll()
    engesp.addEventListener(MouseEvent.CLICK, yo);
    function go(event:MouseEvent):void
    gotoAndPlay(51)
    SoundMixer.stopAll()
    engeng.addEventListener(MouseEvent.CLICK, go);
    The error output when I use my Menu button at the end of the movie clip.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at SSubjunctiveProjNewgrounds_fla::MainTimeline/frame1()
    at flash.display::MovieClip/gotoAndStop()
    at SSubjunctiveProjNewgrounds_fla::Esp_5/replayMovie()
    Any help would be greatly appreciated.

    For the sake of space, I'll leave out all the package declarations and class declarations and just talk about the functions.
    First, the Game class, it has two functions.  The first one is the constructor function and it launches at the beginning of the game:  First the Game function:
    public function Game():void
    //Game code goes here
    }//Game
    We want to listen for someone to click the mouse on the MenuPage, so lets create a new MenuPage and add a listener to the button contiained within it.
    public function Game():void
    menuPage = new MenuPage;
    menuPage.startButton.addEventListener(MouseEvent.CLICK, startGame);
    addChild(menuPage);
    }//Game
    You will notice that before I declared a variable var menuPage:MenuPage, but that's all I did was declare it.  I didn't really make a new instance of it, I just set aside space for it.  In the first line within the Game function, I'm actually turning that variable into a new instance of a MenuPage.
    We don't have a picture of this imaginary menuPage instance, but lets' assume that in our MenuPage MovieClip in the library, we created a SimpleButton called startButton.  Here, I'm adding an EventListener that patiently waits for someone to click that button.  Once we receive that event, Flash is told to call the startGame function.
    As you get better at this, you'll get into custom events, and the eventListener for the button will exist in the MenuPage class file, or even in another class file that you create just for the button.  Something like StartButton.as  But for now, we can do it as above.
    Now the startGame function:
              public function startGame(evt:MouseEvent):void
    //Remove the start Page
    //Add the zombie
    //Add the gun
    }//startGame
    And we'll replace those comments with real code.  It follows along with what we just did above.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    And we also want to clean up some by removing the menuPage, and throwing out the eventListener.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    menuPage.startButton.removeEventListener(MouseEvent.Click,startGame);
    removeChild(menuPage);
    }//startGame
    Now our Game class is complete.
    The Zombie Class
    public function zombieWalk(evt:Event):void
    this.addEventListener(Event.ENTER_FRAME,zombieWalk);
    this.x = this.x + 10;
    }//zombieWalk
    Notice we've added a function to the Zombie Class.
    The first function adds an EventListener to the zombie.  We can use the word this and actionScript knows we're talking about the zombie that the class is written for.  This listener fires off every frame.  If our FLA file is set to 12fps, then 12 times every second it will call on the zombieWalk function.
    The zombie walk function moves the zombie 10 pixels to the right every time the function is called.
    On a more advanced level, you'll want to add animation in the MovieClip to move the zombie legs.  You'll also want to use Timer events to space out how often the funtion fires and not ENTER_FRAME events.  And you'll want to use a static constant to establish how far the zombie moves.  We have it now set to 10 pixels, but that can get irritating if we want to change that value later.  But again, baby steps.
    And finally, the Gun class
    public function Gun():void
    this.addEventListener(MouseEvent.CLICK, fireGun);
    }//function
    public function fireGun(evt:MouseEvent):void
    this.gotoAndPlay(2);
    }//fireGun
    First we add an EventListener for when someone clicks on the gun.  Once this happens, the listener calls on the fireGun function.
    The fireGun function takes advantage of the frames within the Gun MovieClip.  Say we have three frames in the Gun MovieClip.  The first is just a picture of the gun.  The second is the gun with a flash coming out of the nozzle.  And the third is the gun at rest again.  The line this.gotoAndPlay(2) sends the gun to the second frame with the flash graphic.
    For this to work, each frame in the Gun MovieClip has to have some stop and play commands.
    But.. you said no code on our timeline!! Liar!
    I know.  This is the exception.  You will need basic stop() commands and gotoAndPlay commands to loop animations.  Any MovieClip that has more than one frame will need something to control it.
    So our Gun MovieCLip has the following:
    Frame 1: stop();
    Frame 2: no actionScript... and I mean nothing, not even the words, "no actionScript"
    Frame 3: gotoAndStop(1);
    This will loop the gun to the beginning and wait for the next time the user clicks the gun.
    Advanced features of the Gun class might include a Bullet.as sub-class that creates a bullet MovieClip to fly across the screen.  Sound to play when the shooting takes place.  Object collision detection to see if the bullet hits the target.  And a means by which a custom event will tell the Game.as class that a zombie has been hit and it should be removed from the stage.
    As you go down the rabbit hole of ActionScript 3, you will find yourself at a point where it's just a matter of getting the syntax right for all the built in functions and classes.  Arrays, Loaders, casting variable types.. all that stuff will come.
    I hope this has been helfpul.  It's been on my to-do list for a long time.  When I first started out, no one could provide me with basic answers for how all these classes and whatnot worked.  After teaching myself AS3 for 2 years and reading a gabillion books, I think I've gotten to a point where I'm pretty comfortable with it all.

  • 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

    I 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?

  • Controlling main timeline from a movieclip

    I am helping someone (using MX 2004) who is trying to send
    the playback head to different scenes via a dropdown menu in a
    movieclip. We have tried many variations but still can make it
    work.
    Any help is greatly appreciated!

    don't use the goto functions and don't use scenes to
    navigate. use frame labels and the goto methods:
    _root.gotoAndPlay("scene2_frame1"); // <- label that
    frame.

  • Inside movieclip script?

    Hey, I am wondering how I can use a script inside a movieclip outside the movieclip, for an example. The first frame in the movie clip:
    var RoXYZ
    RoXYZ = 3.14;
    And outside the movieclip it's:
    circle._visible = true;
    RoXYZ = 3.1415926535
    if(RoXYZ == 3.14){
    circle._visible = false;
    What i am trying to do is that if the movieclip reaches a specific frame a script is triggered. Is this possible?

    From inside a movieclip you can talk to the _parent object/timeline using "_parent" to target it.  So if you wanted to tell the _parent to move to a certain frame, inside the movieclip you could use...
    _parent.gotoAndStop(some frame);
    Or if there was a function in the _parent you could use...
    _parent.someFunction();
    or maybe...
    _parent.someFunction(RoXYZ); // passing the RoXYZ variable as an argument
    And if you needed to target the main timeline from inside some buried movieclip, you can use _root instead of _parent.

  • SimpleButton inside MovieClip Symbol

    I want to create various button panels contained in separate
    MovieClip(symbols) created and laid out in a movie clip. I want to
    use flash button objects on each panel. Then swap panels at will
    that bring the buttons along with the panel so all I have to do is
    call..panel1 = new panelOne; panel2 = new PanelTwo, etc...If I
    create a class for each button with its functionally built in how
    can I access the button from the panel? I figure I have to import
    the buttons in the panel class before it will work? I tried
    panel1.getChildAt(x) but that didn't seem to work. Do I have to
    dynamically add the buttons as children to be able to access them
    with actionscript.
    Thanks!

    From inside a movieclip you can talk to the _parent object/timeline using "_parent" to target it.  So if you wanted to tell the _parent to move to a certain frame, inside the movieclip you could use...
    _parent.gotoAndStop(some frame);
    Or if there was a function in the _parent you could use...
    _parent.someFunction();
    or maybe...
    _parent.someFunction(RoXYZ); // passing the RoXYZ variable as an argument
    And if you needed to target the main timeline from inside some buried movieclip, you can use _root instead of _parent.

  • Access XML array inside MovieClip. How ?!

    Hello,
    Ok, I have a code to load Multiple XML files at once and save it to an array named xmlDocs like this:
    //each xml file to load
    var xmlManifest:Array = new Array();
    //the xml for each file
    var xmlDocs:Array = new Array();
    //the xml file with all the xml files to be loaded.
    var RSSWidgetRequest:URLRequest = new URLRequest("xml/rss-widget.xml");
    var urlLoader:URLLoader = new URLLoader();
    var docsXML:XML = new XML();
    docsXML.ignoreWhitespace = true;
    //when COMPLETE is loaded run function loadDocs
    urlLoader.addEventListener(Event.COMPLETE,loadDocs);
    urlLoader.load(RSSWidgetRequest);
    //load the docs
    function loadDocs(event:Event):void {
    docsXML = XML(event.target.data);
    //m21m is the name space defined in my doc m21m:feed... you don't need one.
    var m21m:Namespace=docsXML.namespace("m21m");
    //get all the feed nodes
    var feeds=docsXML..m21m::feed;
    for (var i:int=0; i < feeds.length(); ++i) {
      //add the feed to the xmlManifest array
      xmlManifest[xmlManifest.length] = feeds[i].attribute("feed");
    //load the xml for each doc
    loadXMLDocs();
    //load all the XML files
    function loadXMLDocs() {
    if (xmlManifest.length>xmlDocs.length) {
      var RSSURL:URLRequest = new URLRequest(xmlManifest[xmlDocs.length]);
      var urlLoader:URLLoader = new URLLoader();
      var xmlDoc:XML = new XML();
      xmlDoc.ignoreWhitespace = true;
      urlLoader.addEventListener(Event.COMPLETE,getDoc);
      urlLoader.load(RSSURL);
      function getDoc(event:Event) {
       xmlDoc = XML(event.target.data);
       //hold all the xml of each doc in an array
       xmlDocs[xmlDocs.length] = xmlDoc;
       loadXMLDocs();
    } else {
      trace(xmlDocs)
      //do something when all xml is loaded
    How i can access xmlDocs array difinte on main timeline from insted MovieClip...?!
    Regards,

    It does not work. I used this code to display the data:
    var xmlList:XMLList;
    var xmlData:XML = new XML(MovieClip(this.parent.parent).xmlDocs[0].data);
    xmlList = xmlData.class10;
    sId10_btn.addEventListener(MouseEvent.CLICK, displayData);
    function displayData(evt:MouseEvent):void
              for each (var grade:XML in xmlList)
                        if (myTextField.text == grade.st_id.text())
                                  content10.sName10.text = grade.st_name;
                                  content10.sQuran10.text = grade.quran;
                                  content10.sIslamic10.text = grade.islamic;
                                  content10.sArabic10.text = grade.arabic;
                                  content10.sEnglish10.text = grade.english;
                                  content10.sMath10.text = grade.math;
                                  content10.sChemistry10.text = grade.chemistry;
                                  content10.sPhysics10.text = grade.physics;
                                  content10.sBiology10.text = grade.biology;
                                  content10.sSocial10.text = grade.social;
                                  content10.sSport10.text = grade.sport;
                                  content10.sComputer10.text = grade.computer;
                                  content10.sNesba10.text = roundNumber(Number(grade.nesba), 2);

  • Moving to a frame in Movieclip timeline from the main timeline

    I am in the learning process. Working with FlashCS5 and AS3.
    Please bear with me if the issue appears to be too simple for you. Placed a movieclip(mcassessJohn) on the main timeline and moved to the frame labelled "johnFeedback" in the movieclip timeline using the following actionscript code.
    mcassessJohn.addEventListener(MouseEvent.CLICK, onJohnClick);
    function onJohnClick(evt:MouseEvent):void {
       mcassessJohn.gotoAndPlay("johnFeedback");
    This works fine. However problem starts when I place a button "questionJohn" in the movieclip(mcassessJohn) time line at frame "johnFeedback" and try to move to another frame by clicking the button and using the following actionscript code;
    questionJohn.addEventListener(MouseEventClick,onClick);
    function onClick(evt:MouseEvent):void {
      gotoAnd Play("johnFeedback");
    Placed the above code in actions layer in the movieclip timeline at frame "johnFeedback". I had placed the button also in the movieclip timeline at Frame "johnFeedback in layer buttons. No compiler error.No runtime error. Just nothing happens when I click on the button "questionJohn".
    Would appreciate if you can let me know where I am going wrong.

    Thats because if u assign the listeners to a parent movieclip it will not pickup listener assigned to its child.
    A work around is put a invisible btn inside mcassessJohn movieclip on frame 1 and assign onJohnClick function to that.
    And one more thing, i think u r trying to perform same operation on both the btns
    http://www.darshanrane.com

Maybe you are looking for

  • Larger thumbnail folder in vault than in library--Why?

    I have aperture 3.4.1 and recently realized that I had accidentally imported several movies and a few photos as masters.  I relocated the masters so that the movies and photos are all now referenced, and not stored in the aperture library.  This caus

  • YouTube/File Size

    I have an 8-minute clip I want to upload to YT, among other sites. At that length, it becomes a rather large file to try to put on YT. So the question is: If I print to video in Final Cut then recapture that footage, can I beat the File-size sheriff

  • Burn dual layer to 2 dvd5 discs

    according to the manual that when we put in the dvd5 disc to burn dual layer project dsp4 will automatically ask us to put in the 2nd dvd5 after the first layer as if we are burning into dtl tape but I have no luck laterly. please help thankx JP

  • FLOAT TO TIME STAMP CONVERSION

    Hi Folks, I am getting some pain while i am converting from float values into timestamp... I have a T1 table and one columns data type as float ...i want convert that float values into time stamp.. Exp: field1(float datatype) 48045.4352222 45065.4452

  • Do 802.11n routers support SRX?

    I currently have a WRT54GX (with SRX). Some computers that need to connect to the router are currently too far away to connect via plain vanilla 802.11g. I got SRX cards for them and they work great. I now want to upgrade to a pre-N router, but I don