Execute functions in document class when main timeline reaches a frame

Hi,
I have 3 functions in my main document class that I want to execute when the main timeline reaches a particular frame number.
how do I do that?
see the code and comments
public function mainClass()
//stage declaraction
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, stageResized);
//wrap these next 3 lines in an if statement that says if maintimeline currentframe = x
position();
loadXml();
initArrowButtons();
slideTimer = new Timer(timer_delay);
slideTimer.addEventListener(TimerEvent.TIMER, nextSlide);

It's still undocumented, but something like this would do it:
package
    import flash.display.MovieClip;
    public class FrameScript extends MovieClip
        public function FrameScript()
            addFrameScript( 3, frameFour );
        private function frameFour():void
            trace( "you have reached Frame 4" );
You can test this as a documentclass.

Similar Messages

  • Hang Calling function after Document Class' Event.ADDED

    I was trying to load an external SWF (that contains the below code in its document class) with the Loader class but i keep on receiving Error #1009: Cannot access a property or method of a null object reference. So i tried to use the event listener Event.ADDED in MyDocumentClass constructor of the external SWF to let the document class be part of the display list before i invoke createRandomGraph. But when i place createRandomGraph( ) inside onStageReady, The compilation process hangs. When i leave the createRandomGraph( ) inside the constructor, it works perfectly as stand alone but will produce Error 1009 if loaded within the loader SWF. Any ideas?
    public function MyDocumentClass( )
        this.addEventListener(Event.ADDED, onStageReady);
        createRandomGraph( )
    private function onStageReady(oEvent:Event):void
        this.removeEventListener(Event.ADDED, onStageReady);
    private function createRandomGraph( ):void
        var cRandomGraph:RandomGraph = new RandomGraph();
        cRandomGraph.x = 10;
        cRandomGraph.y = stage.stageHeight - nH - 25;
        cRandomGraph.setDimensions(nW,nH);
        cRandomGraph.createGraphBackground();
        this.addChild(cRandomGraph);

    use:
    public function MyDocumentClass( )
        this.addEventListener(Event.ADDED_TO_STAGE, onStageReady);
    private function onStageReady(oEvent:Event):void
        this.removeEventListener(Event.ADDED, onStageReady);
    createRandomGraph();
    private function createRandomGraph( ):void
        var cRandomGraph:RandomGraph = new RandomGraph();
        cRandomGraph.x = 10;
        cRandomGraph.y = stage.stageHeight - nH - 25;
        cRandomGraph.setDimensions(nW,nH);
        cRandomGraph.createGraphBackground();
        this.addChild(cRandomGraph);

  • Mime Type for document class when archiving outlook emails

    Hello team,
    can anybody fill me in how to configue the mime type for .msg files (outlook emails) in the document class msg?

    1) Use SE16 to change table V_TOADD
    2) Add:
    Document Class                 - MSG
    Description                         - Outlook Mail
    MIME type of a Web object - message/rfc822
    You can then associate the MSG document class to document types.
    Eli.

  • Generate document classes when creating WebService from WSDL using JAXRPC

    Can anybody tell me how i can generate request response document classes.Response is return type and request is its parameter of method (service provided by webservice).
    I had used cmd:
    wscompile -keep -gen:both -d src config.xml
    My config.xml is:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <wsdl
    location="wsdl\TroubleTicket\v1-2\JVTTroubleTicketSession.wsdl"
    packageName="src">
    <handlerChains>
    </handlerChains>
    <namespaceMappingRegistry>
    </namespaceMappingRegistry>
    </wsdl>
    </configuration>
    After running the wscompile command, i was able to generate SOAPBuilder classes, LiteralSerialiser files, Request-Response-Exception classes and the Tie, stub, Port and Impl classes.
    How can i procedd furthur???

    Arushi,
    I would refer to the online tutorial for JWSDP, which walks you through creating a web service and a Client to the service.

  • How to go back to frame 1 when the timeline reaches a certain frame?

    I have a timeline that has some label frames at the very end of the timeline. During the timeline a user will hit a button on a frame and will jump to one of the label frames. On the label frame is another button that when clicked - returns the user to the previous frame. How do I make the movie return to frame 1 - without a button - but before it reaches the label frames? In other words, by simply reaching a certain frame in the movie, I want the timeline to go back to frame 1.
    I am using Action Script 3 on a PC
    Thank you.

    Thanks from me as well. I'm trying to make an interactive house simulation game (basic) and hit this issue where the timeline needs to skip to the next segment as several options are available per room (listed one after the other in the timeline). Flash isn't particularly easy to use when it comes to this kind of thing. Is Flash Catalyst CS5 more suited to this?

  • Accessing document class function within timeline

    Hi have a very simple question,
    (Bear with me I'm still quite new to as3 and some of my terminology may not be solid)
    I want to access a function that is within my document class when a movie clip on the timeline has played to a specific point (being the end).
    I have already been able to call another function from the document class at the top/root level (it is called to initialize all clips and buttons when you click on the "enter" button on the splash screen.
    Problem is that I cannot call another function (in the document class) from a movie clip within a movie clip on the timeline. Is there an easy way to do this? I have considered writing a separate class for the movie clip and then adding it onto the movie clip (using the property panel). I don't really want to do it this way because I am already using a base class on that movie clip and 3 others that use a set of generic functions.

    >>I want to access a function that is within my document class when a  movie clip on the timeline has played to a specific point (being the  end).
    Your document class should add a listener to the clip and the clip should dispatch an event when it's complete. You could dispatch your own event or use one of Flash's like Event.COMPLETE. Something like:
    in clip
    dispatchEvent(new Event(Event.COMPLETE));
    and in your doc class
    clipOnTimeline.addEventListener(Event.COMPLETE, classMethod);
    >>I have already been able to call another function  from the document class at the top/root level (it is called to  initialize all clips and buttons when you click on the "enter" button on  the splash screen.
    You really should avoid mixing timeline and document class code. Better would be for your doc class to add a listener to the button and call a method within the class when it's clicked.

  • Ref functions on main timeline within MC

    Does any one know of a way I can call a function thats set up on the main timeline using AS in movie clip thats a child of the timeline?
    IE:
    I have a function called setName(); on the main timeline.... I also have a movieclip called contact_mc and I need to add EventListeners within the contact_mc that would some how call the setName(); function thats in its parent timeline... Any advise you can offer is apperciated!

    try:
    MovieClip(this.parent).setName();
    to reference the movieclip.  i'm not sure what events you want to trigger that function call.

  • Button in movieclip to main timeline

    I have a button(A) that opens a movie clip which contains a
    button (B). I want button B to go to and play a frame on the main
    timeline, NOT a frame in the movieclip. Is this possible?
    If not, what I am aiming for is a menu of buttons, that are
    rollovers from which another menu pops up with buttons you can
    click.
    Help!
    Thanks

    Hi, Sorry I am new to ActionScript.
    This is what I wrote:
    this.menu_orange1.addEventListener(MouseEvent.CLICK,clickListener2);
    function clickListener2(event:MouseEvent):void {
    _root.gotoAndPlay("test");
    and the error message says:
    1120: Access of undefined property _root.

  • Using cue points to trigger events on the main timeline...

    Hi--
    I have successfully placed an flv (video) file (progressive
    download) on the main timeline of my movie with controls to play
    and pause (Flash 8 Professional). So far, so good!
    NOW TWO PROBLEMS: Does anyone know how to set it up so that
    when a specific cue point is reached in the video, it triggers an
    action on the main timeline? In this case, once the video is over,
    I want the main timeline to gotoAndPlay frame 3. Specific script to
    do this would be great!
    The other action I'd like to happen is that when the video
    begins, it targets a scrolling text mc ("text") in the main
    timeline and tells it to gotoAndPlay frame 2.
    Any advice would be GREATLY appreciated!!! Many
    thanks!!!

    I usually start off solving problems with the livedocs, as I
    recommend for anyone. The following link will take you to the
    NetStream.onCuePoint handler. This is what you need.
    http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00002561.html
    You can have this code on the main timeline. When the
    cuepoint is hit, it will invoke this event handler and inside is
    where your gotoAndPlay( ) should go.
    Your other question about the text will get activated by the
    same handler. Just have a conditional statement (if, switch, etc.)
    to differentiate between the two events. The text itself can be
    mask inside a movieclip.
    Does this help?

  • Referencing the main timeline from elsewhere

    From inside a movie clip (button) which is inside a display
    object (buttonSet), I want to gotoAndPlay a specific frame on the
    main timeline. I've tried stage.gotoAndPlay(thisFrame). I got
    closer with gotoAndPlay(stage.thisFrame). I still have something
    wrong.
    I have about 15 frames on the main timeline. Each frame
    contains a myriad of objects all doing different things. Most
    importantly they transition from frame to frame based on the
    current frame (last button clicked) and the next frame (the newly
    clicked button).
    Example: the last button that was clicked was button #4, the
    button I have just clicked is button #2. Based on this knowledge, I
    want the main timeline to gotoAndPlay frame #6.
    Thanks for the aid. :)

    the flash compiler (in strict mode) often has trouble
    "remembering" the class-type of objects/variables. "typing" those
    objects explicitly helps the compiler to overcome erroneous error
    messages.

  • Symbol to call back on the main timeline with Label?

    Hi,
    I have a symbol called Panel_1. When it slides out, I have a button inside to call out to Panel_2.
    I created Panel_2 on a main timeline (only 1 frame) using a Label called "Label_2".
    This code doesn't work with I click.
    sym.getComposition().getStage().sym.play("Label_2").play();
    Any idea how to fix the code?
    Thx.

    You need to remove the second sym in the code.
    On Thu, Jan 8, 2015 at 2:56 PM, iamvichai <[email protected]>

  • Button not in main timeline

    Hello All,
    I am fairly new to flash and would greatly appreciate some
    help with this... I have many buttons that I need to attach event
    handlers to but they are embedded within layers of movie clips, and
    if I write the handler code in the main timeline's 1st frame they
    are nowhere to be found because they are no yet displayed. If I
    write the handler code in the movie clip that a button is contained
    in, and my action is to gotoAndPlay a frame of a different movie
    clip, that movie clip also not be found. My guess is that I need to
    write the code within the movie clip that the button is contained
    in and somehow call up the mainstage and then reference the movie
    clip that is to be played by the buttonClick event through its
    respective path... something like (in words):
    "look to stage" then...
    function buttonClick(speakevent:MouseEvent):void {
    portal_mc.logomov_mc.gotoAndPlay(63)
    speak_btn.addEventListener(MouseEvent.CLICK, buttonClick);
    can anybody tell me how to point back to the stage? or some
    other way of doing this? surely it is possible. any comments would
    be much appreciated.
    thanks, sander.

    kglad wrote:
    i'm assuming your buttons are movieclip buttons.  if "nextlevelbutton" is not the linkage id of a movieclip, your code makes no sense.  if it is a movieclip over and down states wouldn't work unless you had code elsewhere.
    scoresign.attachMovie("nextlevelbutton", "nextlevelbutton", scoresign.getNextHighestDepth(), {_x:126, _y:300});
    scoresign.attachMovie("mainmenubutton", "mainmenubutton", scoresign.getNextHighestDepth(), {_x:35, _y:300});
    scoresign.nextlevelbutton.onRelease=function(){gotoAndStop("first scene");
    scoresign.mainmenubutton.onRelease=function(){
    // do whatever

  • How to control main timeline from buttons in a movieclip - job in jeopardy!

    I am trying to do a simple thing in theory. In my main timeline I have a series of images with frame labels for each. In a movieclip (with its own labels & script) below the images, I have two panels of butttons that flop back and forth (to save space). The idea is to simply have the main timeline play the frame specified by the corresponding button in the movieclip. I tried the parent.child thing but either im doing it wrong or that isnt the solution. If anyone can help me I will be saved from certain death. If you think any other part of my project may be to blame, Ill be happy to provide anything that can help. Thanks in advance.
    Here is my script:
    ActionScript Code:
    function on1click(evt:MouseEvent):void {
        gotoAndPlay("pic1");
    thumbPanel.pic1_btn.addEventListener(MouseEvent.CLICK, on1click);
    this is the error: 
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at gallery_fla::MainTimeline/frame1()

    The 1009 error indicates that one of the objects being targeted by your code is out of scope.  This could mean that the object....
    - is not in the display list
    - doesn't have an instance name (or the instance name is mispelled)
    - does not exist in the frame where that code is trying to talk to it
    - is animated into place but is not assigned instance names in every keyframe for it
    - is one of two or more consecutive keyframes of the same objects with no name assigned in the preceding frame(s).
    If you go into your Publish Settings Flash section and select the option to Permit debugging, your error message should have a line number following the frame number which will help you isolate which object is involved.

  • When time line reaches a certain frame load swf into movieclip.

    Hi,
    I need some help with some actionsscript. When the timeline reaches a certain frame, I want an swf to load into a movieclip in that particular frame. I need this to occur on level 1 as the root of the site is pre loader. Any help would be much appreciated. Cheers

    In that frame, on an actions layer, use either the loadMovie method or the MovieClipLoader.loadClip method to load the swf into the movieclip.  There should be examples of using either in the help documents and via Google.

  • How to call a function in a class from the main timeline?

    Hey Guys
    I have a project in Flash with four external AS files, which are linked to items in the library using AS linkage.
    What I want to do is call a function in one of these files from the main timeline, how would I go about doing this? I'm not currently using a document class, most of the code is in Frame 1 of the main timeline.
    Thanks

    // change type to the class name from the instance
    ClassNameHere(this.getChildByName('instance_name')).SomeFunction();

Maybe you are looking for

  • Cannot download anything. Get 203 error

    I just downloaded Mozilla Firefox. It gives me a 203 error everytime I try to install any download. I like a google tool bar and Alexa tool bar displayed. I have these with Internet Explorer and would like to have them with Firefox as well in order t

  • Manual entry of tax in billing

    Dear all, While creating sale order, as per my client's requirement, i had manually entered tax. But this manual entry doesnt have tax code.So while creating billing, it gives account determination error that is in account key MW3, gl account is miss

  • Changing the chapter title automatically on a master page

    hi,<br />I'm hoping someone can help. I've just received an Indesign file from a colleague which has an automatic feature which pulls the chapter heading from the document and places in on the right hand side. the master page has this written on it <

  • Script for calculations using checkboxes in PDF form

    I have 7 checkboxes, at least one must be checked, but the user may select all. Each one has a value of 800, therefore selecting all seven would give a total of (800 + 800 + 800 + 800 + 800 + 800 + 800). Selecting only two: (800 + 800), etc. However,

  • How to Deregister dead copy of Photoshop Elements 9?

    I installed Adobe Photoshop Elements 9 on a laptop which died. How can I deregister that installation now that the hard drive has been reformatted