High Definition eLearning
Welcome guest, is this your first visit? Create Account now to join.
  • Login:

Welcome to the Lectora and CourseMill Forums

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 8 Times in 8 Posts

    Default determine object position or collision // rename Lectora object

    All,

    I think I've seen this as an issue before, but can't find a solution. In a nutshell, I need to be able to either "rename" Lectora objects to a user-generated name rather than the "random" lectora-generated (HTML) name, or at least allow the compiled code to recognize a particular object as "this.".

    I'm trying to either determine the X,Y position of an object or collision with another object. I need this to be flexible yet generic so the logic is easily reused without need for additional input. I also don't want to modify the lectora .js files or add new external .js files since i can't ensure they will be properly inserted.

    I've been able to write, call, and test functions in both the core lectora file, as well as the external .js files (trivantis-image, trivantis-inline). My tests work if I "hard-code" Image####.objLyr.[...]. Unfortunately I can't seem to recognize this.objLyr.[...] when i call a function from the image object.

    (i.e. --(image7774.objLyr.hasMoved = true) tests TRUE, but (this.objLyr.hasMoved = true) tests FALSE)

    I'm using an action under my image object to Go To > Web Address > javascript: FunctionName(); to call functions.

    Any ideas how I can capture "this... object" so I can rename the entry? That would open up a world of opportunities, efficiencies, and portability as a template.

    Thanks in advance for your help!
    Lisa

  2. #2
    Ben Pitman aka Dr Lectora
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    5,948
    Thanks
    7
    Thanked 270 Times in 264 Posts

    Default

    There is no way I know of to do that with the current version of Lectora. I have put in a request for an action that would retrieve the HTML name of a specified Lectora object using the Lectora object name as a reference. No telling if or when that will happen.
    New Jan 19: Free Chapter of Designing Effective eLearning: A Step-by-Step Guide from Amazon

    cheers, ben -- aka Dr. Lectora: Lectora Resources & Services

    678-571-4179 - ben.pitman@eProficiency.com

  3. #3
    Member
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 8 Times in 8 Posts

    Default

    I was afraid someone would say that, Ben. I got very close, but just could never program so that Lectora could determine which object was "this" object. I could add JS and find all the objects, but unfortunately coding to a particular object isn't a whole lot better and would require some lock-downs which are just a headache.

    I also posted the same suggestion. I honestly don't see why your suggestion of an special action would be so difficult to implement. It looks like it would just be adding a few lines of javascript and a little code in the file to implement. Granted it would be of no use to non-programmers, it would make a world of difference to those who at least dabble in code...and as long as the programming is done and is transparent in a template, then even non-programmers can take advantage of it.

    Thanks for your response. I was hoping you might have a magic cure.

    Cheers!
    Lisa

  4. #4
    Ben Pitman aka Dr Lectora
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    5,948
    Thanks
    7
    Thanked 270 Times in 264 Posts

    Default

    Lisa, Send that in to Support@trivantis.com so they know I am not the only one requesting same.
    New Jan 19: Free Chapter of Designing Effective eLearning: A Step-by-Step Guide from Amazon

    cheers, ben -- aka Dr. Lectora: Lectora Resources & Services

    678-571-4179 - ben.pitman@eProficiency.com

  5. #5
    Member
    Join Date
    Mar 2009
    Location
    Hamden CT USA
    Posts
    73
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default

    if you add a eventhandler to the object you can get the id of the element from the event itself.
    /*ADD EVENT HANDLER TO AN OBJECT ON THE PAGE BY PASSING THE NAME OF THE OBJECT, THE EVENT TO WATCH, AND THE FUNCTION TO CALL*/
    function qAddEventHandler(qObject, sEventName, qEvent){
    if (qObject.attachEvent)
    {qObject.attachEvent('on' + sEventName,qEvent); }
    else
    if (qObject.addEventListener)
    {qObject.addEventListener(sEventName,qEvent, false); }
    }

    function function(e){
    var evt=window.event || e//evt evaluates to window.event or object, depending on which one is defined
    if (!evt.target){evt.target=evt.srcElement;};//REQUIRED CONVERSION IN CASE OF BROWSER TYPE
    var elemName = evt.target.name; //THIS IS THE NAME OF THE ELEMENT THAT THE ACTION OCCURRED ON (I.E. 'IMAGE2004OMG')
    var eventType = evt.type;//THIS GIVE US THE TYPE OF EVENT THAT OCCURRED

    there you go - need more info post again public or send me an email (peters@quizzicle.com)

  6. The Following User Says Thank You to peterLEXsorenson For This Useful Post:

    lrichmtg (09-03-2010)

  7. #6
    Member
    Join Date
    Nov 2008
    Posts
    52
    Thanks
    2
    Thanked 8 Times in 8 Posts

    Default

    I wasn't even thinking about looking at an event to get the object -- I suppose I was to focused on the object itself that i couldn't see the forest through the trees.

    Thanks so much for your suggestion! I have some new curly bracket toys to play with


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Lectora and CourseMill are registered trademarks of Trivantis Corporation, Camtasia and Snagit are registered trademarks of TechSmith Corporation and
Flypaper is a trademark of Flypaper Studio. Camtasia and Snagit are used with the permission of TechSmith Corporation.
Copyright © 1999-2012 Trivantis Corporation Inc. All rights reserved.