Hi there, I want to load symbols from the library in Flash using a .as file. I have a custom class that should trigger this to happen but I am not sure of the syntax to do it.
I have checked a tutorial:
http://www.bit-101.com/blog/?p=853
Which explains what to do but this does not seem to work when using flash alone.
Currently I have objects in my library names ‘star’, ‘square’ and 'circle. Here is my .as file:
[AS]
package
{
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class App extends Sprite
{
[Embed(source="library.swf", symbol="star")]
private var Star:Class;
[Embed(source="library.swf", symbol="square")]
private var Square:Class;
[Embed(source="library.swf", symbol="circle")]
private var Circle:Class;
public function App()
{
init();
}
private function init():void
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align=StageAlign.TOP_LEFT;
var star:Sprite = new Star();
addChild(star);
star.x = 100;
star.y = 100;
var square:Sprite = new Square();
addChild(square);
square.x = 200;
square.y = 100;
var circle:Sprite = new Circle();
addChild(circle);
circle.x = 300;
circle.y = 100;
}
}
}[/AS]
This runs but I can’t see my symbols,if someone could let me know the syntax to do this I would be very grateful
Thanks in advance
Schm