You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by OmPrakash Muppirala <bi...@gmail.com> on 2014/12/02 01:07:04 UTC

Re: How it is compiling Assets.as to Assets.swf

Gautam,

There are multiple ways you can use/reuse FXG in your Flex apps

1) You can instantiate FXG inline in your MXML code like any other
component.  I use that a lot in my MXML based skins.

<s:Group>
    <assets:MyFXG top="10" left="10"/>
<s:/Group

2) You can also instantiate it and add it to the display list in AS3:

var upIconClass:Class  = assets.fxg.MyFXG;
var upIconInstance:DisplayObject = new upIconClass();
addChild(upIconInstance);

3) If you must use it as a source for an image, you could do something like
this:

<s:BitmapImage id="img" source = "{assets.fxg.MyFXG}" />

One caveat is that this will cause the FXG to get rasterized.  So, you lose
the capability of scaling up/down of the asset in runtime, which IMO is one
of the best features of vector graphics.

Hope this helps.

Thanks,
Om

On Wed, Nov 19, 2014 at 3:05 AM, Gautam Pandey <gk...@gmail.com> wrote:

> Hello Users,
>     I am trying to figure our how FXG can be reused and embed as class to
> be used in Image or Bitmap as source. One way I guess is to convert it to
> swf as it is done in sdk under
>  \sdk\frameworks\projects\framework\assets\Assets.as
>
> But I could not figure out how they have converted it to swf. Whether I can
> use same thing with maven build or not?
>
> Thanks & Regards
> Gautam Pandey
>