Referring to functions on the stage from a movieclip.

First of all, I'd like to thank you to anyone who takes their time to read this. I registered to this forum for the sole purpose of getting help to this one issue of mine, as I found most issues were solved in here. By reading my problem (and hopefully responding) you're doing me a huge favour. Thanks in advance.
I just started "coding" in AS3. By "coding", I actually mean trying around with features and generally trying to grasp the vast amount stuff you can do with this software of. I have some coding experience, however the way   Flash likes to hide code snippets all over my project does tend to confuse me. Not knowing where I tried putting the code and/or rewrote some other stuff keeps me sorta busy.
I'd also like to apologize for the title, if it in any way confuses you. Shortening down my problem to a single sentence was hard, please keep that in mind.
Anyway, my issue is this:
Messing around with movieclips inside movieclips, I've keep encountering the error "1120: Access of undefined property onTimerComplete." I do realize that this error generally is caused by not having defined an instance correctly or not having it defined at all - an error beginners tend to make.
Nonetheless, I'm not trying to refer to an instance/symbol, I am trying to call a function defined on the stage from within a movieclip that also is placed on the stage.
I've been reading huge amounts of text/articles and how-to 's, but they all seem to only touch the subject lightly or simply going in head-first - becoming far too complicated for me (a beginner) to grasp.
So, trying to sum my questions up into something that looks like a tl;dr:
- What's up with levels, "_root" and referring to functions like in the older versions of flash?
Flash tells me to use some display-package instead of _root, when I use that... (I do realize the article is from Flash 5.0)
- How do you refer to a function defined on the stage, from inside a movieclip? (The function is a timer, that is supposed to make the mother-movieclip continue to the next child-movieclip.)
Please, I really don't know how to define my problem any further than this. Ask as many questions as you would like, I really appreciate any help I can get.
- Mattimussi

