Avg. Rating 5.0
Tags:



Problem

I want to use FXG created from products like Illustrator or Fireworks within my subclassed Shape objects.

Solution

1. Create FXG file with Illustrator or Fireworks. 2. Save it to your project src/ folder. 3. You can use it like your own classes instantiated from Graphics

Detailed explanation

For example if you have NiceFlower.fxg in your /src/assets/ folder  you can use it in a different way.

1. Like any other class instantiated from Graphics


<s:Group>

<assets:
NiceFlower />

</s:Group>


2. Like source for BitmapImage

<s:BitmapImage source="{
NiceFlower}" />

3. Background image

<s:BorderContainer width="300" height="300"
backgroundImage="{NiceFlower}" backgroundImageFillMode="repeat" />

4. In another graphic asset as element

<s:Graphic xmlns:fx="http://ns.adobe.com/mxml/2009" 
  xmlns:s="library://ns.adobe.com/flex/spark" 
  xmlns:mx="library://ns.adobe.com/flex/mx" width="100" height="100" xmlns:assets="assets.*">
<assets:
NiceFlower />
</s:Graphic>

or as BitmapFill

<s:Rect width="300" height="300">
<s:fill>
<s:BitmapFill source="{
NiceFlower}" />
</s:fill>
</s:Rect>

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes