开发者

as3 functions how dyname movieclip name?

How can I give this a dynamic name. I know this is simple but going from as2 to as3.

function Love(mc:MovieClip):void
{   
    var loadit = new Loader();
    loadit.load(new URLRequest(mc));
    addChild(loadit);
}

Love(one);

How do I change the "one" and "mc开发者_开发百科" to work?

thanks


In AS3 you don't really use the "name" of the movieclip anymore. You just store a reference to the instance.

I am not really sure what you are trying to do with your code. You Love method take a movieclip instance, but then you pass that reference to the new URLRequest constructor. But the URLRequest take a String. Have a look at the documentation if you get stuck.


I didn't get u completely at what u looking for, I've just added some coding.. just go through it.


var my_mc:MovieClip =  new MovieClip();

function Love(mc:MovieClip):void
{   
    //var loadit = new Loader();
    //loadit.load(new URLRequest(mc));
    this.my_mc = mc;
    addChild(my_mc);
    my_mc.x = my_mc.y  = 10;
    trace("called");
}

Love(one);// one is timeline based MC.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