Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    call ActiveXObject in javascript

    I try to use Javascript inside Actionscript which call MS word to read document. But it error when I initial ActiveXObject. Here is my code

    test.mxml

    ActionScript Code:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="absolute" creationComplete="init()">
        <mx:Script>
            <![CDATA[
            private var calledFromJSHandlerFunction:Function = calledFromJSHandler;
            private function init():void{
                html.addEventListener(Event.HTML_DOM_INITIALIZE, domInitialized);
                html.location = "htmlwithJS.html";
            }
            private function domInitialized(event:Event):void{
                html.htmlLoader.window.calledFromJSHandlerFunction = calledFromJSHandlerFunction;
            }
            private function calledFromJSHandler():void {
                mx.controls.Alert.show("ActionScript called from JavaScript", "Alert");
            }      
            ]]>
        </mx:Script>    
        <mx:HTML id="html" x="137" y="40" width="339"/>
        
    </mx:WindowedApplication>
    htmlwithJS.html

    Code:
    <html>
    	<script language="Javascript">
    		function loadworddoc(){
    	  		var doc = new ActiveXObject("Word.Application"); 
    	  		doc.Visible=false; 
    	  		doc.Documents.Open("C:\Sam\Sam.doc"); 
    	  		var txt;
    	  		txt = doc.Documents("C:\Sam\Sam.doc").Content; 
    	  		document.all.myarea.value = txt;
    	  		doc.quit(0); 
    		}
    	</script>
    	<body>
    		<input type="button"
    		value="Load"
    		onclick="loadworddoc()">
    		<br />
    		<textarea name="myarea">test now</textarea>
    	</body>
    </html>
    The message is : ReferenceError: Can't find variable: ActiveXObject

    Any one can give me some advice?

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Is this not Flex?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    New to the CF scene
    Join Date
    Dec 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I find a greate solution in http://aperture.fluorinefx.com/


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •