Javascript not working in swf output

I am working on a project where the quiz requirements are quite unique and not all that logical, but it's what the client requires...
I have a lot of courses ("lessons") for this project. I'm using a fully custom quiz for each lesson. Because of the sheer number of courses, and the unique requirements, I am trying to leverage javascript for this project as much as possible.
I must publish both HTML5 and Flash versions. While not contractually required to publish a swf version, I am pretty certain that having both formats available will avoid having to deal with all of the browser issues down the road (already seeing issues in IE 11 on the client's PC).
So for each quiz question slide I have smartshapes which are acting as clickable text captions, like this:
Question text....
A. Answer choice a
B. Answer choice b
C. Answer choice c
D. Answer choice d
Each of the above answer choices is a smartshape button that is set to 'Execute Javascript' on click. In the javascript panel for each I have the following:
CORRECT_ANSWER = 'q1b';
ANSWER_CHOICE = (event.target) ? event.target.id : event.srcElement.id;
evaluate_answer(ANSWER_CHOICE, CORRECT_ANSWER);
In an external 'quiz.js' file I have the evaluate_answer function, which looks like this:
*********** quiz.js *************
var evaluate_answer = function (answerChoice, correctAnswer) {
  var answerChoice = window.cpAPIInterface.getVariableValue("ANSWER_CHOICE");
  var correctAnswer = window.cpAPIInterface.getVariableValue("CORRECT_ANSWER");
  if (answerChoice == correctAnswer) {
   cp.show('fb_q1_correct');
   cp.show('fb_q1_correct_next');
   cp.show('q1_answer_disabler');
  } else {
   cp.show('fb_q1_incorrect');
   cp.show('fb_q1_incorrect_next');
   cp.show('fb_q1_incorrect_remediate');
   cp.show('q1_answer_disabler');
*********** END quiz.js *************
The above works great in HTML5 output but not in the swf version. It looks like the swf version can't handle/pass the event.target, but that's just a guess.
Any ideas?

Hey again all,
The specific code importing the username isn't actually all that important, it's more of test to make sure that Javascript will actually work. I have a lot more code that needs to be processed as well, I'm using this as an example before I tackle the actual interworkings of the script. Therefore, I can't use a workaround, such as a system variable in the hyperlink, to pass the username.
I've now tried countless variations of methods of trying to run the JavaScript so far, including the ways that all of you have recommended. The only way the script will run is by my saving the file as a .htm and including an alert within the script in either the .htm file or in the .js file and calling from within the .htm. I haven't been able to get the process to run at all by including as an On Enter page action or as a .swf or by excluding the alert().  Can any of you get a Captivate 8 project with JavaScript to work as .swf alone on your server? Why does that alert have to before the setVariable in order for it to work in htm? I've changed the global security for Flash; is there another setting that I'm maybe missing?
Thank you all again for help. I'm completely stumped by this one!

Similar Messages

  • ExternalInterface not working when swf file is embed inside a dynamically cloned DIV element.

    ExternalInterface not working when swf file is embed inside a dynamically cloned DIV element.
    It seems that flash movie is identifed as 'undefined' inside document.
    //a statically placed div
    var staticdiv=document.getElementById('PropDiv');
    //dynamically placed div with object tag
    var dynDiv =staticdiv.cloneNode( true );
    var xD=50;
    var yD=50;
    if(dynDiv)
    dynDiv.style.display  = "block";
    dynDiv.innerHTML="<object classid=" + "\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"" + "codebase=" +
    "\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"" + "width=" + xD + "height=" + yD +
    "id=" + "\"external\"" + "align=" + "\"middle\"" + ">" +
                    "<param name=" + "\"allowScriptAccess\"" + "value=" + "\"sameDomain\"" + "/>" +
                    "<param name=" + "\"movie\"" + "value=" + "\"external.swf\"" + "/>" +
                    "<param name=" + "\"quality\"" + "value=" + "\"high\"" + "/>" +
                    "<param name=" + "\"wmode\"" + "value=" + "\"transparent\"" + "/>" +
                    "<param name=" + "\"bgcolor\"" + "value=" + "\"#ffffff\"" + "/>" +
                    "<embed src=" + "\"external.swf\"" + "quality=" + "\"high\"" + "wmode=" + "\"transparent\"" +"bgcolor=" + "\"#ffffff\""
    + "width=" + xD + "height=" + yD + "name=" + "\"external\"" + "align=" + "\"middle\"" + "allowScriptAccess=" + "\"sameDomain\"" +
    "type=" + "\"application/x-shockwave-flash\"" + "pluginspage=" + "\"http://www.macromedia.com/go/getflashplayer\"" + "/>" +
                    "</object>";
       dynDiv.style.top=50;
       dynDiv.style.left=100;
    document.body.appendChild(dynDiv);
    In above situation communication is not establised when a  funtion which is retruning boolean is called from flash using
    ExternalInterfcae.call.The return value of this function is getting as false inside flash.But the value is true in javascript.
    if (navigator.appName.indexOf("Microsoft") != -1) {
       return window[movieName];
      } else {
       return document[movieName];
    window["external"] is returning as 'undefined'.
    Please give a  solution to solve this.

    Note that you have different file names for the object (images/banner.swf) and the embed (images/banner1.swf)
    You also placed the embed in the middle of a param tag and nested all param tags.
    Because you didn't include a MIME type and the object doesn't have a classid for an ActiveX control for IE, I'm not sure what Firefox will be using.<br />
    The object doesn't have a data attribute to specify the file.<br />
    A separate embed is only needed when you specify a classid in the object.
    <pre><nowiki><div class="bannercontainer">
    <object width="940" height="445" type="application/x-shockwave-flash" data="images/banner.swf" >
    <param name="wmode" value="transparent" />
    <param name="movie" value="images/banner.swf" />
    </object>
    </div></nowiki></pre>

  • Help! Javascript not working when object moved from one page to another!

    Hello all:
    I am new to Adobe Livecycle Designer (version 8.0). I have created a 3 page interactive pdf form with numerous objects (text fields, radio buttons, drop-down boxes, etc.), that our business wants to begin using soon.
    I am having difficulty with some of my Javascript not working with a few of my objects on page 2 of the form. Specifically, there is a drop-down box for "Country" on page 2 of my form. When the user selects, for example, "United States" from the list, I have Javascript that is supposed to change the "Currency" drop-down box rawValue to "US Dollars" accordingly (upon the change event).
    I think my Javascript syntax is proper, but I am not certain. Here is my simple Javascript associated with the "Country" drop-down box (Note: rawValue 80 = "United States" and rawValue 105 = "US Dollars"):
    form1.Page1.cmbContactInfoCountry::change: - (JavaScript, client) -
    if (this.rawValue == 80) {     
         cmbCurrency.rawValue = 105;
    This seems pretty straight forward and it WORKS when my "Country" drop-down box is moved to page 1 of the form, but it WILL NOT WORK when I move the "Country" drop-down box back to page 2 of the form (which is where it belongs).
    Does anyone have any suggestions or solutions? I have spent probably 6-8 hours racking my brain trying to figure out why it works when on one page, but it does not work when move to a different page. I am guessing that I may have corrupted something OR that I am not fully addressing the proper name of the object?
    Please help!
    Frustrated and helpless near Chicago!
    Taylor T

    Hi Jono:
    Thank you for your quick reply.I was able to obtain the full name of the cmbCurrency object using the method you taught me. That is brilliant! Great short-cut tool.
    Unfortunately, I am still having issues with getting Javasript for the cmbCountry object to work with the cmbCurrency object. I haved pasted my new Javascript below.
    JavaScript for cmbCountry object:
    //UNITED STATES
    if (this.rawValue == 1) {
              xfa.resolveNode("form1.#subform[1].cmbCurrency").rawValue = 1;
    else
    //CANADA
    if (this.rawValue == 2) {
              xfa.resolveNode("form1.#subform[1].cmbCurrency").rawValue = 2;
    I have checked the "Specify Item Values" checkbox of the cmbCurrency drop-down object and Value 1 = "US Dollars" and Value 2 = "Canadian Dollars".
    When I select "Canada" from the cmbCountry drop-down object, the rawValue of the cmbCurrency drop-down object is changed to "US Dollars" (when it is clearly defined as "Canadian Dollars"). When I select "United States" from the cmbCountry drop-down object, the rawValue of the cmbCurrency drop-down object stays blank for uknown reasons. Very strange.
    Since I am not able to further explain in detail on what I am experiencing, I have posted a link to my file below (I just signed up for an account at ShareFile). I would forever be indebted to you if you can help me figure this out!
    https://thomptk.sharefile.com/?cmd=d&id=07ede2fe11db4549

  • Obfuscated JavaScript not works in safari 5.0.2

    Hi All,
    I'm very new to safari browser and currently makes my web application in safari. It works fine with few bugs in UN-obfuscated JavaScript.
    Obfuscated JavaScript not works in Safari. Kindly let me know the solution or set up. This is quite urgent and seeks for earlier response.
    Thanks in advance.

    For OS X javascript issues, post to the Unix or Developer forums under OS X Technologies. For windoze issues, I have no suggestions, since I don't do that technology.

  • Javascript not working in any browser except Opera! Please help!

    I don't know for what particular reason, javascript has stoppped working in all the browsers I have, (Safari, Firefox, Camino, OmniWeb,)except on Opera. Can anyone direct me in the right direction to solve this issue?

    Ok...
    1.) Unless it is a horribly designed site javascript not working would not prevent you from at least opening said site. You might not be able to use some of the features, or in the example of acual applications like gmail or then new yahoo mail you might not be able to use those at all since they are written soley for js. But for sites like VersionTracker it shouldnt make a difference.
    2.) Javascript is an interpeted language run on the client - ie the web browser. There is nothing to install. its part of the web browser youre using. You can uninstall and reinstall the browser itself but javascript is not a seperate component or something that is shared across applications that utilize it.
    Javascript is not the issue here at least in the case of versiontracker and 1010wins. I turned JAvascript off in my browser and visited both and they load jsut fine. Your eChalk mail might need js but i dont know about all that.
    So.... what happens when you try to visit one of these sites in one of the problem browsers???? Do you get a balck white screen? A server Error message? a DNS error? Does the app crash? etc..

  • Exit button not working Captivate 7 output to HTML5 and SWF

    I have several courses developed in Cp 6.5 that do not have this issue and are currently running on Taleo LMS.
    I've built a test course with 6 (mostly blank) slides, including two quiz questions. On the final slide I have placed a Finish Course button with On Success: Exit action. The project end options are set to close project and I've included an On Exit: Exit action on the final slide. The Finish Course button successfully closes the browser window in Preview in Browser (IE9) and Preview HTML5 output modes.
    I then published the course to both HTML5 and SWF output formats with scalable HTML selected. Once I uploaded the course to the LMS and tested it, the Finish Course button does not close the browser window. I've tested in IE9, Firefox, and iPad, and it doesn't work on any of these. I've also tried including the built in exit button on the playbar, and it doesn't close the window either. At the final slide, after clicking the Finish Course button, the slide fades to white and then stops.
    The LMS reports that the course is complete; I thought maybe it was an issue with the settings in the LMS course, however I have several other courses that were developed in Cp 6.5, published to the same LMS with the same "Exit" button on the final slide, and I have mirrored every course setting that has worked in the past.
    Any suggestions as to what could be keeping the window from closing?
    Thanks,
    PV

    Why does there need to be a button used now when in CP 6 and 6.5 it worked seamlessly? Will this be fixed by Adobe and when?
    Adam Lynch
    Senior Media Specialist
    Project Lead The Way, Inc.
    3939 Priority Way South Drive, Suite 200
    Indianapolis, IN 46240
    phone: 317.669.0845  | mobile: 518.469.7617
    fax: 317.663.8296
    www.pltw.org<http://www.pltw.org/>
    Preparing students for the global economy. Now even earlier.
    PLTW Elementary coming fall 2014. Click here to view the trailer<http://www.youtube.com/watch?v=rikLnSAoTpQ>.
    Confidentiality Notice: The information transmitted is the property of the sender and is intended only for the person or entity to which it is addressed and may contain confidential and or privileged material.  Statements and opinions expressed in this e-mail may not represent those of Project Lead The Way, Inc.  Any unauthorized review, retransmission, dissemination and other use of, or taking of any action in reliance upon, this information is prohibited.  If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and delete the material from any computer.  If you are the intended recipient but do not wish to receive communications through this medium, please so advise the sender immediately.

  • Right Click not working in published output.  ??

    I'm relatively new to Captivate, and NOT a developer, so please bear with me on this.
    I'm recording a training video of a basic application and have a need to use a right-click to bring up a menu.  This is a requirement of the app, so I need Captivate to provide the same functionality to avoid confusing the user going through the training video.  I have the Click Box options set to Right Click, and it works in the Preview.  However, when I Publish the finished video, the right-click does not work - only a left-click will advance to the next slide.
    I found a few threads discussing issues with the right-click, but all of them were dealing with permissions issues.  I'm saving the output to my desktop (Windows XP) and am launching the HTM file to confirm the video is working properly, so I don't see how a permissions issue would come into play.  ??  If it is a permissions issue, how do I fix it within Captivate so that the end user can run this from any PC/MAC, where I have no control of their permissions?
    Any suggestions or tips on how to get the right-click working in the final product are greatly appreciated.
    D

    Hi there
    The right-click function relies on JavaScript. JavaScript may also be influenced by the Flash Security Settings.
    Please try what is outlined in the link and see if your right-click suddenly begins working. Also note that you don't need to adjust these settings if you are serving content from a server. You only have to worry about it if you are testing by running from your local C drive.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Javascript not working in Firefox on Mac OS 10.9.2

    I am trying to learn Javascript from a tutorial. I'm using Text edit to create a simple .html file that calls a .js file using the script command. The .html file opens normally in the default browser and can print a message to a simple page. It looks like a window tries to open the .js file but it vanishes before opening. I have checked that Javascript is enabled in Firefox. Opening Firefox in Safe mode does not fix the problem. It also fails to execute the .js file in Safari and Chrome.
    This problem happens on three Macs, all running Mavericks 10.9.2. When I try this on a Windows PC the .js file executes as expected.
    I've tried everything I can think of including turning off the Firewall in Security Settings. It seems like it has to be something system-wide since it happens in all three browsers. Has Apple implemented some type of blocking of Javascript in Mavericks? Any suggestions for why this is not working on my Macs and what I can do to fix it would be greatly appreciated!

    Cor-el: Thank you for noticing that! Turning off smart quotes in Textedit which I am using to create the scripts solved the problem. Everything working as expected now. I hope others using Mac OS 10.9.2 will benefit from this as well.

  • External Javascript not working with C# and XAML windows phone app

    I've added a WebView into my project. If I navigate to the html file that contains external javascript files they don't work. Bit if I write the javascript code hardcoded into the html file it works properly.
    Here is the html portion:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta charset="utf-8" />
    <title></title>
    <script type="text/javascript" src="testjs.js"></script>
    </head>
    <body>
    <div id="abcd"></div>
    <br/>
    hello! this is a simple html block.
    </body>
    </html>
    Here is the javascript portion:
    document.getElementById("abcd").innerHTML = "New text!";
    When I open the webview it shows
    hello!
    this is a simple html block.,
    but if the javascript code worked it would show
    New
    Test! hello! this is a simple html block.
    And in the C# code the uri is called this way:
    url = onlineTestWebView.BuildLocalStreamUri("myUrl", "problem_page/test.html");
    StreamUriWinRTResolver myResolver = new StreamUriWinRTResolver();
    onlineTestWebView.NavigateToLocalStreamUri(url, myResolver);

    I assume this is because you are using NavigateToString. Please see
    http://blogs.msdn.com/b/wsdevsol/archive/2014/06/20/a-primer-on-webview-navigatetolocalstreamuri.aspx
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Capturing form values with javascript (not working in Safari!)

    Hi
    I'm working on a site and I need to be able to take the values of one form (that the user has entered) and use them to populate a second form (more details) in the appropriate input boxes. This works on all browser except Safari. It seems to me a javascript problem (as getElementById does not work properly) but I'm not entirely sure. The code I use to grab the form elements is as follows:
    obj = $('formslider".$this->id."');
    obj.getElementById('registerfirstname".$this->id."').value = callbackfirstname".$this->id.";
    obj.getElementById('registersurname".$this->id."').value = callbacksurname".$this->id.";
    obj.getElementById('registeremail_addr".$this->id."').value = callbackemail".$this->id.";
    obj.getElementById('registertelephone".$this->id."').value = callbacktelephone".$this->id.";
    obj.getElementById('registerrequest_type".$this->id."').value = requesttype_callback".$this->id.";
    This basically takes the values of the "callback" form and places them into the appropriate input boxes of the "register" form. However it seems to lose the values when moving to the next form. Please note, I am not refreshing - I am using Ajax to change the form so new content simply replaces an existing content, not transfering to another page. I use Sessions so it shouldn't forget the values.
    Can anyone help? It's quite an important thing as I need to migrate hidden form inputs too which are needed for this particular request system.
    Thanks
    Michael

    I'm seeing this same issue in Mavericks, 10.9.2.  Althought JavaScript is enabled in Safari, it just doesn't work, for any pages.
    I've tried different user accounts, including a new account, on the same machine, but they all do the same thing, so it's a machine-wide issue.
    I have plenty of other Mavericks machines, including my own, where it is working just fine, however, with the same settings.

  • Attach JavaScript not working in Acrobat Reader XI

    Hello,
    I created a fillable PDF in which I used the following JavaScript for an "Attach" button: 
    this.importDataObject("MyFile");
    This JavaScript worked and allowed the end user to attach files to the PDF in previous versions of Acrobat (through version 10 / Pro), but the button's functionality does not work in Adobe Acrobat XI.  The button has no functionality when clicked, and no errors are received indicating what the issue may be.
    Is there a bug that exists making this file not compatible with the Acrobat XI version, or is my coding outdated/inaccurate?
    Please advise and thank you for your help!
    Jessi Fenton

    Did you ever figure this out? I am also having problems with the "No Hand" javascript which turns off the (not very helpful) page-forward hand icon (a hand symbol with a down arrow) which confuses our users when in fullscreen mode. We create interactive PDFs and everything worked fine up to Acrobat X/Reader X. Now in XI it doesn't allow the internal link icon (pointing finger) nor weblink icon (pointing finger with W) to appear. It just remains a plain o’ hand icon no matter what you mouse over even though there are links present.

  • Javascript not working with web.show_document.

    Hi,
    I executed the below command from forms 10g and it is not working.
    web.show_document('javascript:var win=showModalDialog("http://otn.oracle.com/products/forms");','_self');
    But if I execute javascript:var win=showModalDialog("http://otn.oracle.com/products/forms"); directly in IE, then it is working.
    Frank, can you help me in this or any other people having any idea ?
    Very urgent.
    Thanks & Regds,
    Nandakumar

    Hi Mark,
    Thanks for your quick reply. Your question is right. I think let me explain clearly my requirement. I have an application accessed in the web. A internet user is trying to a report through the application by giving a parameter as "A". Now using the window.open method, the report is displayed in the IE browser. Now the user can go to history and can see the complete URL with parameters.
    If he just copies and pastes that url from history in the browser, the reports runs successfully. If he changes any of the parameter to "B", there is a chance that report will show the report for parameter "B". This should not happen.
    Hope this is clear. Let me know if you are not still clear. Moreover, in the IE it is possible to clear history, but for internet based applications, how can we set them.
    Thanks & Regds,
    Nandakumar

  • FLV. not working in SWF within HTML page

    I have created a SWF presentation which contains several videos as FLVs. The videos are uploaded to a folder on the clients server.
    The exported SWF and HTML files of the presentations worked perfectly when hosted on my local machine but when sent to the client, who uploaded to their own server, the SWFs ran but would not play the FLV files within. When they changed the HTML files to HTM they worked perfectly.
    However...when they embedded the pages into the content management system the use it required that the pages were reverted back to HTML, therefore the FLVs are not working again.
    The 'still' frame appears where the FLV should be, but the skin and the video itself does not load.
    Does anyone have any idea why this issue has occurred?
    Thanks in advance.

    @Ned
    Not sure about the folder structure of their site, to be honest they've been a nightmare client from day one so getting information like that out of them has been nigh on impossible.
    The flv files are all in a folder together and these are linked from the swf with this link structure: http://www.sitename.org.uk/folder/video.flv
    I'm not entirely sure how their CMS is structured. I was throwing this question out on the off chance that someone had seen a similar instance where HTML/HTM file types had affected functionality.

  • Javascript not working in htmldb

    Hi,
    I am using HTMLDB Release 2.
    The time I put some java script in page html header section and click on apply changes, it redirects me to wwv_flow.accept page can't be displayed.
    Please let me know how to correct this as I want to use javascript in my page.
    even the most simple script is not working
    ==============================
    <script type="text/javascript">
              <!--
    alert('hello');
    // -->
              </script>
    ==============================

    JavaScript is an event driven language; simply putting code on the page does not mean that it will be executed. You will need to have something call your code for it to run.
    In order to do that, you will need to use the proper syntax for a JavaScript function. Your code should read:
    <script type="text/javascript">
    <!--
    function jsDemo()
    alert('hello');
    // -->
    </script>Now, you can call the JavaScript function jsDemo() from a button, for example. Simply create a button, and set it to redirect to a URL. For thre URL, enter this:
    onclick="jsDemo()";There are many more ways to incorporate JavaScript into your applications - have a look on the APEX home page or this forum for some more examples.
    Thanks,
    - Scott -

  • Javascript not working when JSP container changed. Why?

    I'm migrating from Resin (if you happen to know what it is) to Tomcat.
    My web app runs fine on Tomcat, without any change in the code. What surprises me is that, javascript, which works perfectly fine while the webapp runs on Resin, seems to have problems when the webapps runs on Tomcat.
    This does not seem to make sense to me: javascript is executed on the client (browser) and should have nothing to do with the JSP container.
    Can someone tell me why, and how to fix this? Thanks!

    see if your browser supports something like a javascript console or debugger.
    e.g.:
    - MS InternetExplorer shows a warning icon in the left bottom corner if there is a javascript error. doubleclicking on it shows the error type and the location (url, line, char) where the error occured.
    - Mozilla supports a javascript console which shows up javascript errors or warnings.
    have a look at what the browser says on your errors.
    if your javascripts are hardcoded it HAS TO BE a browser (misinterpretation) or javascript error. serverside has definitively nothing to do with javascript...
    greetz,
    Thof

Maybe you are looking for