Apache flex Flex:调用嵌入的swf函数仍然失败,请帮助!

Apache flex Flex:调用嵌入的swf函数仍然失败,请帮助!,apache-flex,actionscript,Apache Flex,Actionscript,我正在将一个swf文件嵌入到父swf文件中,父swf文件中的代码希望调用嵌入swf文件中的函数。它总是失败,下面是代码。错误如下: var播放器:testflv1=(loader.content作为SystemManager)。应用程序作为testflv1 无法编译它,因为testflv1未被识别为已知类型 父swf的代码: 专用函数applicationComplete():void { //loader.load(“http://localhost:8000/testflv1.swf");

我正在将一个swf文件嵌入到父swf文件中,父swf文件中的代码希望调用嵌入swf文件中的函数。它总是失败,下面是代码。错误如下:

var播放器:testflv1=(loader.content作为SystemManager)。应用程序作为testflv1

无法编译它,因为testflv1未被识别为已知类型

父swf的代码:


专用函数applicationComplete():void
{
//loader.load(“http://localhost:8000/testflv1.swf");
返回;
}
公共函数callfunction():void
{
跟踪(“加载完成”);
显示('hello');
var播放器:testflv1=(loader.content作为SystemManager)。应用程序作为testflv1;
//播放器设置大小(320240);
player.playVideo();
返回;
}
受保护的功能按钮1\u clickHandler(事件:MouseeEvent):无效
{
//TODO自动生成的方法存根
callfunction();
}
]]>

嵌入式swf的代码:


专用函数applicationComplete():void
{
//var nc:NetConnection=newnetconnection();
//nc.connect(空);
//var ns:NetStream=新NetStream(nc);
//var vid:视频=新视频(320240);
//这个.addChild(vid);
//参见附件流(ns);
//ns.播放(“http://www.mediacollege.com/video-gallery/testclips/20051210-w50s.flv");
svid.play();
返回;
}
公共函数playVideo():void
{
svid.play();
返回;
}
公共函数pauseVideo():void
{
svid.pause();
返回;
}
]]>


swfloader通常用于在Flex应用程序中加载和播放Flash电影。如果您想在运行时加载其他功能,最好使用模块;它们是专为您所要做的事情而设计的。

swfloader通常用于在Flex应用程序中加载和播放Flash电影。如果您想在运行时加载其他功能,最好使用模块;它们是专为你想做的事情而设计的

        private function applicationComplete():void
        {
            // loader.load("http://localhost:8000/testflv1.swf");
            return;
        }

        public function callfunction():void
        {
            trace("loadedCompleted.");
            Alert.show('hello');

            var player:testflv1 = (loader.content as SystemManager).application as testflv1;
            // player.setSize(320, 240);
            player.playVideo();
            return;
        }

        protected function button1_clickHandler(event:MouseEvent):void
        {
            // TODO Auto-generated method stub
            callfunction();
        }

    ]]>
</fx:Script>
<mx:SWFLoader id="loader" horizontalCenter="0" width="100%" height="362" source="http://localhost:8000/testflv1.swf"/>
<s:Button x="211" y="376" label="Button" click="button1_clickHandler(event)"/>
        private function applicationComplete():void 
        {
            //var nc:NetConnection = new NetConnection();
            //nc.connect(null);

            //var ns:NetStream = new NetStream(nc);
            //var vid:Video = new Video(320, 240);
            //this.addChild(vid);

            //vid.attachNetStream(ns);

            //ns.play("http://www.mediacollege.com/video-gallery/testclips/20051210-w50s.flv");

            svid.play();
            return;
        }

        public function playVideo():void
        {
            svid.play();
            return;
        }

        public function pauseVideo():void
        {
            svid.pause();
            return;
        }
    ]]>
</fx:Script>
<s:VideoPlayer id="svid" source="http://127.0.0.1:8000/jacko.flv" bottom="0" left="0" top="0" right="0"/>