Hi to everyone,
I have been trying to add a movieclip to my .fla file from a class.
my main fla file: main.fla actionscript file: script.as
they stay in the same directory.
script.as file as follows:
package {
import flash.display.*
public class MyClass extends MovieClip
{
public var target:MovieClip;
public function MyClass()
{
init();
}
public function init() //if this method will be runed only inside class it should be private not public
{
trace('created');
}
public function create()
{
target = new myfan();
target.x = 400;
target.y = 50;
stage.addChild(target);
}
}
}
I use create function to create add the movieclip from main.fla file.
var trying:MyClass = new MyClass();
trying.create();
The output give "created" but i connot see "myfan" movieclip inside the outputted swf file.
I have been searching all the day but could not find very much.
How can i add a movieclip from a class file?
Thanks for your kind help.