views:

704

answers:

3

Hi

This is my AC3 code

private function uploadet( dosya:String ):void {

     var uploader:URLRequest = new URLRequest(dosya);
      localFile.upload(uploader);
    }


     var a = flash.external.ExternalInterface.addCallback("uploadet",uploadet);

And this is Javascript

   <script type="text/javascript" src="swfobject.js"></script>
     <script type="text/javascript">

     swfobject.registerObject("myId", "9.0.0", "expressInstall.swf");



     function uploadet(dosya){
     var myFlashMovie = swfobject.getObjectById("myId");
       myFlashMovie.uploadet(dosya);
     }

        </script>        


<style type="text/css">
<!--
body {
    background-color: #e6e6e6;
    margin-top: 50px;
}
-->
</style></head>
    <body >
     <object id="myId" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300" height="120">
       <param name="movie" value="SimpleUploader.swf" />
             <!--[if !IE]>-->
       <object type="application/x-shockwave-flash" data="SimpleUploader.swf" width="300" height="120">
       <!--<![endif]-->
       <div>

       </div>
       <!--[if !IE]>-->
       </object>
       <!--<![endif]-->
      </object>
       <div id="flash"  align="center">

          </div>

        <div align="center"><b>Javascript Feedback:</b></div>
        <div align="center" id="output"></div>        

        <input type="button" name="Submit" value="Submit" onclick="uploadet('dsadsa.php');" />

I cant get it work, any help is appreciated.

Thanks

A: 

Your problem is that you are probably not reaching the right <OBJECT> element using:

var myFlashMovie = document.getElementById('simpleUploader');

Your nested tags have the same id attribute, producing unexpected results.

You should use SWFObject (a widely known and used flash embedding library) to embed your flash movie and use the method swfobject.getObjectById() to properly access your <OBJECT> tags.

To learn more about SWFObject, follow this link:

http://code.google.com/p/swfobject/

This is a beginners tutorial available from Adobe (for SWFObject):

http://www.adobe.com/devnet/flashplayer/articles/swfobject.html

Look for getObjectById() in the API documentation by following this link:

http://code.google.com/p/swfobject/wiki/api

Lior Cohen
yes, i made SWFObject and edited my question, but it is still not working.
Ahmet vardar
Mind providing some error message? what's happening when it's not working?
Lior Cohen
A: 

you must deploy the flash app on a webserver in order to test it (or make yourself a local web server). flash player won't allow you to use external interface if you load the file from local host as a file (file:///c:.....).

TheBrain
A: 

You cannot use the ExternalInterface without allowing scripting when you embed the SWF, read this Adobe Knowledge Base document for more information. In other words, use this HTML if you're embedding it directly on the page:

<object ... >
    .
    .
    .
    <param name="allowScriptAccess" value="always"/>
</object>

Or the following if you're using SWFObject:

var parametersObj = { allowScriptAccess: "always" };
swfobject.embedSWF(
    swfPath,
    targetElement,
    swfWidth,
    swfHeight,
    minFlashVersion,
    expressInstall,
    flashvarsObj,
    parametersObj,
    attributesObj
);
Rudisimo