Hello!
I have AS in main timeline:
for (var i:Number = 0; i < 10; i++) {
var pic_mc:thumb=new thumb();
pic_mc.name = "pic"+i;
stage_holder.addChild(pic_mc);
pic_mc.loadPic(pic_url);
creates movieclips like this:
stage_holder.pic0
stage_holder.pic1 etc.
Inside movieclip “thumb” I have movieClip named “b”, there I want to add loaded picture, but don’t know how to do it! Also I want to trace movieclip’s name “pic1”, "pic2"etc.
movieClip thumb has class:
package
{
import fl.transitions.*;
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.display.Loader
public class thumb extends MovieClip
{
private var myLoader:Loader;
public function thumb()
{
** //doesn't show movieclip name! **
trace("created "+ name);
}
public function loadPic(links:String)
{
var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderReady);
var fileRequest:URLRequest = new URLRequest(links);
myLoader.load(fileRequest);
}
public function onLoaderReady(e:Event) {
** //here I want to add picture to movieclip: stage_holder.pic1.b **
b.addChild(myLoader);
} }
}