click file/publish settings/flash and tick "permit debugging".  highlight the line number referenced in the error message.  (and, use:
Calling:
stop();
MovieClip(root).startTimer();
Defining:
var myTimer:Timer = new Timer(2000, 1);
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE,onTimerComplete);
myTimer.start();
function onTimerComplete(event:TimerEvent):void{
play();
//myTimer.stop();
function startTimer():void{
trace("startTimer function was executed");
myTimer.start();

Similar Messages

  • How to target a label on the stage from a loaded composition

    from EdgeCommons I'm using EC.loadComposition to load another website into a container within EA.
    Now, from a button inside this loaded composition I would like to call a stop function to target a label on the main stage of the EA file.
    sym.getComposition().getStage().stop("scene4"); does not work.
    It think it has to go outside of sym because the composition container is actually an iframe.
    Thank you

    Hi,
    I think you may have replied to my post accidentally. I had asked a question regarding javascripts that could target the stage from a symbol, not about coloring book apps.  However I have made one in Flash, here is the page I made (don't laugh, I never finished it).
    http://boogerbunch.com/home.html
    Here is a link to the forum I used to get the Info to build it, I would think the process would be very close in edge.
    http://www.kirupa.com/developer/mx2004/coloringbook.htm
    Good luck!
    >>> scottsalter0 <[email protected]> 3/1/2013 10:29 AM >>>
    Adobe Community ( http://forums.adobe.com/index.jspa )
    Re: How to target a label on the stage from a div embedded in a symbol?
    created by scottsalter0 ( http://forums.adobe.com/people/scottsalter0 ) in Edge Animate - View the full discussion ( http://forums.adobe.com/message/5113759#5113759 ) 
    Hi there,
    I noticed your Edge Colouring Page post on the Adobe Forums.
    For my University work, I need to create a colouring page using Adobe Edge Animate. Is it possible if you could post a tutorial or step-by-step guide on how to do this please?
    Many Thanks
    Reply to this message by replying to this email -or- go to the message on Adobe Community ( http://forums.adobe.com/message/5113759#5113759 )
    Start a new discussion in Edge Animate by email ( mailto:[email protected] ) or at Adobe Community ( http://forums.adobe.com/choose-container!input.jspa?contentType=1&containerType=14&contain er=4823 )

  • Accessing display object on the stage from another class

    I've googled this to no avail, I've only found how to manipulate the stage itself and not a display object on it, and I'm noob enough to not be able to figure it out from there. :/
    I have a movie clip on the main timeline with instance name displayName. I created a button that should change what frame displayName goes to (in order to...did you guess it?! diplay the Name of the button. Awesome. )
    So I am trying to write the code in a reusable fashion and have the buttons all linked to a class called GeoPuzzle. Inside GeoPuzzle I instantiate a touch event and run the code. However, the function has to be able to change displayName in the main part of the timeline and, of course, the compiler says displayName doesn't exist because I'm in a class and I'm talking about the stage.
    Here is the simplified code in the class:
    package  com.freerangeeggheads.puzzleography {
        import flash.display.MovieClip;
        import flash.events.TouchEvent;
        public class GeoPuzzle extends MovieClip {
            //declare variables
            public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
                //set parameters
                this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
            public function GeoPuzzle (): void {
            public function geoTouchBeginHandler (e:TouchEvent): void {
                   e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
                   //some other methods
                   nameDisplay.gotoAndStop(e.target.abbrev);
            public function geoTouchEndHandler (e:TouchEvent): void {
                //some other methods
               nameDisplay.gotoAndStop("USA");
    The lines in bold are my problem. Now this code doesn't actually execute as is so if you see an error in it, yeah, I have no idea what the problem is, but it DID execute before and these lines still gave me trouble so I'm trying to troubleshoot on multiple fronts.
    How can I tell displayName to change it's current frame from within display object class?
    Thanks!

    if displayName is a GeoPuzzle instance, use:
    package  com.freerangeeggheads.puzzleography {
        import flash.display.MovieClip;
        import flash.events.TouchEvent;
        public class GeoPuzzle extends MovieClip {
            //declare variables
            public function setInitial (abbrev:String, fullName:String, isLocked:Boolean):void {
                //set parameters
                this.addEventListener(TouchEvent.TOUCH_BEGIN, geoTouchBeginHandler);
            public function GeoPuzzle (): void {
            public function geoTouchBeginHandler (e:TouchEvent): void {
                   e.target.addEventListener(TouchEvent.TOUCH_END, geoTouchEndHandler);
                   //some other methods
                   this.gotoAndStop(this.abbrev);
            public function geoTouchEndHandler (e:TouchEvent): void {
                //some other methods
               this.gotoAndStop("USA");

  • How to refer to a Label on the Stage from within a Symbol

    Hi Edgefriends,
    I'm working on a project in Edge Animate, however I have about zero experience with JavaScript and I can't seem to get this working without it so I hope someone can help me to get this done.
    Below you see the code I need help with. It's part of a Symbol situated on the Stage. What I need it to do is to play from a Label ('subFontsTitels') situated on the Stage-level. I've tried a lot of posibilities but with no (satisfying) results. Could you please help me?
    Part of the code:
    Symbol.bindElementAction(compId, symbolName, "${_Button}", "click", function(sym, e) {
    // play the timeline from the given position (ms or label)
    sym.getComposition().getStage().sym.play('subFontsTitels');
    // insert code for mouse click here
    //Edge binding end

    hmmm it doesn't seem to solve the problem yet. I'll paste the full code attached to the symbol, maybe there's a problem with the whole combination of the code:
    Code
    Symbol.bindElementAction(compId, symbolName, "${_Button}", "mouseover", function(sym, e) {
    sym.stop("over");
    //Edge binding end
    Symbol.bindElementAction(compId, symbolName, "${_Button}", "mousedown", function(sym, e) {
    sym.stop("down");
    //Edge binding end
    Symbol.bindElementAction(compId, symbolName, "${_Button}", "mouseup", function(sym, e) {
    sym.stop("up");
    //Edge binding end
    Symbol.bindElementAction(compId, symbolName, "${_Button}", "mouseout", function(sym, e) {
    sym.stop("normal");
    //Edge binding end
    Symbol.bindElementAction(compId, symbolName, "${_Button}", "click", function(sym, e) {
    // play the timeline from the given position (ms or label)
    sym.play("subFontsTitels");
    //Edge binding end
    The symbol's name is SubTekstTitels and it's located directly on the Stage. The label "subFontsTitels" is located on the Stage aswell. I hope this will help getting this done.

  • Reaching a movie on the stage from inside another movie clip

    I'm trying to reach a body of text which i turned into a movie clip which is on the main stage, and have it scroll up/down whenever it rolls over the designated hot spots. Here's what i have.
    stage.addEventListener(MouseEvent.MOUSE_MOVE,down1,false,0,true);
    function down1(e:MouseEvent):void {
         if (mouseX>=0 && mouseX<=42 && mouseY>111.1 && mouseY<146.1) {
              stage.addEventListener(Event.ENTER_FRAME,scrolldown1);
         } else {
              stage.removeEventListener(Event.ENTER_FRAME, scrolldown1);
    function scrolldown1(e:Event):void {
         if(MovieClip(this.root).resume_txt.y > 219) {
              MovieClip(this.root).resume_txt.y += 5;
         } else {
              this.removeEventListener(Event.ENTER_FRAME, scrolldown1);

    Can you explain the purpose bhind these lines...
         if(MovieClip(this.root).resume_txt.y > 219) {
              MovieClip(this.root).resume_txt.y += 5;
    It seems as though if it is >219, it will move until the mouse moves out of the region.  Is there any specific aspect of it that you can pinpoint as not woking?.

  • How to resize the stage from the top instead of the bottom?

    Hi  I am trying to resize the stage in Flash CS4 from the top instead of the bottom, as I left too much space at the top of the stage and don't need the stage to be so big.  By default Flash resizes from the bottom.
    So is there a way of resizing from the top?
    Failing this, is there a way of moving all the symbols/objects in my project so that I don't create a motion tween but just move the objects for all of the frames in the project (i have quite a few tweens in the project)?
    Thanks
    Nick

    the built in Stage class has two handy properties...
    Stage.width and Stage.height

  • How to call javaScript function in the form from Action:Tab buttion in workspace

    Hi,
    I want to trigger JavaScript function that I have written in form from Action: buttons in workspace user's account.
    Is there any way that if i hit a button on action bar, it fire a javascript function.
    Reason is: I dont want to place button on the form to perform any action on the form. I want to take control of the form from these buttons. Like submit, edit a form, etc, etc..
    Please let me know if i couldnt explain it properly.
    regards
    Sunil

    Sunil, you want to look at the "Customizing the LiveCycle® Workspace ES User Interface" document at http://help.adobe.com/en_US/livecycle/9.0/customizeworkspaceui.pdf.  The workspace is a Flash component.  For ES4 there's an option to run the workspace in HTML5 which might be more productive long-term.

  • What is the proper syntax to hide a div on the stage from within two nested symbols?

    Hi everyone, I have recently started to use Adobe Edge and had some prior experience with Flash.
    I have a button with a click action inside two symbols that should hide a symbol placed on the stage, which in turn its is parent symbol.
    I tried using the following code but it didn't work:
    sym.$("Step1").hide();
    Thank you!
    Nuno

    I've got a similar issue and I thought I'd piggyback on this thread since I can't get your suggestions to work.
    Here's what I've got in my file -
    stage / fullRadial symbol / smRadial symbol / gold_btn element
    When you click gold_btn I want to hide a different symbol inside of fullRadial call measuringContent. This is the latest code I've tried within the gold_btn element -
    On click:
    sym.getComposition().getStage().getSymbol("fullRadial").play("Gold Corner");
    sym.getComposition().getStage().getSymbol("fullRadial").getSymbol("measuringContent").hide ();
    It plays my Gold Corner label just fine, but I've I can't get the hide to work with anything I've tried.
    Thanks for any help you can give.

  • Accessing stage from nested movieclip

    I have the following code nested in a movieclip, how can I reference the stage correctly from that movieclip?
    stage.addEventListener(KeyboardEvent.KEY_DOWN, reactToArrowKeys);
    function reactToArrowKeys(keyEvent:KeyboardEvent):void
         if (keyEvent.keyCode == 37)
              trace("Left Arrow pressed.");
         else if (keyEvent.keyCode == 39)
              trace("Right Arrow pressed.");

    there's never a situation that requires code be nested in a child movieclips and there are good reasons to avoid any significant (eg, more than a stop() ) code on child movieclips.

  • How to call function in the plugin from javascript?

    Hi,
    I have some function inside my plugin which i want to call from javascript. Is it possible? Sorry, im new to plugin programming.
    For example, i have plugin with function func() which i want to call from external javascript. In what way i will be able to achieve this?
    Thanks.

    Thank you sir for the help.
    Is it possible to assign ID to function and specifying that ID during executeAction call in script?
    Like at the time of executeaction call we will specify pluginID and functionID as parameter so that function will execute from the respective plugin. Is it possible ?
    Thanks.

  • How do I refer to the stage from a class?

    I have a class that places objects on stage with addChild(obj) it allowes me to position objects using pixels( say obj.x = 10; obj.y= 50; ) just fine but if
    I try this:  obj.x = stage.stageWidth / 2;  I get a message that I Cannot access a property or method of a null object reference

    The stage property is only available to objects that are currently on the display list. Your best bet is probably to pass a stage reference to the class when you instantiate it.

  • Why can't I call the function in the swf from the javascript?

    Hello,
    I have an html file that calls the function in swf file. In the swf file, I registered the function to be called using ExternalInterface.addCallback, as the book says.
    And I put this swf file in the html file using <object> tag and attempted to call the function using this object's id attribute.
    But every time to run this file, what I see is the error message such as "test1.show is not a function".
    Why is it?
    Please anyone help me. I am enclosing my work file. It's very simple one.
    Thank you.
    Daniel.

    It is entirely possible your college has decided to block certain websites. It's easy to do.

  • How to remove a loaded image on the stage from a symbol containing a button?

    1st the setup:
    General map is loaded
    2. On a click event, an larger image of the region is loaded with the following code (thanks to Joel's demo). On mouseover the name of the county appears and on click a popup (symbol) shows some info.
    $('<img id="region1" width="310" height="475" src="images/region1.png" usemap="#region1">'+'<map name="region1">'+...
    '<area id="Dallam" shape="rect" title="Dallam" coords="29,17,97,58"/>'+.....
    3. In the popup symbol, I want the large image map to be remove on the click event of the button: "View another region" . I have the following code which does not work (the image is not removed) resulting in what you see below:
    sym.playReverse();
    sym.getComposition().getStage().stop(0);
    sym.getComposition().getStage().getElementById("region1").remove();
    So my question is how do I remove the image (large image of the region in purple here loaded as described on 2.)?

    I got it. It should be:
    $("#region1").remove();  
    // # was missing.
    I actually added that to time 0 on the main timeline so when I got back there it removes the image.
    It's not working from the symbol yet but I guess I should eventually get it working from there instead.
    Thanks for your time.

  • How can I change the position of the stage from relative to fixed?

    I followed a tutorial and managed to integrate multiple edge animations to reveal.js. The problem is that when i refresh the page the animation doesn't load at the center of reveal.js "presentatio area". When I change slide and return to the one with the problem the animation loads correctly.
    Any ideas why when I refresh the page (or when I visit the page for the first time) the animation isn't at the center??
    Thanks

    Hi, antyfas-
    Can you post your entire project (including the reveal.js portion) either live for us to check out or as a project ZIP so that we can try to troubleshoot?  As far as I know, there should be no change in the CSS between the first and second display.
    Thanks,
    -Elaine

  • Adding objects to the stage & acceessing stage properties - I'm a bit confused..

    Hi,
    I'm a little confused on two fronts regarding display
    programming:
    A. What the best way to add objects to the stage?
    B. How to access stage properties.
    I can do both of these when the project is an 'Action Script
    Project', but I'm having trouble when it is a 'Flex Project' (e.g.
    an MXML file). See the two attached files with questions included
    in the comment to see exactly what I mean.
    A. What the best way to add objects to the stage?
    =====================================
    In an action script project that extends Sprite I can just
    call addChild()
    In an MXML project I can add objects to the stage by first
    adding them to a UIComponent, then adding that to the stage.
    1. Is that the best way to do it?
    In this doc:
    http://livedocs.adobe.com/flex/3/html/help.html?content=05_Display_Programming_02.html
    it says that
    quote:
    Each SWF file has an associated ActionScript class, known as
    the main class of the SWF file. When Flash Player opens a SWF file
    in an HTML page, Flash Player calls the constructor function for
    that class and the instance that is created (which is always a type
    of display object) is added as a child of the Stage object. The
    main class of a SWF file always extends the Sprite class
    2. why cant I just add a sprite object direct to the stage
    without the UIComponent?
    3. What is the 'main class', and how can i get access to it?
    B. How to access stage properties.
    =========================
    In an action script project that extends Sprite I can just
    call trace(stage.framerate)
    But in an MXML file I cannot figure out how to access the
    stage properties.
    See the attached code for the things that I tried, but which
    didnt work.
    In the page:
    http://www.actionscript.org/forums/showthread.php3?t=140655
    It says
    quote:
    For stage access you have a couple of rules:
    * natively, only display objects have inherent access to
    stage
    * display objects only have a valid reference to stage if
    they're within the stage's display list (on the screen, after added
    to it with addChild)
    * The only display objects which immediately have access to
    the stage before the use of addChild (in their constructor) are the
    document/application class instance (root) and any instance from
    the library placed on the timeline (not created with AS).
    * Non-display object classes have to be passed or assigned a
    reference to the stage from another object which already has access
    to it - they cannot access it otherwise.
    4. How do I access the stage properties in the MXML project?
    5. I suspect this is related to the "main class", which I
    dont yet understand - is it?
    Sorry for the long post.
    cheers
    tom

    "tom saffell" <[email protected]> wrote in
    message
    news:gd7cm9$d1v$[email protected]..
    > Thanks Luigi - that helps a lot.
    > I hadnt seen the Flex 3 Developer Guide before - it's
    very useful.
    >
    > I now see that I can access properties of the
    application object directly
    > with
    > this.<property>.
    > However, the framerate property cannot be set by
    actionscript, only in
    > MXML (I
    > can set it in the <mx:application> tag). But I
    need to be able to set it
    > programatically, dependent on user input.
    >
    > 5. Is there a way around this?
    > 6. Can I set the stage's framerate to achieve the same
    outcome?
    >
    > I still dont understand why I cannot access the stage
    object. When I call
    > either
    this.stage or
    uic.stage * then I get
    quote:
    Cannot access
    > a
    > property or method of a null object reference.
    My understanding is
    > that I
    > can access the stage object via any display object on
    the display list.
    > I'm
    > confused about this bit..
    >
    > * - uic is a UIComponent that has been added to the
    display list (i think)
    > by
    > calling addChild(uic) from the AS3 within the
    application
    >
    > 7. How do I access stage properties in AS3 in an MXML
    project?
    http://www.adobe.com/livedocs/flex/3/html/help.html?content=05_Display_Programming_10.html
    It seems like possibly your real problem is that you're
    having trouble
    searching the Help effectively:
    http://flexdiary.blogspot.com/2008/07/getting-help-in-flex-builder.html

Maybe you are looking for

  • Preview and "Smart" quotes

    I am trying to search through a PDF document that contains some (unfortunately named) "smart quotes". The term I am searching for is "Dean's", however the document contains "Dean's". The quote mark in the second word is actually a multibyte Unicode c

  • Leopard and Lion on the same hard drive

    So I do need tu run PowerPC Apps sometimes too and I have installed Leopard on the same hard drive (partitioned of course) as Lion is, because I dont have other hard drives. Anyway, I do have a little problem and it's about the Spotlight. Whenever I

  • Row Level Security - using a policy function.

    Hi, I am trying to implement RLS within our database and am getting the following error message: ORA-28112: failed to execute policy function Looking around the web, these seems to point to un-handled exception in my function, but I cannot seem to fi

  • TS4006 Can someone please tell me how I use icloud to find my ipad

    Can someone please tell me how to use iCloud to find my iPad and lock it out as well?

  • Updating xref2 in bseg table

    hello does anyone know which transaction updates bseg-xref2? and how to update it