Variables and Flash.
December 4, 2004 12:00 AM
Will the java calls work with flash version 8? I've tried it and the buttons don't work, is this the security in flash causing the problem and how do I get around it? (GetURL was modified for flash 8 to be more restricted for security purposes).Will the java calls work with flash version 8? I've tried it and the buttons don't work, is this the security in flash causing the problem and how do I get around it? (GetURL was modified for flash 8 to be more restricted for security purposes).
Discussion (26)
I'm not sure... It depends on how you are setting up your CD. If you are publishing it from lectora to a cd, or single file executable I don't think it will work. I think you would have to publish to HTML and put those files on the cd. In order for the flash to work you may have to add the parameter "allowScriptAccess" and set it's value to "always" I haven't published to cd's much so someone else may be more helpful. I'm not sure... It depends on how you are setting up your CD. If you are publishing it from lectora to a cd, or single file executable I don't think it will work. I think you would have to publish to HTML and put those files on the cd. In order for the flash to work you may have to add the parameter "allowScriptAccess" and set it's value to "always" I haven't published to cd's much so someone else may be more helpful.
Thanks Aaron!I had tried that ".add" command before but it wasn't working, but now for whatever reason, it does!On a related matter, is there a comprehensive list somewhere of the javascript commands that can be used in flash for communicating with Lectora?I know there's the basic next page, etc. ones, but what about a list of the more complex and complicated ones?Thanks for all your help, and have a great weekend!Joe
Yeah I've played with this in the embed in HTML when I was still trying to get my variables to pass in flash. (All to no avail I might add). Adobe have pretty much locked down GetURL.Thanks for the advice.One other item, and I've asked this seperately, but I get an error publishing to cd. The message is:Error copying runner files
That seems to work.Question, using the same code leaving it as flash 8 would I be able to republish as a cd-rom and GetURL would work?
Hi arron,Finally, I got SABA version 5 installed to my computer. I am trying to follow your instruction to find out the name of the swf object but I can't find the option "show HTML published object names." would you mind if give me more information about that.Here is what I have done: File > Preferences then I seethree tabs 1. General - show visibility check boxes in the left-hand pane.2.Editors3.Saba Content Thanks
I'm trying to insert two getURL() functions within a frame in Flash but it seems that it only executes the second getURL() funation and skips the first one.Any advise would be appreciated. Thanks.
getURL() function. getURL ("javascript:window.document.[name of Lectora-published .swf].SetVariable('yourVariable', LMSGetValue('cmi.suspend_data'))"); can anybody tell me how can I find out where [name of Lectora-published.swf] located?Thanks in advanceEdited By: lamk on 38443.5036574074
Thanks aaron.I found the name of the swf object from the HTML file after published the couse.
Sorry to seem dense, but I was looking for the same solution as HAILS was- a button in flash that changes a variable in lectora from 0 to 1...I went through this post and looked at the ZIP that was posted, but still can't seem to understand it. Can someone out there let me know how this is done?Thanks!JoeADDED: I tried adding this code to the Flash button:on (release) {getURL("javascript:VarVariableName.set('1')"); And having the variable "VariableName" in lectora, but when I publish to html and preview, I get an Explorer error when I click that button saying "VarVariableName" is undefined.Edited By: CDC_Joe on 2007-1-5 9:38:38
Is there a way to get a variable from Lectora, get a substring or split it out and then put it back in to the command to set the variable in the Flash file via the command below? getURL("javascript:window.document.swfanim592.SetVariable('s hwme',VarmyVariable.getValue())");
Hate to reply to myself but I figured it out. getURL is passing a string, and I was trying to do the work in the string, which Flash cannot understand.. neither can javascript. So you need to do the work in a variable. Below I used urlValue to build my string. I used the string function in Flash to convert _global.test to a string.urlValue ="javascript:VarmyVariable.set" + "('" + String(_global.test) + "')";getURL(urlValue);Last thing to know is that I found in Saba this locked up. So I had to put a few frames in advance so that Lectora could load all of the page elements first.Maybe this will help someone.SimonEdited By: spuleo on 38421.5996064815
lamk,I believe Saba 5 = Lectora 2004. It has always been 1 version behind Lectora releases. The html object name property was added in Lectora 2005.
Yup, that was it!I thought the variable only had to referenced on the page where the actual variable "action" was due to happen, not also on the page where the flash was located.THANK YOU FOR YOUR HELP!JoeADDED:Right now, I'm using the flash command:on (release) {getURL("javascript:VarTest.set('1')");}Is there some sort of command instead of the ".set" so I can add "1" to the variable? so each time you clicked, it added one?Edited By: CDC_Joe on 2007-1-5 10:31:57
In flash 8 getURL won't work if you are running it locally on your computer and are trying to access a resource outside of that. You may have to upload it to a webserver for it to function properly.You might try setting the parameter: "allowScriptAccess" to "always" or "sameDomain" if you are still having problems.Edited By: Hemingway on 2007-1-8 10:39:50
Passing variables between Lectora and Flash can be done through javascript. In order to change a Lectora variable in javascript, use the following Lectora variable functions in javascript: VarvariableName.set(new value)and if you wish to read in a Lectora variable use the function VarvariableName.getValue() Lectora variables are always declared with "Var" preceding the variable name you choose in Lectora. These commands can be issued in the Flash file by using the getURL() function. getURL ("javascript:window.document.[name of Lectora-published .swf].SetVariable('yourVariable', 'new value');The variable must also be accessed using a Lectora action somewhere on the page in order to get the variable declared in javascript for that page.Here is an example title: 2004-12-09_131357_Lectora_var_to_flash.zipEdited By: aaron on 38496.3798148148
Is your lectora variable referenced on the page?If not put an action on the page that:on showmodify variable - yourVariablevalue VAR(yourVariable)set variable contentsThis just set the variable to itself, but makes it available to be changed on that page.
This works great, but I am wondering if you can post a sample where flash sets a variable in lectora. Or pass along the code.Thanks for your help,Simon
Okay it works. I just need to change the publish settings in flash from local to network and the html run locally works.Thanks Hemingway for the response.
Only the first gets executed. Append the second function call to the first getURL function call so they execute in sequence.Only the first gets executed. Append the second function call to the first getURL function call so they execute in sequence.
lamk,If using Lectora 2005 or higher, you can obtain the name of the swf object by opening the title and go into the file/preferences menu and check the option to "Show HTML published object names."Once this is enabled go into the properties of your flash object and it will be displayed in the top right corner of the general tab. You should see something similar to "anim51". In this case the swf would be referred to as swfanim51.swf
Still having some problems with sending a var to Lectora from Flash. When I use the belwo script, I can send a string to LectoragetURL("javascript:VarmyVariable.set('hello from Flash')");However I want to send a variable. So when I sendgetURL("javascript:VarmyVariable.set(flashVariable)");I get that flashVariable is "undefined", even though I have declared it in flash. I even tried ((flashVariable)) so that flash would evaluate the variable. If anyone has any ideas I would love to hear them.Thank you,SimonEdited By: spuleo on 38421.4579976852
Is there a way for Flash to change a value of a User defined variable?In Lectora, I created a variable with an initial value of 0.In Flash, I want to create a button which will change the value of the variable to 1.Is there a simple simple actionscript to do this?Thanks!-hails
Thanks!!! This work great!Thanks!!! This work great!
Discussions have been disabled for this post