Search code examples
apache-flexflex4flash-builderflex4.5

Flex embed swf : blank if embedded with spark works if linked or with mx


I have a very strange error in Flex

<s:Image  width="27" height="39" source="assets/cards/down.swf"/>

Works perfectly (down.swf is a swf with no script inside at all)

But

<s:Image  width="27" height="39" source="@Embed('assets/cards/down.swf')"/>

Shows me nothing at all !

Any idea why ? (I tried with PNG and JPG and with PNG/JPEG everything works normally.

and it works with

<mx:Image  width="27" height="39" source="@Embed('assets/cards/down.swf')"/>

Regards


Solution

  • This is expected behavior. You're trying to load a SWF using an Image component.

    <mx:Image> extends the <mx:SWFLoader> class. As such, you can imagine that an <mx:Image> therefore has the ability to load SWF files.

    However, the <s:Image> does not extend <mx:SWFLoader>, it extends SkinnableComponent.

    As such, you cannot use <s:Image> to work with SWF files like you could with <mx:Image>. I would recommend you use a <mx:SWFLoader> instead.