If you are wondering how you can add sexy JPG or fantastic PNG or "copied/borrowed" SWF to your boring SWF without editing the FLA, then below is an example on how to do it.
In this example, I will show you how to add an image to stage after using the embed statement.
package {
public class EmbedResourcesExample1 {
[Embed(source="../images/HelloWorld.png", mimeType="image/png")]
private var MyImage:Class;
public function EmbedResourcesExample1() : void {
var image:Bitmap = new MyImage();
addChild(image);
}
}
}
This next example, I will show you how to embed a SWF to your main SWF.
package {
public class EmbedResourcesExample2 {
[Embed(source="../images/HelloWorld.swf", symbol="hello")]
private var MySWF:Class;
public function EmbedResourcesExample2() : void {
var mySWF:Sprite = new MySWF();
addChild(mySWF);
}
}
}
And there you have it. With the above samples, you can now successfully add JPGs or PNGs or SWFs to your main SWF file.
Related Links:
Error transcoding
Embed Fonts
u can do so much more in just two lines png bitmap jpeg , its all good !, try
ReplyDeletehttps://github.com/ammarahmedkhan/Display.as ;-)