The Ultrashock Ultra Bundle
  • Home
  • Community
  • Forum
  • Flash
  • Flex
  • Thread
  •  
  • Previous topic
  • Next topic
Sign up to post

Flash
 Flex

  • Nutrox Author 
    • 7611 
    • 0 
    • 0 
    Embed Flex Assets - Without using Flex
    Nutrox

    No comments yet

    Be the first to comment

    Posted: Jan 15 2009, 06:58 AM

    by Nutrox

     

If you use Flex Builder you will no doubt have taken advantage of the handy [Embed] metadata tag to embed external files directly into a class. One thing that has always annoyed me slightly is the way the generated asset classes are all forced to extend Flex-specific classes such as mx.core.BitmapAsset, not a problem if you are using the Flex framework but what if you just want to use the FP10 SWC and avoid the Flex framework altogether?

No problemo.

Because the Flex asset classes do nothing more than extend native Flash classes (BitmapAsset extends Bitmap etc) you can create those Flex asset classes in your project library and Flex Builder will be more than happy to use them. For example, let us say we have created an ActionScript project, removed the Flex SDK from the Library Paths, and imported the FP10 SWC instead. What you do now is simply recreate the mx.core directory structure and create the required asset classes. Your bare-bones ActionScript project might look like this…

[font=courier new]Project[/font]
[font=courier new]Project / bin[/font]
[font=courier new]Project / src[/font]
[font=courier new]Project / src / mx[/font]
[font=courier new]Project / src / mx / core[/font]
[font=courier new]Project / src / mx / core / BitmapAsset.as[/font]
[font=courier new]Project / src / Main.as[/font]

...and the BitmapAsset class in that example would look like this…

package mx.core
{
    import flash
.display.Bitmap;

    public class 
BitmapAsset extends Bitmap
    {}
} 

Done! You can now happy embed images into your classes without Flex Builder moaning, and you can do the same thing for any of the other asset classes such as ByteArrayAsset or SoundAsset etc.

good

  0 REPLIES
 
  •   Log in or join for free to make a comment.
 
Topic actions
  •  Share on Facebook
  •  Share on Twitter
Topic Categories
  •  Show All Topics
  •  Development
    •  Server Side
    •  Client Side
  •  Creative Software
    •  Web
    •  Video
    •  3D
    •  Illustrator
    •  Photoshop Battles
    •  Photoshop
  •  Design
    •  Typography
    •  Resources & Insight
    •  Checkpoint
  •  Career
    •  Copyright Matters
    •  Advice & issues
    •  Job Seekers
    •  Job Offers
  •  Flash
    •  UltraMath
    •  OOP
    •  Third Party Tools
    •  Open Source alternatives
    •  Data Communication
    •  Components
    •  Flex
    •  AIR
    •  Flash Lite
    •  Flash Professional
    •  Flash Newbie
    •  ActionScript
    •  XML
  •  Lounge
    •  Polls
    •  Random Chat
    •  Showcase And Critique
    •  BombShock Award Nominations
  •  Community Essentials
    •  BombShock Award Winners
    •  Tutorials
    •  Interviews
    •  News
    •  Bitmap tutorials
Popular Topics
  • Sort by: 
  • Activity
  • Views
  • Comments
  • Likes
Advertise with us
  • Your advertisement here!
  • loading
Ultrashock
  • Creative Assets
  • Community
  • Blog
  1. Home
  2. Forum
+/-
Creative Assets
  • Categories
  • Contributors
  • How to buy
Make Money
  • Commission Rates
  • Referral Program
  • Contributor Program
Community
  • Activity Feed
  • Forum
  • Profiles
About
  • Quick Tour
  • Our History
  • Banners & Logos
Support
  • Contact Ultrashock
  • Advertise with us
  • Legal Information
  •  Keep up to date
  • Flash 775  Flash
  • Audio 6,481  Audio
  • Vector 2,130  Vectors
  • Image 12,338  Images
  • Creative Assets 21,724  Assets
  • Profiles 282,659  Members
  • Topics 93,762  Topics
  • Blog 4  Blog
  • Facebook 1,680  Facebook
  • Twitter 1,165  Twitter
  • Join our FREE monthly newsletter!
  • Archive
  • Invalid email address. Please try again.
Subscribe
  • ©2012 Ultrashock LLC - All rights reserved
  • Terms of Use
  • Privacy Policy
  • Switch to dark theme
  • RSS Feeds
  • Top

©2012 Ultrashock LLC - All rights reserved

Printed on Sat, February 04, 2012 - 18:57:33