?
Solved

Adobe Captivate - can I pass Flashvars to the Captivate SWF, and how to I add an ActionScript to do that?

Posted on 2011-10-13
13
Medium Priority
?
856 Views
Last Modified: 2012-05-12
I have found some references that indicate that you can pass FlashVars to an Adobe Captivate generate swf files.

I have a page with a user account system and have access via javascript and a database to retrieve the logged in users username and e-mail address.  I would like to pass this to a Captivate generated .swf file so that I can use those parameters to populate the username and e-mail address that is requested when a user posts his quiz question answers, in my case, to a server via a PHP page.  Wondering if there is a way to do that via passing Flashvars to the swf flash file, and how to I add that functionality to my Captivate generated swf file.  I would also like to autopost the quiz answers once the user gets to the last page of the presentation or when they exit the presentation prematurely.  

I have my sample page here:

http://24.127.118.104/Breast/Breast.htm

Currently, when the user posts, they are prompted for a username and e-mail, and that is all manual.  I would like to autopost using the username and e-mailed passed in via my parent page using FlashVars.  Is that possible?
0
Comment
Question by:sscotti
  • 7
  • 6
13 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 36972084
0
 
LVL 5

Author Comment

by:sscotti
ID: 36972256
Very good, I kind of new that.  I was wondering how to modify the Captivate project so that I can capture these in the FLASH presentation and use them as described above.  It is kind of a multipart question.
0
 
LVL 5

Author Comment

by:sscotti
ID: 36972342
I edited the page a bit.  You can go to:

http://24.127.118.104/ directly and choose "Breast1" from the drop down to see what I am talking about.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 29

Expert Comment

by:dgofman
ID: 36972401
Yes, I can see you are detecting user selection, what's wrong?
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36972403
I only can see your URL to the tutorial SWF is invalid (404 Error page not found)

http://24.127.118.104/MMTracking.swf
0
 
LVL 5

Author Comment

by:sscotti
ID: 36973054
I think you are right about that. I think that I fixed it.  I am actually posting to an internal server.  However, that isn't really my currnet issue.  When I post results, it asks for a username and user e-mail.  I want to bypass the dialog that asks for that information and automatically post the quiz answers when the user answers the last question in the quiz.

<!-- Copyright [2008] Adobe Systems Incorporated.  All rights reserved -->
<!-- saved from url=(0013)about:internet -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Case Breast 1</title>
<script src="/cases/Breast/Breast1/standard.js" type="text/javascript"></script>
</head>



<body   bgcolor="#f5f4f1">
<center>

      <div id="CaptivateContent">&nbsp;
      </div>
      <script type="text/javascript">
         var so = new SWFObject("/cases/Breast/Breast1/Breast1.swf", "Captivate", "931", "729", "10", "#CCCCCC");
            so.addParam("quality", "high");
            so.addParam("name", "Captivate");
            so.addParam("id", "Captivate");
            so.addParam("wmode", "window");
            so.addParam("bgcolor","#f5f4f1");
            so.addParam("menu", "false");
            so.addVariable("variable1", "value1");
            so.setAttribute("redirectUrl", "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash");
            so.write("CaptivateContent");
      </script>


      <script type="text/javascript">
            document.getElementById('Captivate').focus();
            document.Captivate.focus();
      </script>
</center>
<div style="cursor:pointer;margin-top:-5px;" onclick="closeDiv();">Click here to close</div>
</body>
</html>

The part in bold I create dynamically, and I can add parameters, variables or modify the swf URL dynamically to pass in variables (i.e. the username and ermai).  The part that I am unfamiliar with is how to capture that information in the swf file and utilize it to automatcally submit the quiz answers to the MySQL server.

For testing purposes, it would be easier to add a couple of lines like:

so.addParam("FlashVars","username=sscotti&mySecondVariable=myemail")

but I need to take care of the backend in the Captivate generated FLASH.
0
 
LVL 5

Author Comment

by:sscotti
ID: 36973063
I do have this reference:

http://kb2.adobe.com/cps/164/tn_16417.html

but I am not sure how to implement that or if I can implement in a Captivate file.
0
 
LVL 5

Author Comment

by:sscotti
ID: 36973083
I also have this reference:

http://blogs.adobe.com/pdehaan/2006/07/using_flashvars_with_actionscr.html

which indicates how to create an AS in your .fla file to capture the passed FLASHVARS.

// AS3
var tf:TextField = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;
tf.border = true;
addChild(tf);

tf.appendText("params:" + "\n");
try {
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
for (keyStr in paramObj) {
valueStr = String(paramObj[keyStr]);
tf.appendText("\t" + keyStr + ":\t" + valueStr + "\n");
}
} catch (error:Error) {
tf.appendText(error.toString());
}

Open in new window


That might be enough info to get the variables into the FLASH, but I would still need to know how to access them to autosubmit the quiz answers.
0
 
LVL 29

Accepted Solution

by:
dgofman earned 2000 total points
ID: 36974835
So, you are developing this application? If yes, of course we can customize and pass parameters over SWF's using FlashVars, URL params or LocalConnection API

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/LocalConnection.html
0
 
LVL 5

Author Comment

by:sscotti
ID: 36974898
That might be a little out of my experience level.  I kind of have a workaround, but I would like to be able to pass in the username and email to the Captivate swf and tweak the way it submits quiz answers back to the server.  I also would maybe like to build a widget for Captivate to submit quiz data to my internal server without the user having to manually post the answers.  Kind of complicated.

If someone has skills in that area I'd like to continue a dialog offline and maybe discuss contractual work?

My working demo is still here:

http://24.127.118.104/

just choose the only case in the Breast drop down.

I am actually embedding the .swf directly from my page using query tools rather than using the .htm page generated by Captivate.

        flashembed("overlay", selectedpid, {
        quality:"high",
        name:"Captivate",
        id:"Captivate",
        wmode:"window",
        menu:"false",
        });

I can pass in parameters using that function I think.  Not sure how to retrieve them on the other end, and I've been talking to a number of Captivate developers.  They do not know of a way to submit quiz data back to a server without first displaying the quiz results page.
0
 
LVL 29

Expert Comment

by:dgofman
ID: 36974916
How difficult for you to share your existing code?
0
 
LVL 5

Author Comment

by:sscotti
ID: 36977445
Not too hard.  I actually think I found an excellent way to do this, but I am not familiar enough with AS and Captivate to flush out the details:

References here:

http://captivatedev.com/2011/09/30/reading-flashvars-in-adobe-captivate/

and here:

http://forums.adobe.com/message/2418448

Basically modifying the existing CaptivateMainTimeline.as file for Captivate to create:

function getFlashVar

I am not sure how to then use that in the Captivate file to retrieve the passed parameter and populate a field or variable in the presentation.
0
 
LVL 29

Assisted Solution

by:dgofman
dgofman earned 2000 total points
ID: 36977814
Look, you can use flashvars when you are opening an HTML page and would like to pass parametrs to SWF. When file already loaded (like your case) you have to pass by URL or using LocalConnection API
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This article discusses how to implement server side field validation and display customized error messages to the client.
Viewers will learn how to create and use Simpler instruments in Ableton Live. Load new Simpler into an empty MIDI track: Select a sample and drop it into sample window in Simpler: If sample is not pitched at C3, adjust tuning with Transpose para…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question