PDA

View Full Version : Absolute/Relative URL for including lzx files


3.14
05-07-2004, 12:03 PM
i'm trying to build a component library but i have a bunch of problems with paths...
in fact, some of my components include graphic stuff and when i want to set a resource in my class file i do:
resource="./mycomponent_pictures/pic.swf"
(the current class file is located in a folder named 'mylibrary')

i want to be able to use my library by a simple call to:
<include href="path/to/my/library/mylibrary.lzx">

(with path/to.... as ../../../mylibrary for example)

but when i put this in a lzx file located in foo/bar/blah, i get an error such as:
{urlofthelaszloserver}/foo/bar/blah/./mycomponents_pictures/pic.swf: 404 not found, which is logic...

hence my question:
how can i set up paths to avoid these problems i.e. to be able to include graphics into my library without 'including' troubles ?

antun
05-10-2004, 09:59 AM
Where is mycomponent_pictures/ relative to your new library file? When you write your own components, resources from the library file are relative to that library file, not the main application file.

For example, say you have a class (foo) that you want to make easy to reuse. You would save that in a .lzx file called foo/foolib.lzx. You could have an images folder inside of foo:


my-apps/
+-coolapp.lzx
+-foo/
+-foolib.lzx
+-images/
+-jack.jpg


So in foolib.lzx, you might have:


foolib.lzx
<library>
<resource name="fooimg" src="./img/jack.png" />
<class name="foo" resource="fooimg" />
</library>


When you wanted to use the foolib.lzx class in coolapp.lzx, you would do:


<include href="foo/foolib.lzx" />
<foo />


-Antun

3.14
05-12-2004, 07:45 AM
ok, i'm stupid, i wasn't paying attention whether i was setting images' source at runtime or compile-time...
thx