This content has been marked as final. Show 7 replies
make the image in the same folder as your Application
That's not the problem, my image is in the right folder and the embedded one is displayed just fine.
I've downloaded FlexBuilder (trial) and I get the same result when I try the swf that is created. However if I use the .html it works. So I guess the problem comes from my way of testing.
Anyone knows how to create the .html docs without flex builder ? I couldn't find any information about it.
I believe that setting -use-network=false is a mistake. It prevents you from having a web app and requires you to install physically to the file system.
Why are you using it? Relative urls work just fine.
Running a swf from the file system in the stand-alone Flash Player is different than running it from a server in a browser.
I've tried with both -use-network true or false and it's the same. For the moment I'm just testing my application in the local file system, with relative location such as "doc/myimage.jpg". I don't think that's the problem anyway since it works with "embed".
I think the problem comes from the way I test my swf, it should be embedded in an html file. Do you know how I can create one ?
Are you doing this all in Flex Builder? If so, then if you delete the first Image tag, and then clean your project and rebuild, I bet the second line will work. Here is what is happening: After Flex Builder compiles your code, it then copies any images etc. which were NOT embedded over to the "bin" folder. That way, if for example you had <mx:Image source="filename.gif"/>, then filename.gif gets copied over to the 'bin" folder because it was not embedded.
However, if an image WAS embedded, then it is not copied to the "bin" folder, on the assumption that you don't want it there. You embedded it in the SWF, so there is no need to copy it.
This is almost always the desired semantics. But in your experiment, you wrote code in a way that makes sense while experimenting with the technology, but that someone probably wouldn't do when writing a "real" app, and the result is that Flex Builder thought "oh, that image is embedded, no need to copy it."
Take a look in your "bin" folder -- if both Image tags are in your source, and you clean and rebuild, "bin" probably will not have the image. But if you remove the embed line and clean and rebuild, "bin" will have the image.
Ok thanks for the explanation. However, the weird thing is that my example actually workss with FlexBuilder. The problem is when I simply use the command line compiler.