Embedding Resources


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. package
  2. {
  3. import flash.display.Sprite;
  4. import flash.display.StageAlign;
  5. import flash.display.StageScaleMode;
  6. import flash.display.Bitmap;
  7.  
  8. public class DocumentClass extends Sprite
  9. {
  10. [Embed(source="library.swf", symbol="star")]
  11. private var Star:Class;
  12.  
  13. [Embed(source="library.swf", symbol="square")]
  14. private var Square:Class;
  15.  
  16. [Embed(source="library.swf", symbol="circle")]
  17. private var Circle:Class;
  18.  
  19. [Embed(source="picture.jpg")]
  20. private var Picture:Class;
  21.  
  22. public function DocumentClass()
  23. {
  24. init();
  25. }
  26.  
  27. private function init():void
  28. {
  29. stage.scaleMode = StageScaleMode.NO_SCALE;
  30. stage.align=StageAlign.TOP_LEFT;
  31.  
  32. var star:Sprite = new Star();
  33. addChild(star);
  34. star.x = 100;
  35. star.y = 100;
  36.  
  37. var square:Sprite = new Square();
  38. addChild(square);
  39. square.x = 200;
  40. square.y = 100;
  41.  
  42. var circle:Sprite = new Circle();
  43. addChild(circle);
  44. circle.x = 300;
  45. circle.y = 100;
  46.  
  47. var picture:Bitmap = new Picture();
  48. addChild(picture);
  49. picture.x = 400;
  50. picture.y = 100;
  51.  
  52.  
  53. }
  54. }
  55. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.