;

PDA

Click to See Complete Forum and Search --> : combobox and sound question


Putz
04-21-2007, 12:19 PM
Hi All,

Newbie here, trying to learn action scripting. I would like to thank all of the people here for all of the great exaples, I have learned a lot from them, however, I don't quite understand why some things work and others don't,
some guidence would be greatly appreciated. Also, any debug hints, tips, or tricks would be great.


First question is about sound. I tried many different combinations of code trying to get sound (playing mp3's) to work to no avail.( this was pre-koolMoves 6 - before the media player was added) Finally I found the
mp3 player example at Kool Exchange that used the variable name Sound
instead of mySound ( eg. Sound = new Sound(); instead of mySound = new Sound(); ) which when used, worked. Also, Sound lit up Blue in the AS editor, like the proerties and methods do, can someone explain why I had to use the varable name Sound ? and what's the significance of the blue text ?

second question is about the combobox, I found the example \Program Files\KoolMoves\Examples\Components\Flash 8\Examples\ComboBox\KC8_Example_ComboBox which runs fine in the example but doesn't work when I try to use this in another project. I even tried duplicating all of the code in another project and it still won't work. To me, it looks like the is an empty movie clip, and a dynamic text box, no frame based actions, only actions in the empty movie clip, which has (construct) and (load) actions. Am I missing something here ? Could it be that I didn't make the empty movie clip correctly ?

Mysteron
04-21-2007, 01:25 PM
I think you 1st question is for support. But I dont see why it important if any other variable will do.
As for your second question. Did you set the export options to Flash8 ?

w.brants
04-21-2007, 01:31 PM
can someone explain why I had to use the varable name Sound ?
It wasn't required. mySound works fine as long as you refer to the object as mySound once it has been created.

what's the significance of the blue text ?
When KM started to support Flash 7 and Flash 8 export, case sensitivity became important. Most reserved keywords turn blue when the case sensitivity is correct. So it's there to help the user write working code.

To me, it looks like the is an empty movie clip, and a dynamic text box, no frame based actions, only actions in the empty movie clip, which has (construct) and (load) actions.
There are several ways to set up a component. This is an example of dragging it from the symbol library on stage and add all code manually. It's not the easiest way. In general the most common way to set up a combobox is to insert it using the toolbox. That way you can also add the items using the gui.

tmoore935
04-21-2007, 01:34 PM
I belive you are looking at my mp3 player. I called it sound because thats what I wanted it to be. I used to call it s but that was just sloppy coding. New sound() is the class and sound is the name I gave it. I cannot answer the combo box question.

dniezby
04-21-2007, 05:16 PM
I have a combobox example available from another recent question about a combobox.
See if that helps you understand a combobox a little better.

Combobox Example (http://nsfilms.com/km/combo/Combobox.html)

Putz
04-22-2007, 08:16 PM
Hi All,

I want to thank all for taking the time to help me out. I know newbies can be a real pain in the backside, but I really do appreciate the help.

I went back and made a movie using a different variable name than "Sound" and got the sounds to work. I must have made a grammatical mistake and that's why it didn't work. Thanks for clearing that up.

Mysteron - I thought that maybe there were some special "movie" objects that needed to be used for certain things to work. Yes, I tried changing the export settings to flash 8 - but I still don't see the combobox. ( I will explain more later)

w.brants - I can hear you guys laughing already - but ultimately what I want to do is load a combo or list box from a xml file, so please tell me if my logic is all wrong here -
but making the thing at runtime seems like the way to go. I am able to drop a combobox in from the tool bar and load it up with items - just thought, maybe I can drop it in, leave the items empty and load it up later ? anyway, any guidence would be greatly appreciated.


tmoore - thanks buddy, if not for finding your example, I might still be without sound.


Back to the combobox question, what is so frustrating is that short of copying over the project file and renaming it I cannot make it work. The example runs fine, but I can drop a dynamic txt box and an empty movie clip in, copy and paste the actions from the combobox movie clip example to mine and it still doesn't work. Undoubtedly, I am missing something ! It might be in the way that I am creating the empty movie clip - I just press the add movieclip button - then press the mainmove button the return to the main movie, then add the actions to the movieclip actions property.

Thanks again,

w.brants
04-23-2007, 01:07 AM
I am able to drop a combobox in from the tool bar and load it up with items - just thought, maybe I can drop it in, leave the items empty and load it up later ?
Sure you can. It's the easiest way to do it.

dniezby
04-23-2007, 04:05 PM
I looked at your fun file and you don't have a combobox there. You have a movie clip named combobox but you didn't actually drop a combobox onto the stage.

Go to the tool box, select the components tool (next to the Text tool), click on it to open the rest of the options, move your mouse over to Combobox and click. It will insert a combobox.


Then you can use the code I posted to get your choices

Putz
04-23-2007, 07:29 PM
Ok, thanks for all of the replies

w.brants - are you saying tha the easiest way to do this is to drop the combo or list box in, and then use xml to load the labels and values ?

dniezby - ultimately, I would like to be able to load up the combo or list box dynamically from a xml file. If you go look in the koolmoves examples directory
KoolMoves\Examples\Components\Flash 8\Examples there are two projects, one example for a combo and one for a list, both of these examples contain a dynamic text box and empty movie clips which ,if you look at the actions of the movie clip, construct and load up the respective box ( either combo or list). These examples work great, but when I try to make these in my project, they will not work( I get and can se the dynamic text box, but there is no combo or list box.....undoubtedly I am doing something wrong, but I can't figure it out. As I stated earlier, I would like to be able to load the combo or list box via a xml file.

Actually, this is something I am working on for some friends that have a band. The box
will act as the playlist, I want the playlist to be editable via some external file ( xml ?)
so that I don't have to change the contents and make them a new swf every time they want to change the playlist, I started all of this before koolmoves 6 and the media player component. That would probably be the easiest route, but now that I am this far along, I would atleast like to figure out why I could not get it to work. So, from the above description of what I am trying to do. how would you suggest go about this ?

best regards,
John

dniezby
04-23-2007, 10:49 PM
That explanation is a lot better. Now I understand what you're trying to do.

Let me ask you this...Either way you're going to have to edit a file to change the songs. why not just do it in the fun file directly. KM is so simple to use, it would definately be faster than editing an XML file.

I can't help you with XML as I don't use them to load any content into any of my applications. However, here is the way that I would do it, if it were me making the file.

Create new movie file with ONLY the mp3 or video player in it.
Using the media player component add your playlist.
Save the file.

In your main movie use loadMovie to load the player. This way, if you're going to make changes they're easy to find and the file is small.

Again, just my opinion. Trying to keep it simple.

w.brants
04-24-2007, 01:09 AM
I started all of this before koolmoves 6 and the media player component. That would probably be the easiest route
The media player component supports external playlists so that would indeed be the easiest route.

For your current approach, you have to parse a xml file into an array of items and set the combobox using the setItems function.

Putz
04-24-2007, 06:31 PM
I want to thank everybody thats taken the time to help me out. It is greatly appreciated, hopefully at some point I can give some back.

W.brants - I got two more question for you, you're last reply said that media player supports external playlist, I can't seem to figure that out. When adding items I had a
playlist from windows media player in the directory, the load file box would only allow
flv,gif,jpg,mp3 & png's.

also, do you or anybody know anything about Frequency data display ? and how do you use it ?

thanks

w.brants
04-25-2007, 02:27 AM
The external playlist it supports is a simple text document, not a playlist from windows media player. From the API file ...
setExternalPlaylist ( playlistfile, nr [, paused ] )
----------------------------------------------------
playlistfile : external file containing the playlist. Each line contains one item
in the format label | value

example :

My first media file | MyMusicFile.mp3
My second media file | MyVideo.flvAssuming your playlist file is named mylist.txt and you want to start playing at the beginning of the list, you add a line of actionscript like mediaplayer1.setExternalPlaylist('mylist.txt',0); to the frame. In case you want to use an external playlist, make sure you don't set any items using the gui.

The frequency data is precalculated data that is stored in a file with the extension .fd
The filename should be identical to the mp3 filename except for the filename extension. Also the extension mp3 should only contain lowercase characters. If such an fd file is in the same directory as the mp3 file, KM will offer a checkbox you can check if you want to use the frequency data.

To precalculate the frequency data, there's a small application for registered KM users named MP3FDCreator that you can download from www.koolexchange.com (category Tools).

dniezby
04-25-2007, 04:25 PM
Wow, that IS easier. Good stuff.

Putz
04-25-2007, 07:03 PM
thanks a million W. One more and I'll go away for a while, where did you find the documentation for setExternalPlaylist ? I am having a hard time with this because I don't know where to get this type of documentation. I fiddle about with delphi (visual pascal) which has wonderful documentation. when you type listbox. a nice drop down menu appears and you can see all methods and properties for that node.

I workd for a few hours last night with the xml file. I found the koolpic example and watched the xml tutorial from gotoandlearn. I pretty much copied the example changing things to my needs and got it working, except for the urls and label arrays I made to hold the info are only valid inside of the xml load function - same palce where koolpic loads the first pic and caption, when I try to access the arrays outside they are empty ,so I am still trying to figure that out.

thanks again everybody

w.brants
04-26-2007, 01:13 AM
where did you find the documentation for setExternalPlaylist ?
If you look at the C:\Program Files\KoolMoves\Examples\Components\Flash 8\API directory there should be some information about the components that come with KM.

For me it's a bit easier since I wrote those files. :D
Unfortunately I'm not very good at documenting. I'm better at responding to questions. Since I created the components I tend to document to little since a lot of things that are obvious to me might be confusing to others.

As for context help, that's up to Bob. The actionscript window has a button 'add syntax' that lists a lot of properties but the list doesn't include the components or flash 8 additions.

Putz
04-26-2007, 09:53 PM
Yeah, the context help would be great, but until you pointed me to the API's, I had no clue as to what some of the parameters that were being passed did, or what to even pass them. This looks like a a really valuable resource, appecitae it.