Step Reference the mcAudio Player Movie Clip

After we have done that, the next task will be to change our class so that it officially references the mcAudioPlayer movie clip that we created. We can do this by simply stating that our class derives from the MovieClip class. This can be done using the extends keyword, when we declare our class as follows:

// Import all dependencies import flash.display.MovieClip;

import flash.media.Sound; import flash.media.SoundChannel; import flash.net.URLRequest; // Declare our class public class AudioPlayer extends MovieClip

// Constructor function

// Called when someone creates a new AudioPlayer public function AudioPlayer()

// Make sure we call the MovieClip constructor super();

// Make sure to create our sound object sound = new Sound(); // Initialize the position, position = 0;

// Let us know that we created this player. trace( "AudioPlayer created!" );

Was this article helpful?

0 0

Post a comment