member("screwBox").getPropRef("model", 1) mModel.getPropRef("keyframePlayer").removeLast(); } //Converts frames to milliseconds. function fFramesToMilliseconds (nFrame){ if(nFrame != 0){ nMilliseconds = nFrame * 1000 / 30; }else{ nMilliseconds = 0; } return nMilliseconds; } //Pauses a model's keyframePlayer animation. function fPauseKeyframePlayerAnimation(myModel, myAnimation){ myModel.getPropRef("keyframePlayer").pause(myAnimation); } //Plays an animation segment. function fPlay3DAnimation(tempModel, tempAnimationName, tempLoopBoolean, nStart, nStop){ //Plays the animation starting at ** milliseconds and loops it if tempLoopBoolean is true. tempModel.getPropRef("keyframePlayer").play(tempAnimationName, tempLoopBoolean, nStart, nStop, 1); } //Applies the keyframePlayer modifier member("Cube").getPropRef("model", 1).addModifier(symbol("keyframePlayer")); member("Cube").getPropRef("model", 2).addModifier(symbol("keyframePlayer")); //Runs the function that pauses animation. fPauseKeyframePlayerAnimation(member("Cube").getPropRef("model", 1), "CubeKey"); fPauseKeyframePlayerAnimation(member("Cube").getPropRef("model", 2), "CubeKey"); //Runs the function that removes the last animation in the playlist. fRemoveLastInPlaylist(member("Cube").getPropRef("model", 1)); fRemoveLastInPlaylist(member("Cube").getPropRef("model", 2)); trace(member("Cube").getPropRef("model", 2).getPropRef("keyframePlayer").playlist.length);// <- This causes an error. [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => [ref] => [htmlstate] => on_nl2br [postusername] => adam@blueapplestudio [ip] => webforumsuser@m [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> Why might a trace statement make a function becomeundefined? - Macromedia Director 3D

Why might a trace statement make a function becomeundefined? - Macromedia Director 3D

