I want to link some images into a swc library in pure actionscript 3 开发者_开发知识库- is this possible?
You can use the [Embed]
tag to embed images (and any other data) in pure actionscript.
This is how I embed images for use as a BitmapData.
[Embed(source="/Path/To/MyImage.jpg")]
private static var _myImage:Class;
protected static var myImage:BitmapData = new _myImage().bitmapData; // instantiate embedded class
The final line is not required, but it means you can start using the embedded BitmapData straight away.
To bundle it all into an SWC (if you're using Flash), enable "export to SWC" in the Publish settings.
Absolutely:
1) in flash import the images to the library
2) export them for runtime sharing and give them class names
3) compile the project to a swc.
4) import the swc into your flex project and access the images by class name like you would any other class in an swc.
精彩评论