ruchi18 0 Light Poster

Hi,
i have an application inaction script & java script .I m calling a javascript function by actionscript Fscommand but it gives error as "Object Required" can anyone solve this error....
i have paste code below of javascript....

<html>
<head>
<title>save</title>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script language="javascript">

var outputFilename="outputFromFlash"
var outputFormat="txt"

function savefun(str){
	document.execCommand("saveAs",true,outputFilename + "." + outputFormat);
    //getIFrameDocument('editorWindow').execCommand("bold",true, outputFilename + "." + outputFormat);
    //document.getElementById('editorWindow').contentWindow.focus()
	alert("inside save fun")
}


var InternetExplorer=navigator.appName.indexOf("Microsoft"!=-1)
function save_DoFSCommand(command,args){
	var testsaveobj=InternetExplorer ? save:document.save;
		switch(command){
		case "save":
		savefun();
		break;
		case "initfun":
		init();
		}
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub save_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call save_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
}

function getFlashMovieObject()
{
   if (navigator.appName.indexOf("Microsoft Internet")!=-1)
   {
     return window.save;
   }
   else
   {
     return window.document.save; 
   }     
}
</script>>
</head>
<body bgcolor="#ffffff">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script language="javascript">
	if (AC_FL_RunContent == 0) {
		alert("This page requires AC_RunActiveContent.js.");
	} else {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', '550',
			'height', '400',
			'src', 'fscommand',
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'window',
			'devicefont', 'false',
			'id', 'save',
			'bgcolor', '#ffffff',
			'name', 'save',
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','always',
			'movie', 'save',
			'salign', ''
			); //end AC code
	}
</script>


	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="save" align="middle">
	<param name="allowScriptAccess" value="sameDomain" />
	<param name="allowFullScreen" value="false" />
	<param name="movie" value="save.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />	
    <embed src="save.swf" quality="high" bgcolor="#ffffff" width="550" height="400" name="save" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
	</object>
<script language="javascript">
var flashMovie1=getFlashMovieObject();
activate();
</script>
</body>
</html>



& code for actionscript.....

save.onRelease()
{
	var str=_root.input_txt.text
	trace(str)
	if(str=="")
	{
		trace("type some text")
	}
	fscommand("save",str)
}

where save is btn name.....

Thanks in Advance

Ruchi

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.