Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Supporting Technologies > HTML and JavaScript

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-02-2004, 06:34 AM   #1
davevs
Registered User
 
Join Date: Nov 2004
Posts: 1
Default Javascript Flash Comms

I am currently developing eLearning modules using Flash and the SCORM standard. SCORM requires FLash and javascript to communicate. The method currently employed by most it seems is fscommand. I would prefer to use GET and POST with sendAndLoad, since fscommand has platform and browser issues (not that get and post don't). I have used GET and POST successfully with PHP etc but not with javascript the following example illustrates my point.

Actionscript:
ActionScript Code:
myLoadVars = new LoadVars(); myLoadVars.sendAndLoad("javascript:hello();",myLoadVars,"POST");
This fragement is intended to call a function hello() in the HTML page which just raises an alert.

HTML/Javascript:
HTML Code:
<HTML>
	<HEAD>
	<meta http-equiv=Content-Type content="text/html;  charset=ISO-8859-1">
	<script language="javascript">
	   		function hello() {
		   		alert("hello");
			}
	</script>
		
	</HEAD>
<BODY bgcolor="#FFFFFF">
<!-- URL's used in the movie-->
<!-- text used in the movie-->
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
 WIDTH="800" HEIGHT="600" id="Untitled-1" ALIGN="">
 <PARAM NAME=movie VALUE="Untitled-1.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="Untitled-1.swf" quality=high bgcolor=#FFFFFF  WIDTH="800" HEIGHT="600" NAME="Untitled-1" ALIGN=""
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>
</BODY>
</HTML>
My problem: This works in Mozilla, but not in IE.

Any ideas .....

Last edited by CyanBlue; 02-11-2005 at 03:33 PM.. Reason: AS tag is applied
davevs is offline   Reply With Quote
Old 02-11-2005, 03:17 PM   #2
binkyboo
Senior Member
 
binkyboo's Avatar
 
Join Date: Mar 2002
Location: Madison, Wisconsin
Posts: 1,307
Send a message via MSN to binkyboo
Default

Just a note to those who may run a search on SCORM, there is no SCORM conformant method for Flash content to communicate with a LMS through methods such as Web services or HTTP requests. Data element parameters must be sent through an API for communication to occur between a SCO and the LMS.
__________________
SCORM School:http://academiccolab.org/scormschool
binkyboo is offline   Reply With Quote
Old 02-11-2005, 06:33 PM   #3
tg
done
 
Join Date: Jun 2001
Location: portland, or
Posts: 8,048
Default

here's an example of something you might try...
this is what i did on a project i wrote about 2-3 years ago:
Code:
//html file that holds the flash file
<script language="JavaScript">
<!--//hide
	
	function centerMe(){
		var moveToX, moveToY;
		moveToX=(window.screen.availWidth-870)/2;
		moveToY=(window.screen.availHeight-600)/2;
		window.moveTo(moveToX,moveToY);
	}
	//set up a function to tell the page that opened this page to load the selected provider
	//then close this page
	function openParent(pcsa,pn){
		window.opener.location.href="../match.cfm?pcsa="+pcsa+"&prov="+pn;
		window.close();
	}
//unhide -->
</script>
ActionScript Code:
// code to interface with javascript         pm.onRelease = function() {             getURL("javascript: openParent('"+loader.pcsa+"','"+this.provNbr+"');");         };

sometimes you may need to add void(0); to your getURL... like:
getURL("javascript: myfunction();void(0);");
__________________
tg
---
what the hell was i thinking?
tg is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:26 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.