• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Any movie clip does not get removed after video player completes playing the video format in AS2

Explorer ,
Nov 30, 2024 Nov 30, 2024

Copy link to clipboard

Copied

class StoryMode extends SystemVideoPlayer
{
	var _timeline;
	var ns;
	var nc;
	var _borderLeft;
	var _borderRight;
	static var instance;
	var isVideoComplete = false;
	function StoryMode()
	{
		super.init();
		this.buildVideoPlayer();
	}
	static function getInstance()
	{
		if (StoryMode.instance == null || StoryMode.instance == undefined)
		{
			StoryMode.instance = new StoryMode();
		}
		return StoryMode.instance;
	}
	function buildVideoPlayer()
	{
		super.updateDisplay();
		this.videoWrapper = _root.attachMovie("VideoWrapper", "videoWrapper", _root.getNextHighestDepth());
		this._borderLeft = _root.attachMovie("borderLeft", "_borderLeft", _root.getNextHighestDepth());
		this._borderLeft._x = 0;
		this._borderLeft._y = 0;
		this._borderRight = _root.attachMovie("borderRight", "_borderRight", _root.getNextHighestDepth());
		this._borderRight._x = 747;
		this._borderRight._y = 0;
		this.videoInstance = Video(this.videoWrapper.getInstanceByName("video1"));
		this.resizeVideoPlayer(640,480);
		this.rePositionVideoPlayer(107,0);
		this.nc = new NetConnection();
		this.nc.connect(null);
		this.ns = new NetStream(this.nc);
		this.videoInstance.attachVideo(this.ns);
		this.ns.onStatus = function(info:Object):Void 
		{
			if (info.code == "NetStream.Play.Stop")
			{
				StoryMode.getInstance().destroyVideoPlayer();
				StoryMode.getInstance().isVideoComplete = true;
			}
		};
		this.ns.play("story.flv");
	}
	function destroyVideoPlayer()
	{
		if (this.ns != null)
		{
			this.ns.close();
		}
		if (this.videoInstance != null)
		{
			this._borderLeft._visible = false;
			this._borderRight._visible = false;
			_root.videoInstance.clear();
		}
		_root.videoWrapper.removeMovieClip();
	}
}

Greetings, I'm still working on that same project, but this time the video player. For some reason, after the video is complete, only either the video instance or the video wrapper gets cleared, not any other movie clips that have been attached such as the borders. I tried doing this:

 

if(this.border != null)
{
   this.border.removeMovieClip();
}

but that doesn't work.

 

these does not work either:

if(this.border != null)
{
   this.border._visible = false;
}
	function destroyVideoPlayer()
	{
		if (this.ns != null)
		{
			this.ns.close();
		}
		if (this.videoInstance != null)
		{
			this._borderLeft._visible = false;
			this._borderRight._visible = false;
			_root.videoInstance.clear();
		}
		_root.videoWrapper.removeMovieClip();
	}

 

	function destroyVideoPlayer()
	{
		if (this.ns != null)
		{
			this.ns.close();
		}
		if (this.videoInstance != null)
		{
			_root.videoInstance.clear();
		}
               _root.borderLeft.removeMovieClip();
               _root.borderRight.removeMovieClip();
		_root.videoWrapper.removeMovieClip();
	}

 

function destroyVideoPlayer()
	{
		if (this.ns != null)
		{
			this.ns.close();
		}
		if (this.videoInstance != null)
		{
			_root.videoInstance.clear();
		}
		_root.videoWrapper.removeMovieClip();
		if (_root.borderLeft != null)
		{
			_root.borderLeft.removeMovieClip();
		}
		if (_root.borderRight != null)
		{
			_root.borderRight.removeMovieClip();
		}
	}

All I want is for any other movie clip to get removed after the video is complete playing.

TOPICS
ActionScript , Other , Timeline

Views

34

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation