本文介绍了FXG和flex sdk的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有和fxg文件叫做Speaker.fxg和I试图导入它像一个包

  import扬声器; 

但编译时返回

<$ p $




$ p
$ b

b

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



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

不断收到此错误

<$ p $ $ m



$ b /FXG/FXGSpeaker.as(11):col:3:错误:无法转码Speaker.fxg。

我做错了什么?

或者也许是fxg本身的东西,这里是xml代码

 <?xml version =1.0encoding =utf-8?> 
< Library />
< Group id =speaker_mc>
//内部图形部分
< / Group>
< /图形>

我从这里使用了fxgeditor air app

我也试过使用A. Ilustrator导出的fxg文件编译但swf是空的我从来没有试过在一个纯粹的AS3项目中只做MXML。以下是我发现的一些事情:


  1. 您需要在某个Spark容器中使用FXG,这是编译器已知的合适目标。

  2. 您可以用自己的类来欺骗Spark容器,例如减少依赖关系。
  3. 欺骗可能并不总是有效,特别是在涉及到文本,因为它看起来像试图使用TLF来呈现文本,这是另一个超重的怪物... ...


    我已经上传了一个例如:它应该更好地解释它,我希望。

    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:

    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.

    这篇关于FXG和flex sdk的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 00:05