Author Topic: paths in the megazine.xml-file: what's the starting point?  (Read 3956 times)

0L4F

  • Newbie
  • *
  • Posts: 3
paths in the megazine.xml-file: what's the starting point?
« on: February 12, 2009, 04:09:18 pm »
Hello MightyPirates, thank you very much for developing MegaZine! Awesome coding!

At the moment I'm trying to load the megazine.swf into my main swf.
This works fine, and the megazine.swf then successfully loads the xml-file.

The problem I run into is that it doesn't find the images listed in the xml-file. Probably because their paths are wrong, and I don't understand what the paths inside the xml-file should be relative to.

I'd be really grateful for any hints that might help me solve this!

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: paths in the megazine.xml-file: what's the starting point?
« Reply #1 on: February 12, 2009, 08:07:05 pm »
They should always be relative to the megazine.swf, actually (as the paths are made absolute based on the url used in the loader of the megazine.swf - and from the inside it should not make a difference if it was loaded by itself or by another swf).

If that doesn't work it should be the swf loading the megazine.swf.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

0L4F

  • Newbie
  • *
  • Posts: 3
Re: paths in the megazine.xml-file: what's the starting point?
« Reply #2 on: February 13, 2009, 02:29:08 pm »
Hello Florian, thanks for your reply!

Unfortunately, I've tried both (relative to the megazine.swf and relative to the loader swf), and both give me the same result: the correct number of pages in the correct size (meaning that the xml has loaded succesfully), but the pages remain blank.

Here's what I'm doing in my loader swf:

Code: [Select]
var brochureLoader:Loader = new Loader();
brochureLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, brochureLoading);
brochureLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, brochureLoaded);
brochureLoader.load(new URLRequest("brochure/megazine.swf"));

function brochureLoading(e:ProgressEvent):void {
//
}

function brochureLoaded(e:Event):void {
brochureLoader.x=stage.stageWidth>>1;
brochureLoader.y=stage.stageHeight>>1;
addChild(brochureLoader);
}

stop();

In this scenario, the xml-file needs to be in the same directory as the loader swf in order to load.
Then, this is how I try to get to my images in the xml:

Code: [Select]
<img src="src/BPY650_YT_Brochure_SS09-Page1.jpg" aa="true"/>

If I put the src-folder in the same directory as the loader swf: no images show.
If I put the src-folder in the same directory as the megazine.swf: no images show.

What could be wrong? And: is there another (better?) way to embed megazine inside another swf?

Thanks in advance!

0L4F

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: paths in the megazine.xml-file: what's the starting point?
« Reply #3 on: February 13, 2009, 03:27:57 pm »
What you could do is see what kind of error (or if one at all) displays in the console: focus the flash by clicking on it and press #. If it fails loading an image it should show the path from which it tried to load the file.

Another method would be to not actually load the swf, but create a new instance of the MegaZine class in your code. You'd lose some functionality implemented in the Main class, though (SWFAddress, e.g.). Theoretically it should be possible to create a new instance of the Main class, too, but I didn't try that myself yet.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

0L4F

  • Newbie
  • *
  • Posts: 3
Re: paths in the megazine.xml-file: what's the starting point?
« Reply #4 on: February 13, 2009, 04:46:57 pm »
Ah, the console, great tip!

Got it working now, thanks to your tips and the console!
It turns out that the localisation xmls, the interface.swf, the elements-folder, the snd-folder and the src-folder all need to be in the same directory as the LOADER.swf.

Many thanks Florian!

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: paths in the megazine.xml-file: what's the starting point?
« Reply #5 on: February 15, 2009, 12:20:02 pm »
Good to hear that it works now. :)
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.