A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Function not invoking...please help

  1. #1
    Member
    Join Date
    Aug 2001
    Posts
    96

    Function not invoking...please help

    Hello

    I have a function that works well when i invoke it through onPress, however, the function does not work when i place it in the movie frame.

    For instance


    function traceMessage(){

    trace("I am invoked");
    }

    works when I invoke like this through a button:

    on (press){

    traceMessage();
    }


    However, when I just place the function in the first frame of my movie, like this:

    traceMessage();

    it doesn't work.

    Any suggestions? Thanks,

    Tone

  2. #2
    imagination through stupidity
    Join Date
    Apr 2001
    Location
    P3X-3113
    Posts
    1,238
    Quote Originally Posted by toneDigital
    Hello

    I have a function that works well when i invoke it through onPress, however, the function does not work when i place it in the movie frame.

    For instance


    function traceMessage(){

    trace("I am invoked");
    }

    works when I invoke like this through a button:

    on (press){

    traceMessage();
    }


    However, when I just place the function in the first frame of my movie, like this:

    traceMessage();

    it doesn't work.

    Any suggestions? Thanks,

    Tone
    Code:
    function traceMessage(){
    
        trace("I am invoked");
    }
    traceMessage();
    place that in frame 1 and it will work.

    the frame where the function is defined has to be shown before you can try to run the function.

    code is read top down so the function is defined before it is called.
    Nothing to see here, move along.

  3. #3
    Member
    Join Date
    Aug 2001
    Posts
    96
    Thanks.

    I'll give a go and let you know : )

    T

  4. #4
    Member
    Join Date
    Aug 2001
    Posts
    96
    Works like a charm!
    Thanks!

    T

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center