Skip to main content
April 29, 2011
Answered

Problem displaying swf

  • April 29, 2011
  • 1 reply
  • 987 views

Hey, I have several swf's and I can embed them within html without problem.  However, one swf is causing me problems.  This swf has an animation on the stage as a preloader.  The rest of the swf is then completely run through an external as3 class.  The as3 class loads an xml file and prepares the images.  When its complete, it removes the loader removeChild(preloader); (the original animation which was displaying).  If I run the swf on my computer, everything works great.  As soon as I embed it, all that happens is the preloader animation constantly plays, and it never gets to the point to display the images.  Is there something I need to do when I embed this swf into html to get it to work properly?

cheers

This topic has been closed for replies.
Correct answer Ned Murphy

If the swf file is in a different folder than the html file, then you are probably not targeting the xml file or other files properly.  The swf needs to target files it loads as if it is in the same folder as the html page that embeds it.

1 reply

Ned Murphy
Ned MurphyCorrect answer
Legend
April 29, 2011

If the swf file is in a different folder than the html file, then you are probably not targeting the xml file or other files properly.  The swf needs to target files it loads as if it is in the same folder as the html page that embeds it.

April 29, 2011

kool.  Still having a bit of an issue though.  So I have display.swf within a folder called swf (swf/display.swf).  Within this swf folder, I also have two more folders; xml and classes.  classes holds the as3 file, and xml holds the xml file.  So the structure is like

swf/display.swf

swf/classes/Main.as

swf/xml/images.xml

Further more, the swf folder is in my Root folder.

RootFolder/swf/display.swf

RootFolder/swf/classes/Main.as

RootFolder/swf/xml/images.xml

Within this RootFolder is a folder called pages which holds my html pages.

RootFolder/Pages/index.html

So index.html loads up the swf in swf/display.swf.  This swf is created through an as class held in swf/classes/Main.as.  This class calls up an xml file located at swf/xml/images.xml.  At the moment, I make the call like so

...

loadXML("../xml/images.xml");
}

private function loadXML(file:String):void
{
      var urlLoader:URLLoader = new URLLoader();
      var urlReq:URLRequest = new URLRequest(file);

      urlLoader.load(urlReq);
      urlLoader.addEventListener(Event.COMPLETE, handleXML);
}

I have also tried several other things, including the absolute url to the xml file on my server, but it dont seem to want to load it.  As I say, when I run the swf through flash, everything works great.  Its only when it is embedding into html when it stops working.

aneelbakshi
Inspiring
April 29, 2011

have u tried

loadXML("../swf/xml/images.xml");

if your html page is out of swf folder

and u can check your xml structure also. may be their is bug in your xml structure. U can test it by opening it in broswer. it will show u error message if there is error in nesting of tags or entity.