FXG and flex sdk

送分小仙女□ 提交于 2019-12-12 03:23:30

问题


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


回答1:


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

  1. You need to use FXG in some Spark container, that is specifically known to the compiler as a suitable target.
  2. You can spoof that Spark container with your own class such as to reduce dependencies.
  3. 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.



来源:https://stackoverflow.com/questions/9514044/fxg-and-flex-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!