FXG and flex sdk

I have flex sdk 4.6 installed and I want to compile AS3 class that uses FXG file for simple graphics.

I have and fxg file called Speaker.fxg and I tried to import it like a package

import Speaker;

But when compiling it returns

Error: null

Also tried this

[Embed(source='Speaker.fxg')]
private var Speaker:Class;
private var sp:Sprite = new Speaker();

and this

[Embed(source='Speaker.fxg')]
private var Speaker:Class;
private var sp:Speaker = new Speaker();

and keep getting this error

Error: no transcoder registered for mimeType 'text/fxg'

    [Embed(source='Speaker.fxg')]
 ^

 /FXG/FXGSpeaker.as(11): col: 3: Error: Unable to transcode Speaker.fxg.

what do I do wrong?

or maybe is something with the fxg itself, here is the xml code

 <?xml version="1.0" encoding="utf-8" ?>
<Graphic version="2.0" viewHeight="200" viewWidth="200" xmlns="http://ns.adobe.com/fxg/2008" xmlns:fxg="http://ns.adobe.com/fxg/2008" xmlns:d="http://ns.adobe.com/fxg/2008/dt">
<Library/>
 <Group id="speaker_mc">
  // internal graphic part
</Group>
</Graphic>

I used the fxgeditor air app from here http://fxgeditor.7jigen.net/

I also tried using A. Ilustrator exported fxg file and it compiles but the swf is blank


I never tried to do it in a pure AS3 project, only MXML. Here are some things I found:

  • You need to use FXG in some Spark container, that is specifically known to the compiler as a suitable target.
  • You can spoof that Spark container with your own class such as to reduce dependencies.
  • Spoofing might not always work, especially if related to texts, as it looks like it's trying to use TLF to render text, which is another overweight monster...
  • I've uploaded an example project: http://www.filedropper.com/frameworklessfxg it should explain it better, I hope.

    链接地址: http://www.djcxy.com/p/18312.html

    上一篇: 如何使用Image Magick将SVG转换为PNG?

    下一篇: FXG和flex sdk