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
Page 1 of 3 123 LastLast
Results 1 to 10 of 26
  1. #1
    Member
    Join Date
    Jul 2006
    Location
    Pontiac, MI
    Posts
    586
    Thanks
    0
    Thanked 8 Times in 3 Posts

    Default

    Since people have been asking me about it, here are some common Flash commands for communicating with Lectora that I use.
    I will use a generic "objectname" that you can can replace with the HTML name that Lectora assigns.

    This refers to images/groups/text boxes/buttons/anim objects/external htmlNote: if you want to use javascript just use what is in the quotes, that is the javascript command.

    Note 2: you need this code on the pages where you use these functions: import.flash.external.*
    List:
    Hide an object: ExternalInterface.call("objectname.actionHide()");
    Show an object: ExternalInterface.call("objectname.actionShow()");
    Next Page: ExternalInterface.call("trivNextPage()");
    Previous Page: ExternalInterface.call("trivPrevPage()");
    Go to a Specific Page in Lectora (see page name rules):ExternalInterface.call("trivExitPage('htmlpagename.html', true)");
    Move an Object on stage (xval=the new xcoordinates, yval=the new ycoordinates): ExternalInterface.call("objectname.objLyr.moveTo(xval,yval)" );
    ExternalInterface.call("objectname.objLyr.hasMoved=true");
    ExternalInterface.call("objectname.objLyr.newX=xval")
    ExternalInterface.call("objectname.objLyr.newY=yval");

    Talk to another Flash object (using Lectora's tools, I know there are other ways), set variable: ExternalInterface.call("objectname.setFlashVar('thevariable' ,thevalue)");
    Grab a value from Lectora and assign it to a variable in Flash:See Mark's post below.
    [b]Set a Lectora variable from flash:ExternalInterface.call("Varvariablename.set('value')");
    Run a Lectora Action Group: ExternalInterace.call("runGroup_objectname()");

    Page Name Rules: You can control page naming by setting up a system of chapeters and sections. Make sure you don't have duplicate names, or else it will publish as ascii. Example for a SCORM/AICC course:Chapter Name (mod1)Section Name (sec1)Page Name (page1)This structure would give you an html page name as: a001_mod1_sec1_page1.htmlWhere a001 is the assignable unit. Keeping uniformed and controled page naming allows for some neat interactions with flash because you always know where every page is. Let your imagination run wild Example: I have created a dynamic flash menu for every page within the course, that also updates based upon your location in the course.Post here if you want me to add any more. I'll update the post.

    Thanks!
    *Updated for new forum
    Last edited by xithis; 02-22-2010 at 08:26 AM. Reason: Updated to New Forum
    CommentCatcher for Articulate/Lectora
    Flash Tips for Lectora

  2. The Following 6 Users Say Thank You to xithis For This Useful Post:

    cephillips (03-03-2011), Ivring (09-02-2011), Julee (11-05-2010), Ladybyrd (10-26-2010), manxman (11-28-2010), pfloydal (02-28-2011)

  3. #2
    Mark Hemingway
    Join Date
    Sep 2004
    Location
    Utah
    Posts
    376
    Thanks
    0
    Thanked 19 Times in 17 Posts

    Default

    Awesome list Greg! Just a note for everyone. Flash player 10 has some added security "features" and for some reason if you try to grab a lectora variable and assign it to a variable in flash it will come back as undefined. So this call will fail:var tempVariable = ExternalInterface.call("Varvariablename.getValue()"); Even though it works great in flash players 8 and 9, as soon as someone upgrades to 10 that call will no longer work. Unless Adobe come out with an update for it.For now I've been working around it by adding an external HTML object to the page with a javascript function to set my flash variables. For example if in flash I had a variable called "setFromLectora" and I wanted to set it equal to a Lectora variable called "lectoraVariable" I would need external html that looked like:
    Code:
    <script>function setVars(){    var lectoraVariable = VarlectoraVariable.getValue();      window.document.swfanim2153.Se tVariable("setFromLectora",lectoraVariable); </script>
    What this does is creates a javascript variable called lectoraVariable and sets it to the Lectora variable of the same name. Then it uses javascript to set that variable in the flash movie. swfanim2153 is the Lectora generated name of your flash movie. So inside of flash you would have something like:
    Code:
    var setFromLectora;ExternalInterface.call("setVars");
    Anyhow, hopefully this will save a few headaches when your clients call and want to know why things stopped working when they upgraded to flash player 10.

  4. The Following 2 Users Say Thank You to hem99004 For This Useful Post:

    Ivring (09-02-2011), manxman (11-28-2010)

  5. #3
    Member
    Join Date
    Jul 2006
    Location
    Pontiac, MI
    Posts
    586
    Thanks
    0
    Thanked 8 Times in 3 Posts

    Default

    Thanks Mark for the clarification. I've edited my list. You can also use the code for talking to another flash object and instead replace it with the name of your current swf.

  6. #4
    Member
    Join Date
    Jul 2008
    Posts
    27
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    is Lectora 9 not able to communicate with Flash CS4 yet? Could that be why I can't get anything to work?

  7. #5
    Member
    Join Date
    Jul 2006
    Location
    Pontiac, MI
    Posts
    586
    Thanks
    0
    Thanked 8 Times in 3 Posts

    Default

    Most likely it is a security violation when trying to run. (Also need to test in html).I'm using CS4 with lectora without any major issues.http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.htmlGo to this link and allow your testing locations. That should help out.

  8. #6
    Member
    Join Date
    Jan 2009
    Location
    Grand Rapids, MI
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Greg, 
    I believe it should be --  import flash.external.*
    and not -- import.flash.external.*
    You have an extra period after import.
    Other than that thanks for the info!

  9. #7
    Member
    Join Date
    Dec 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Sounds simple, but can't get that external HTML thing to work :(
    I publish to HTML on a localhost and even tried to upload as scorm to the LMS. No result, always 'undefined'.Have tried to replace ExternalInterface.call("setVars"); with ExternalInterface.call("setVars()"); an much more.
    In my swf:
    import flash.external.*;var setFromLectora;ExternalInterface.call("setVars");tekst_txt.text = setFromLectora; // sets a textfield to display setFromLectora
     
    In Lectora as external HTML-object, Custom HTML:
    <script type="text/javascript">    function setVars()        {            var lectoraVariable = VarlectoraVariable.getValue();            window.document.swfanim39.SetVariable("setFromLectora",lectoraVariable);        }</script>
    What am i doing wrong? can anyone upload working sample files?

  10. #8
    Member
    Join Date
    Feb 2008
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi,
     
    instead of using
    tekst_txt.text = setFromLectora; // sets a textfield to display setFromLectora
     
    use:
    tekst_txt.htmlText
    This will help using html text in flash :)
     

  11. #9
    Member
    Join Date
    Dec 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi Do,
    Nice suggestion. But unfortunately it didn't work :-(
    I have made the var in Lectora under tools -> variableManager.Also tried having an action that modifies the variable (on show) on the same page as the swf.

  12. #10
    Member
    Join Date
    Dec 2008
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Finally something happened!
    Got it to work as an uploaded scorm package. But stil no response as html on the localhost or www.
    Turns out that i have to make an action that modifies the variable on show. It is not enough to have the variable in the variable manager.It makes no difference whether I use textfieldname.text or textfieldname.htmlText in Flash. Both work fine.
    Any suggestions on how to make it work when puplished as html?I usually test as html on localhost for faster workflow.


 

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.