Problem with SWFloader when switch source.


i have difficult reload content swfloader. seems can not convert relative path correctly absolute path. here code

 


<fx:script>
  <![cdata[
   import mx.controls.image;
   import mx.controls.swfloader;

   private var myimg:image = new image;
   public function init():void{
    myimg.x = 100;
    myimg.y = 100;
    myimg.width = 200;
    myimg.addeventlistener(ioerrorevent.io_error,ioerrorhandler);
    myimg.addeventlistener(event.complete,myimgloadcompletehandler);
    myimg.load("./upload/1.jpg")
   }
   private function ioerrorhandler(e:ioerrorevent):void{
     mx.controls.alert.show(e.text);
    }
   private function myimgloadcompletehandler(e:event):void{
    var img:image = e.currenttarget image;
    myimg.removeeventlistener(event.complete,myimgloadcompletehandler);
    addelement(img);
   }
   public function imgchangebuttonclickhandler():void{
    removeelement(myimg);
    myimg.unloadandstop();
    myimg.addeventlistener(event.complete,myimgloadcompletehandler);
    myimg.load("./upload/1.jpg");   
   }

  ]]>
</fx:script>
<s:button id = "imgchangebutton" click="imgchangebuttonclickhandler()"/>

 

the html file contains swf located @ http://127.0.0.1:8080/swfloadertest/. swf file located @ http://127.0.0.1:8080/swfloadertest/swf/. image file located @ http://127.0.0.1:8080/swfloadertest/upload/

 

whenthe swf file loaded, image correctly loaded stage. when try reloaded click imgchangebutton, not

work. both time, use same relative path, why result different. know says in swfloader.as "// make relative paths relative

to swf loading it, not top-level swf". if obey rule, first load operation not work.

 

is know reason problem? lot!!!



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Hur installera Joomla på One.com - Joomla! Forum - community, help and support

removing index.php from URL address - Joomla! Forum - community, help and support

「イメージマップのアンカー名には、...」のエラーが出ないようにしたい