電話:
import fl.video.*
import NSPv4;
var playVid:NSPv4 = new NSPv4();
playVid.playVideo(this.parent);
クラス:
package
{
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.events.*;
import flash.net.*;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundMixer;
import fl.video.*;
public class NSPv4 extends MovieClip
{
var __PARENT;
var __PARENT1;
public function playAudio(_PARENT):void
{
__PARENT = _PARENT;
var audioLabel:String = _PARENT.currentLabel;
var audioLabelNum:String = audioLabel.replace("sct","audio/");
audioLabelNum += ".mp3";
var vo:Sound = new Sound(new URLRequest(audioLabelNum));
var channel:SoundChannel = new SoundChannel();
channel = vo.play();
channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
}
public function playVideo(_PARENT1):void
{
__PARENT1 = _PARENT1;
var videoLabel:String = _PARENT1.currentLabel;
var videoLabelNum:String = videoLabel.replace("sct","audio/");
videoLabelNum += ".f4v";
var videoPlayer:FLVPlayback = new FLVPlayback();
videoPlayer.source = videoLabelNum;
_PARENT1.addChild(videoPlayer);
}
public function onPlaybackComplete(event:Event):void
{
SoundMixer.stopAll();
MovieClip(__PARENT).nextFrame();
}
}
}
問題なく playAudio を呼び出すことができますが、playVideo() を試すと、次のエラーが発生します。
1195 Attempted access of inaccessible method playVideo through a reference with static type NSPv4
ビデオが playAudio() 関数なしで独立するように別のクラスを設定しましたが、これも機能します。
最も混乱しています!