In a JavaScript Movie Script I am defining a few functions for my movie. As soon as I add the trace statement at the bottom of the script, I get this error- Script Error: Reference Error: fPauseKeyframePlayerAnimation is not defined fPauseKeyframePlayerAnimation(mCube, ?CubeKey?); Why would adding this trace statement cause the above function to become undefined? //Creates a function that will loop back to the previous marker. function fLoopFrame(){ _movie.goLoop(); } //Removes the last animation in the playlist. function fRemoveLastInPlaylist(mModel){ //mModel must be a variable in the form --> member("Box").getPropRef("model", 1) mModel.getPropRef("keyframePlayer").removeLast(); } //Converts frames to milliseconds. function fFramesToMilliseconds (nFrame){ if(nFrame ...

  1. #1

    Default Why might a trace statement make a function becomeundefined?

    In a JavaScript Movie Script I am defining a few functions for my movie. As
    soon as I add the trace statement at the bottom of the script, I get this error-

    Script Error: Reference Error:
    fPauseKeyframePlayerAnimation is not defined

    fPauseKeyframePlayerAnimation(mCube, ?CubeKey?);

    Why would adding this trace statement cause the above function to become
    undefined?


    //Creates a function that will loop back to the previous marker.
    function fLoopFrame(){
    _movie.goLoop();
    }

    //Removes the last animation in the playlist.
    function fRemoveLastInPlaylist(mModel){
    //mModel must be a variable in the form -->
    member("Box").getPropRef("model", 1)
    mModel.getPropRef("keyframePlayer").removeLast();
    }

    //Converts frames to milliseconds.
    function fFramesToMilliseconds (nFrame){
    if(nFrame != 0){
    nMilliseconds = nFrame * 1000 / 30;
    }else{
    nMilliseconds = 0;
    }
    return nMilliseconds;
    }

    //Pauses a model's keyframePlayer animation.
    function fPauseKeyframePlayerAnimation(myModel, myAnimation){
    myModel.getPropRef("keyframePlayer").pause(myAnima tion);
    }

    //Plays an animation segment.
    function fPlay3DAnimation(tempModel, tempAnimationName, tempLoopBoolean,
    nStart, nStop){
    //Plays the animation starting at ** milliseconds and loops it if
    tempLoopBoolean is true.
    tempModel.getPropRef("keyframePlayer").play(tempAn imationName,
    tempLoopBoolean, nStart, nStop, 1);
    }

    //Applies the keyframePlayer modifier
    member("Cube").getPropRef("model", 1).addModifier(symbol("keyframePlayer"));
    member("Cube").getPropRef("model", 2).addModifier(symbol("keyframePlayer"));

    //Runs the function that pauses animation.
    fPauseKeyframePlayerAnimation(member("Cube").getPr opRef("model", 1),
    "CubeKey");
    fPauseKeyframePlayerAnimation(member("Cube").getPr opRef("model", 2),
    "CubeKey");

    //Runs the function that removes the last animation in the playlist.
    fRemoveLastInPlaylist(member("Cube").getPropRef("m odel", 1));
    fRemoveLastInPlaylist(member("Cube").getPropRef("m odel", 2));

    trace(member("Cube").getPropRef("model",
    2).getPropRef("keyframePlayer").playlist.length);// <- This causes an error.

    adam@blueapplestudio Guest

  2. #2

    Default Re: Why might a trace statement make a function becomeundefined?

    The culprit seems to be ".length". This is at the end of my last line of code.

    It is my understanding that the playlist is a Lingo list, and to return the
    quantity of entities in that list .length is used. I tried a test in a new
    movie and confirmed that this works.

    Any guess how that last trace statement could be affecting any of the
    functions defined above it?

    adam@blueapplestudio Guest

  3. #3

    Default Re: Why might a trace statement make a function become undefined?

    Does it work better if you use .count instead of .length?
    Mike Guest

  4. #4

    Default Re: Why might a trace statement make a function becomeundefined?

    I wrapped everything except for .length in brackets and it no longer produces
    the error. (see code ONE)

    My new problem is the value it's returning. It seems to return 1 no matter
    what is in the list. I have a few trace statements executing in a looping
    frame. As you can see, the playlist becomes empty, however the .length
    continues to return 1. (see code TWO)

    Any thoughts?

    //ONE
    trace(member("Cube").getPropRef("model",
    2).getPropRef("keyframePlayer").playlist.length);//This creates the problem
    trace([member("Cube").getPropRef("model",
    2).getPropRef("keyframePlayer").playlist].length);//This does not create the
    problem

    //TWO
    // mCubeNull
    // <[[#name: "cubeNullkey", #loop: 0, #startTime: 0, #endTime: 1333, #scale:
    1.0000], [#name: "cubeNullkey", #loop: 0, #startTime: 0, #endTime: 1333,
    #scale: 1.0000]]>
    // 1
    //
    // mCubeNull
    // <[]>
    // 1

    adam@blueapplestudio Guest

  5. #5

    Default Re: Why might a trace statement make a function becomeundefined?

    Mike, thanks for the direction.

    1: [].length does not ?work?, it simply does not cause the error I was
    getting. [].length keeps returning 1 because I believe it views everything in
    there as a single entity in an array with length 1. So when I think it is
    empty, it isn?t. User error.

    2: .count works wonderfully. Over time, it returns values I had expected to
    see as the playlist empties.

    Thank you very much for your assistance.


    adam@blueapplestudio Guest

Similar Threads

  1. Function Trace
    By cadillac3 in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: October 14th, 11:13 PM
  2. Is there anyway to make this a legal statement?
    By JakeFlynn in forum Macromedia ColdFusion
    Replies: 5
    Last Post: July 22nd, 09:05 PM
  3. Using a trace function with multiple threads
    By Francis Joanis in forum Ruby
    Replies: 1
    Last Post: August 25th, 08:49 PM
  4. Having problems with an IF statement, just doesn't make sense
    By Nadim Attari in forum PHP Development
    Replies: 0
    Last Post: July 7th, 12:22 PM
  5. Displaying the function stack trace
    By Bjorn Reese in forum UNIX Programming
    Replies: 1
    Last Post: June 27th, 10:10 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139