Question

I'm trying to set image source conditionaly using the following line:

source="{data.muted ? '/assets/audioMuted.gif' : '/assets/audio.gif'}"

Apps run fine when run from Flex builder, but when I try to export release build from Flex builder, those gif files are not exported.

Does anybody have an idea what to do in this case.

Was it helpful?

Solution

You need to embed the assets. Flexbuilder will never add an image to your swf unless you Embed it. If you looked at a tool such as fiddler to see what called your app is making you'd see one of those images being called and you can't have placed them into an appropriate folder.

[Embed("/assets/picture.gif")]
private const IMAGE1:Class;
[Embed("/assets/picture2.gif")]
private const IMAGE2:Class;

then you would do

source="{data.muted ? IMAGE1: IMAGE2 }"

that should do as long as the embed path is correct (flexbuilder will tell you if it isn't).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top