Call Us: +1-888-227-1645
How to embed images and videos in Adobe Flex applications

Embedding Assets in Flex

Eric Meyer

1 min read

Just working on another fun project here, and I thought that I would share something that I don’t see alot of Flex developers doing out there. That is organizing your image assests into asset classes as constants. It’s an easy way to keep everything organized, and reduce your overhead, because you can creatre classes that encapsulate a skin or graphics set for a particular task. If you want to learn how read on…

Encapsulating image assests in flex is easy. The trick is to organize the packages and classes in the right way. I like to create a package called assets. This is where I put all my sounds, images and assoc. creative. Inside the assets package, create a class for each UI section. For example you would have a class path like ‘assets.NavigationBar’ or ‘assets.InfoPanel’ . – whatever you need.

Inside the class, just embed your assets like this:

[Embed(‘//assets/yourclass/bluehashbackgrd.png’)]
public static const BLUESTRIPES:Class;

Now that asset is availible to any class where you import the yourclass class to. Just reference the var BLUESTRIPES, or whatever the var name is.

Happy Coding!

From the blog

Latest Articles

Let's build something amazing together

Give us a ring and let us know how we can help you reach your goals. Or if you'd like, start a chat. We're usually available 9-5 EST. We try to respond to every inquiry within one business day.

Phone number
+1-888-227-1645

Technologies and services we work with:

Laravel Laravel
WordPress WordPress
React ReactJS
EmberJS EmberJS
woocommerce WooCommerce
next.js NextJS
gatsby Gatsby
Shopify Shopify
VueJs VueJS
contentful Contentful
next.js JAMStack
gatsby Laravel Jigsaw
WPEngine WP Engine
Laravel Livewire Laravel Livewire
Netlify Netlify