Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7703359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:26:23+00:00 2026-05-31T23:26:23+00:00

i am having problem in creating a video player in flash via as3, the

  • 0

i am having problem in creating a video player in flash via as3, the problem is that whenever i try to compile the project, the compiler error shows:

1120: Access of undefined property _stop.
1120: Access of undefined property _pause.
1120: Access of undefined property _play.
1180: Call to a possibly undefined method Button.
1120: Access of undefined property _prev.
1180: Call to a possibly undefined method Button.
1120: Access of undefined property _next.

And this keeps on going as much i’ve mentioned these objects, so please help me solve this. and am newbie so a bit hard for me to find the error.

as3:

import flash.events.MouseEvent;

var _xmlLoader      :URLLoader      = null;

var _urlRequest     :URLRequest     = null;

var _xml            :XML            = null;

var _netConn        :NetConnection  = null;

var _netstr         :NetStream      = null;

var _video          :Video          = null; 

var _currentVideoId :int            = 0;

var _isPlaying      :Boolean        = false;

var _soundTransform :SoundTransform = new SoundTransform();

var _volume         :int            = 1;

var _duration       :Number         = 0;

function Init():void

{
    _urlRequest = new URLRequest("vids.xml");

    _xmlLoader = new URLLoader();
    _xmlLoader = new URLLoader(_urlRequest);
    _xmlLoader.addEventListener(Event.COMPLETE, XMLLoaded, false, 0, true);
}

function XMLLoaded($e:Event):void
{
    _xml = new XML($e.target.data);
}

function SetupVideo():void
{
    _netConn = new NetConnection();
    _netConn.addEventListener(NetStatusEvent.NET_STATUS, OnStatusEvent, false, 0, true);
    _netConn.connect(null);

}

function OnStatusEvent(stat:Object):void
{
    trace(stat.info.code);
    switch(stat.info.code)
    {
        case "NetConnection.Connect.Success":
             SetupNetStream();
             break;
        case "NetStream.Play.Stop":
             _stop.enabled = false;
             _pause.enabled = false;
             _play.enabled = true;
             _isPlaying = false;
             _netstr.close();
             break;
    }
}

function SetupNetStream():void
{
    _netstr = new NetStream(_netConn);
    _netstr.addEventListener(NetStatusEvent.NET_STATUS, OnStatusEvent, false, 0, true);

    var $customClient = new Object();
    $customClient.onMetaData = onMetaData;

    _netstr.client = $customClient

    _video = new Video(500, 250);
    _video.smoothing = true;
    _video.y
    _video.x = stage.stageWidth/2 - _video.width/2;
    _video.attachNetStream(_netstr);
    addChild(_video);
}

function onMetaData($info:Object):void 
{
    _duration = $info.duration;
}

function SetupButtons():void
{
    _prev.addEventListener(MouseEvent.CLICK, PreviousVideo, false, 0, true);
    _next.addEventListener(MouseEvent.CLICK,NextVideo,false,0,true);
    _play.addEventListener(MouseEvent.CLICK, PlayVideo, false, 0, true);
    _pause.addEventListener(MouseEvent.CLICK, PauseVideo, false, 0, true);
    _stop.addEventListener(MouseEvent.CLICK, StopVideo, false, 0, true);
    _sound.addEventListener(MouseEvent.CLICK, SoundVolume, false, 0, true);

    _stop.enabled = false;
    _pause.enabled = false;
    _prev.enabled = false;
    _next.enabled = false;
}

function PreviousVideo($e:MouseEvent):void
{
    _currentVideoId -=1;

    _stop.enabled = true;
    _pause.enabled = true;
    _play.enabled = false;

    if(_currentVideoId < 0)
    {
        _currentVideoId = _xml.video.length()-1;
    }

    _videoName.text = _xml.video[_currentVideoId].@name;
    _netstr.play(String(_xml.video[_currentVideoId].@path));
}

function NextVideo($e:MouseEvent):void
{
    _currentVideoId +=1;

    _stop.enabled = true;
    _pause.enabled = true;
    _play.enabled = false;

    if(_currentVideoId == _xml.video.length())
    {
        _currentVideoId = 0;
    }
    _videoName.text = _xml.video[_currentVideoId].@name;
    _netstr.play(String(_xml.video[_currentVideoId].@path));
}

function PlayVideo($e:MouseEvent):void
{
    _play.enabled= false;
    _next.enabled = true;
    _prev.enabled = true;
    _stop.enabled= true;
    _pause.enabled= true;

    if(_isPlaying == false)
    {
        _isPlaying = true;
        _netstr.play(String(_xml.video[_currentVideoId].@path));
        _videoName.text = _xml.video[_currentVideoId].@name;
        addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
    }else{
        _netstr.resume();
    }
}

function PauseVideo($e:MouseEvent):void
{
    _play.enabled= true;
    _pause.enabled= false;
    _netstr.pause();
}

function StopVideo($e:MouseEvent):void
{
    _stop.enabled= false;
    _pause.enabled= false;
    _play.enabled= true;

    _isPlaying = false;
    removeEventListener(Event.ENTER_FRAME, Update);
    _netstr.close();
}

function Update($e:Event):void
{
    _track.value = (_netstr.time / _duration) * _track.maximum;
}

function SoundVolume($e:MouseEvent):void
{
    if( _volume == 1 )
    {
        _volume = 0;
        _sound.label = "Sound On";
    }else{
        _volume = 1;
        _sound.label = "Sound Off";
    }

    _soundTransform.volume = _volume;
    _netstr.soundTransform = _soundTransform;
}

Init();
SetupVideo();
SetupButtons();

And even i’ve converted this objects to button symbols.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:26:24+00:00Added an answer on May 31, 2026 at 11:26 pm

    Probably you forgot to assign instance name for the objects, which used as a _stop, _pause, _play buttons etc.

    And also check the “Export for the ActionScript” flag in the properties in the library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating a simple video player but I'm having problem to show the
I'm having a problem with creating 24/7 video player for my application on WPF
i am having a problem creating a regular expression that will validate if the
I'm having a problem with creating shortcuts at versions of WindowsXP that aren't in
I've been having a problem creating a checklist in the style of the TouchCells
I am having a problem with creating a navigation controller after on the other
Having a bit of a problem creating an instance of an object. Bear in
I seem to be having a problem creating new local variables inside a switch
We're having problems on windows creating a video file from gource ( gource ).
I am having problem creating a new directory inside my FTP using mkdir, here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.