Copy link to clipboard
Copied
My 13 year old daughter is attempting to use Adobe Flash to create a play/pause/rewind button for an audio file. This is her first experience working with Adobe Flash and she has spent the last two days reviewing youtube videos and other tutorials...but most of these assume that you know the Java Script needed...which she does not.
Any direction is greatly appreciated.
One other question..we are having trouble importing mp3 files into Flash....is this a common problem? Is there a quick fix? These files play on various mp3 players...but will not import into flash.
Flash does not use Javascript, it uses Actionscript. What you/your daughter should be looking into is the Sound and SoundChannel classes of Actionscript 3. Search Google using terms like "AS3 MP3 player tutorial" and "AS3 Sound tutorial" you will likely find some things to get you started in a better direction.
If done right, you won't want to be importing the MP3 files, but instead you will want to load them dynamically. The tutorials that you will hopefully find should light the way.
Copy link to clipboard
Copied
Flash does not use Javascript, it uses Actionscript. What you/your daughter should be looking into is the Sound and SoundChannel classes of Actionscript 3. Search Google using terms like "AS3 MP3 player tutorial" and "AS3 Sound tutorial" you will likely find some things to get you started in a better direction.
If done right, you won't want to be importing the MP3 files, but instead you will want to load them dynamically. The tutorials that you will hopefully find should light the way.
Copy link to clipboard
Copied
Thank you very much!
We made some progress...and I will look do a Google search as you suggested.
Maybe you can answer a question? We have added the following to the script in Flash:
var isPlaying:Boolean = false;
We got the following error notice:
Scene1, layer 'as3', Frame1, Line5 1152: A conflict exists with inherited definition flash.display: MovieClip.isPlaying in namespace public.
What does that mean?
Copy link to clipboard
Copied
It appears to be confusing your variable with the isPlaying property of a MovieClip symbol (look up the MovieClip class and you will see that property explained). The easiest way out of it will be to rename the variable... maybe call it audioPlaying or something meaningful like that.
Copy link to clipboard
Copied
Thanks!
Copy link to clipboard
Copied
Thanks again for all of your help. We found a tutorial which seemed pretty straight forward, but we obviously missed something. Here is our new error message:
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at blahblah_fla::MainTimeline/playSong()
at blahblah_fla::MainTimeline/processXML()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
Here is the action script in our Flash file:
var my_songs:XMLList;
var my_total:Number;
var my_sound:Sound;
var my_channel:SoundChannel;
var myXMLLoader:URLLoader = new URLLoader();
myXMLLoader.load(new URLRequest("playlist.xml"))
myXMLLoader.addEventListener(Event.COMPLETE, processXML);
function processXML (e:Event):void{
var myXML:XML = new XML(e.target.data);
my_songs = myXML.SONG;
my_total = my_songs.length();
playSong(0);
}
function playSong(mySong:Number):void{
var myTitle = my_songs[mySong].@TITLE;
var myArtist = my_songs[mySong].@ARTIST;
var myURL = my_songs[mySong].@URL;
title_txt.text = myTitle;
artist_txt.text = myArtist;
my_sound = new Sound();
my_sound.load(new URLRequest(myURL));
my_channel = my_sound.play();
}
Here is the the xml file which is called playlist.xml
<?xml version="1.0" encoding="utf-8"?>
<PLAYLIST>
<SONG URL="audiofiles/virginia1of5.mp3" TITLE="First Track" ARTIST="" />
<SONG URL="audiofiles/virginia2of5.mp3" TITLE="Second Track" ARTIST=""/>
<SONG URL="audiofiles/virginia3of5.mp3" TITLE="Third Track" ARTIST="" />
</PLAYLIST>
Any thoughts?
Copy link to clipboard
Copied
you need a second Event:COMPLETE listener that is responsible for loading your sound,
described here: http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7d25.html
Copy link to clipboard
Copied
Thanks! She figured it out and it is now working. Really appreciate your help.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now