Skip to main content
Participant
June 18, 2014
Question

ERROR: 1037 PACKAGES CAN NOT BE NESTED... What am I doing wrong!? Plz & Thanks

  • June 18, 2014
  • 1 reply
  • 233 views

I have been working on this new player and interface for my Icecast radio stream. It's been a lot of trial and error, which I'm used to but I've been stuck on this part for 2 days now. I don't know if it's just me or maybe I don't understand what the error means but I've tried to remove the brace add another brace. I'm sure it's something simple I'm just tired of banging my head on the desk! Please help! Thanks, DJ Snowbunnie

package

{

import flash.events.MouseEvent;

import flash.media.Sound;

import flash.net.URLRequest;

import flash.media.SoundChannel;

import flash.utils.Timer;

   

public class SoundFacade extends EventDispatcher {

//Objects and Vars

        public var stream:Sound = new Sound();

        public var channel:SoundChannel = new SoundChannel();

        public var soundFile:URLRequest = new URLRequest("http://192.95.32.122:8355/stream");

        public var bufferTime:int = 1000;

        public var isLoaded:Boolean = false;

        public var isReadyToPlay:Boolean = false;

        public var isPlaying:Boolean = false;

        public var isStreaming:Boolean = true;

        public var autoLoad:Boolean = true;

        public var autoPlay:Boolean = true;

        public var pausePosition:int = 0;

        public static const PLAY_PROGRESS:String = "playProgress";

        public var progressInterval:int = 1000;

        public var playTimer:Timer;

        public function SoundFacade(soundURL:String, autoLoad:Boolean = true,

                            autoPlay:Boolean = true, streaming:Boolean = true,

                            bufferTime:int = -1):void{

            this.url = soundURL;

   

            this.autoLoad = autoLoad;

            this.autoPlay = autoPlay;

            this.isStreaming = streaming;

   

            if (bufferTime < 0)

            {

                bufferTime = SoundMixer.bufferTime;

            }

            if (autoLoad)

            {

                load();

            }

        }

   

//Listeners

btnPlay.addEventListener(MouseEvent.CLICK, playMusic);

btnPause.addEventListener(MouseEvent.CLICK, stopMusic);

//Functions

function playMusic(evtMouse:Event):void //PLAY

{

    myMusic.load(soundFile);

    channel = myMusic.play(lastPosition);

}

function stopMusic(evt:MouseEvent):void //

{

    lastPosition = channel.position;

    channel.stop();

        }

    }

}

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
June 18, 2014

Start by moving those event listener assignments into the SoundFacade function.  Then be sure to declare whether the two functions you are adding are public or private.  If they only get called within the class then they can be private.  THen neatly format the code you added to be similar to the formatting of what precedes it so that it is easier to read as a whole.