开发者

Call AS3-Parents function from AS2-Child

My parent ActionScript3 file has functions like these:

package  
{

    *lots of import.*

    public cl开发者_开发百科ass Tabu extends MovieClip
    {


        public function callMe(name:String) {
            trace("callme");
        }

        public function setPage(e:MouseEvent)
        {
            if (e.target.name == "btn_1")
                changePage("campana.swf");
            if (e.target.name == "btn_2")
                changePage("toma_tabu.swf");
            else if (e.target.name == "btn_3")
                veranoPage("verano.swf");
            else if (e.target.name == "btn_4")
                changePage("manda_tu_tabu.swf");
            else if (e.target.name == "btn_0")
                changePage("home_1_v2.swf");
        }

I need to call the setPage() function from a ActionScript2 child that has been loaded within the ActionScript3 file.

In AS3, it's being called like this:

btn_1.addEventListener(MouseEvent.CLICK, (parent as MovieClip).setPage)

In ActionScript2, tried the following for both setPage() and callMe(), but none works:

on(release){
    parent.setPage();
    this.parent.setPage();
    _root.parent.setPage();
    _parent.setPage();
    this._parent.setPage();
    _root._parent.setPage();
}

I'm starting to think it can't be done at all. Suggestions?


You can use LocalConnection, but communication between AVM1 and AVM2 movies can be tricky. Don't try to solve this yourself, use SWFBridge.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