简体   繁体   中英

How to attach a file to swf(Actionscript)

Is there a way to attach some file to the swf, because by now I have to put all the files in the same folder where is the swf file, I want to attach all the images, mp3 and etc... files in compilation, and in the future without depending of the external files, is that possible?

[Embed (source="mb.mp3" )]

I've tried this but it doesn't save files in the swf

Add all the mp3 files to a new Fla-file and compile it to swc/swf. If you compile to swc, you can include it into your original swf by linking in the previously compiled swc file. If you compile the library file to SWF, you can load that file dynamically during runtime and then create instances of items in library.

Both solutions "require" that the mp3/image files exist in library with a linkage identifier.

You can create as3 code also by this

 [Embed(source="sample.mp3")]
 [Bindable]
 public var sampleMp3Cls:Class;

and sample.mp3 must be in assets directory otherwise you must give a relative path to Assets directory.

see how to embed a assets . may this link'll be helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM