// trace(member("Bricks").getPropRef("model", 2).keyframePlayer); //Returns--> // undefined trace(member("Bricks").getPropRef("model", 2).keyframePlayer.currentTime); //Returns--> // undefined trace(member("Bricks").getPropRef("model", 2).keyframePlayer.playList); //Returns--> // undefined [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] => 3 [islastshown] => [isfirstshown] => [attachments] => [allattachments] => ) --> Add keyframePlayer modifier with JavaScript - Macromedia Director 3D

Add keyframePlayer modifier with JavaScript - Macromedia Director 3D

Am having some trouble adding the keyframePlayer using JavaScript. Using Lingo I successfully did it within an exitFrame handler on frame 1. With JavaScript I have tried doing it within an exitFrame function on frame 1, but get errors. Any help is appreciated. --This is the Lingo version that works great. member("Bricks").model("Null_AllBricks").addModifi er(#keyframePlayer) //This is the JavaScript version which fails: member("Bricks").model("Bricks:Brick1").addModifie r(symbol(keyframePlayer)); //This returns: Script error: Type error: member("Bricks").model is not a function...

Sponsored Links
  1. #1

    Default Add keyframePlayer modifier with JavaScript

    Am having some trouble adding the keyframePlayer using JavaScript. Using Lingo
    I successfully did it within an exitFrame handler on frame 1. With JavaScript
    I have tried doing it within an exitFrame function on frame 1, but get errors.

    Any help is appreciated.

    --This is the Lingo version that works great.
    member("Bricks").model("Null_AllBricks").addModifi er(#keyframePlayer)

    //This is the JavaScript version which fails:
    member("Bricks").model("Bricks:Brick1").addModifie r(symbol(keyframePlayer));
    //This returns: Script error: Type error: member("Bricks").model is not a
    function

    Sponsored Links
    adam@blueapplestudio Guest

  2. #2

    Default Re: Add keyframePlayer modifier with JavaScript

    Two things:

    1) You've passed a symbol as the argument to addModifier, which is correct but
    the symbol name must be a String, so that part of that line of code should be:
    addModifier(symbol("keyframePlayer"))

    2) You can't access models directly by name in JavaScript syntax. You have to
    use getPropRef("model", SOME_NUMBER), where SOME_NUMBER would be whatever the
    model's index number is. I often use a function similar to the following
    attached code to find the index of a model based on its name.

    for (var n = 1; n < member("Bricks").count("model") + 1; n++)
    {
    trace(n + " of " + member("Bricks").count("model"));
    if (member("Bricks").getPropRef("model", n).name == "Bricks:Brick1")
    {
    member("Bricks").getPropRef("model",
    n).addModifier(symbol("keyframePlayer"));
    trace(member("Bricks").getPropRef("model", n).name);
    }
    }

    Ex Guest

  3. #3

    Default Re: Add keyframePlayer modifier with JavaScript

    Thank you very much for your response. I believe that I am now successfully
    applying the keyframePlayer, however I am having trouble accessing properties.
    Any thoughts? (see code)

    This is a bit unrelated, but do you know of any JavaScript-specific Director
    resources? I am trying to leverage my knowledge of ActionScript (and its
    similarity to JavaScript) in learning Director, but it seems Lingo is the
    better doented language regarding Director. This example from Director's
    livedocs (addModifier page) appears to be inaccurate given what you said in
    your second point:

    // JavaScript syntax
    member("shapes").model("Box").addModifier(symbol(" toon"));

    Are they attempting to access a model directly by name with JavaScript?

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

    trace(member("Bricks").getPropRef("model", 2));
    //Returns--> // <model("Bricks:Brick1")>

    trace(member("Bricks").getPropRef("model", 2).keyframePlayer);
    //Returns--> // undefined
    trace(member("Bricks").getPropRef("model", 2).keyframePlayer.currentTime);
    //Returns--> // undefined
    trace(member("Bricks").getPropRef("model", 2).keyframePlayer.playList);
    //Returns--> // undefined

    adam@blueapplestudio Guest

  4. #4

    Default Re: Add keyframePlayer modifier with JavaScript

    To access the keyframePlayer properties we must once again call on our old
    friend "getPropRef".

    A good resource for JavaScript syntax and 3D:

    http://www.adobe.com/devnet/director/articles/visualization.html

    trace(member("Bricks").getPropRef("model", 2).getPropRef("keyframePlayer"));

    trace(member("Bricks").getPropRef("model",
    2).getPropRef("keyframePlayer").currentTime);

    trace(member("Bricks").getPropRef("model",
    2).getPropRef("keyframePlayer").playList);

    Ex Guest

  5. #5

    Default Re: Add keyframePlayer modifier with JavaScript

    Wonderful help! Thank you very much.
    adam@blueapplestudio Guest

Similar Threads

  1. y keyframeplayer motion from 3ds max
    By tedalde2 in forum Macromedia Director 3D
    Replies: 1
    Last Post: June 17th, 01:59 PM
  2. keyframeplayer problems
    By Kuldeep S in forum Macromedia Director 3D
    Replies: 0
    Last Post: December 13th, 03:50 PM
  3. bizarre keyframeplayer problem
    By jerkyface in forum Macromedia Director 3D
    Replies: 1
    Last Post: June 25th, 02:59 PM
  4. Keyframeplayer questions
    By WhitAnderson in forum Macromedia Director 3D
    Replies: 1
    Last Post: April 1st, 06:47 AM
  5. keyframeplayer timestep ??
    By ptolami webforumsuser@macromedia.com in forum Macromedia Director 3D
    Replies: 1
    Last Post: October 30th, 07:08 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
  •