-
podcast/mp3 player
Hey there, I'm in need of some help. I'm making a flash device that plays through a podcast, giving the user the ability to skip to different parts of the podcast. An example of this is found here: http://www.cleanlink.com/cleantips/d...roTeami--25273
Here is the script I have so far:
Code:
import com.greensock.TweenLite;
import com.greensock.easing.*;
import flash.media.Sound;
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLRequest;
var loadtrack:URLLoader = new URLLoader();
var colors:Array = new Array();
var btnProps:Array = new Array();
var prop:Rectangle;
var request1:URLRequest = new URLRequest("Intro.mp3");
var request2:URLRequest = new URLRequest("Question_1.mp3");
var request3:URLRequest = new URLRequest("Question_2.mp3");
var request4:URLRequest = new URLRequest("Question_3.mp3");
var request5:URLRequest = new URLRequest("Question_4.mp3");
loadtrack.addEventListener(Event.COMPLETE, onLoaded);
for(var i:Number = 0; i < buttons.numChildren; i++)
{
var _btn:MovieClip = MovieClip(buttons.getChildAt(i));
_btn.buttonMode = true;
_btn.mouseChildren = false;
_btn.id = i;
_btn.addEventListener(MouseEvent.MOUSE_OVER, onOver, false, 0, true);
_btn.addEventListener(MouseEvent.MOUSE_OUT, onOut, false, 0, true);
_btn.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
colors.push(_btn);
var _rect:Rectangle = new Rectangle(_btn.x, _btn.y, _btn.width, _btn.height);
btnProps.push(_rect);
}
function onOver(e:MouseEvent):void
{
// prop contains the initial x,y,width,height properties of the targeted movieclip
prop = btnProps[e.target.id];
TweenLite.to(e.target, .2, {alpha:.7});
}
function onOut(e:MouseEvent):void
{
TweenLite.to(e.target, .2, {alpha:1});
}
function onClick(e:MouseEvent):void
{
switch(MovieClip(e.currentTarget).id)
{
case 0:
gotoAndPlay(2);
break;
case 1:
gotoAndPlay(3);
break;
case 2:
gotoAndPlay(4);
break;
case 3:
gotoAndPlay(5);
break;
}
}
function onLoaded(e:Event):void {
SoundMixer.stopAll();
}
I have each mp3 for each question on separate layers. Each of those layers has a keyframe with the audio file, on frame 2,3,4 and 5. I have this in each of the keyframes (with respect to their number):
Code:
stop();
loadtrack.load(request2);
loadtrack.play();
I am getting this error for each layer: "Scene 1, Layer '', Frame 1, Line 3 1061: Call to a possibly undefined method play through a reference with static type flash.net:URLLoader."
What can I do to make this work?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|