Create an Account!

Adobe Flash Community Forum for all your Flash, Actionscript and Swift3D Support

Search:
FlashDevils Community
 Recommend Us
 About FlashDevils Community
 Can i become a moderator?
 How do i add Flash to my post?
 
Flash Community Register Flash Forum Control Panel Calendar Member List FAQ Search FLA Files
FlashDevils Community FlashDevils Community > Board > Flash > Flash ActionScript > ComboBox Component setChangeHandler


  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
TGixer
Young Devil

Registered: Mar 2002
Local time: 11:47 AM
Location: Albany, NY, USA
Posts: 133

ComboBox Component setChangeHandlerPost #1

Has anyone played with this funtionality.

i want to use a combo box, so when a user selects a choice from the list, it then executes some code.

i dont really understand what they say in the help.

here is some example code;

code:
toyList.setChangeHandler("myHandler"); function myHandler(component){ trace(toyList.getSelectedItem().label); }


however, where should i put this code. on the actual component, if i do then i need an OnClipEvent.

im lost on this.



Report this post to a moderator | IP: Logged

Old Post 07-31-2002 06:48 AM
TGixer is offline Click Here to See the Profile for TGixer Click here to Send TGixer a Private Message Click Here to Email TGixer Find more posts by TGixer Add TGixer to your buddy list Edit/Delete Message Reply w/Quote
kristin
Young Devil

Registered: Jul 2002
Local time: 11:47 AM
Location: Toronto, ON
Posts: 166

Post #2

it sounds like it should be within an if/else statement that is checking the value of what is selected and then changing the handler set in the parameters of the combo box based on what selection has been made.

do the users have to hit a button to confirm their selection? if so, this statement would go on the button. am i understanding your question correctly?
--K

__________________
--K
aka:K-dog



Report this post to a moderator | IP: Logged

Old Post 07-31-2002 07:22 AM
kristin is offline Click Here to See the Profile for kristin Click here to Send kristin a Private Message Find more posts by kristin Add kristin to your buddy list Edit/Delete Message Reply w/Quote
TGixer
Young Devil

Registered: Mar 2002
Local time: 11:47 AM
Location: Albany, NY, USA
Posts: 133

Post #3

well,

not really, i figured it out.....you have to write a function, and then in your component properties reference that function call.

i have it working, now im trying to make 2 boxes work dependently,

ie, select an album name, which in turn populates box 2 with the correct song names to select.....

im almost there..just NOT quite right.

thanks though



Report this post to a moderator | IP: Logged

Old Post 07-31-2002 08:54 AM
TGixer is offline Click Here to See the Profile for TGixer Click here to Send TGixer a Private Message Click Here to Email TGixer Find more posts by TGixer Add TGixer to your buddy list Edit/Delete Message Reply w/Quote
TGixer
Young Devil

Registered: Mar 2002
Local time: 11:47 AM
Location: Albany, NY, USA
Posts: 133

Post #4

I GOT IT FIXED!!



Report this post to a moderator | IP: Logged

Old Post 07-31-2002 09:01 AM
TGixer is offline Click Here to See the Profile for TGixer Click here to Send TGixer a Private Message Click Here to Email TGixer Find more posts by TGixer Add TGixer to your buddy list Edit/Delete Message Reply w/Quote
kristin
Young Devil

Registered: Jul 2002
Local time: 11:47 AM
Location: Toronto, ON
Posts: 166

Post #5

sounds very useful.. i'd love to see a quick and dirty .fla example if you're willing to post , i've used the list box and radio buttons components with changeHandlers a lot, but not the combo box yet.
--K



Report this post to a moderator | IP: Logged

Old Post 07-31-2002 09:06 AM
kristin is offline Click Here to See the Profile for kristin Click here to Send kristin a Private Message Find more posts by kristin Add kristin to your buddy list Edit/Delete Message Reply w/Quote
TGixer
Young Devil

Registered: Mar 2002
Local time: 11:47 AM
Location: Albany, NY, USA
Posts: 133

Post #6

actually, im updating my MP3 player.

ck it out.
its NOT 100% fixed yet. but it will be!

here is the code i used:
2 combo boxes
Droppy and Song_Names (i know dumb names)


i created an action on frame 1 with this code.

code:
song_names.setSelectedIndex(null); song_names.setEnabled(false); droppy.setStyleProperty("arrow", 0xFF0000); // set up album selection function onSelectAll(droppy) { if (droppy.getSelectedIndex()>1) { trace(droppy.getSelectedIndex()); song_names.setEnabled(true); song_names.removeAll(); song_names.setSelectedIndex(0); _root.outline.album = droppy.getValue(); // set up song titles if (droppy.getSelectedIndex() == 2) { // Buddah Album song_names.removeAll(); song_names.addItem("Carosel", 1); song_names.addItem("blah", 2); song_names.addItem("blah2", 3); song_names.addItem("blah3", 4); song_names.addItem("blah4", 5); song_names.addItem("blah5", 6); song_names.addItem("blah6", 7); song_names.addItem("blah7", 8); song_names.addItem("blah8", 9); } if (droppy.getSelectedIndex() == 3) { // Cheshire Album song_names.removeAll(); song_names.addItem("Tony", 1); song_names.addItem("blah", 2); song_names.addItem("blah2", 3); song_names.addItem("blah3", 4); song_names.addItem("blah4", 5); song_names.addItem("blah5", 6); song_names.addItem("blah6", 7); song_names.addItem("blah7", 8); song_names.addItem("blah8", 9); } } else { song_names.setSelectedIndex(null); song_names.setEnabled(false); } } // Play a song function onPlaySong(song_names) { if (song_names.getSelected()>=0) { unloadMovieNum(1); _root.outline.album = droppy.getSelectedItem().data; trace(_root.outline.album); _root.outline.songnum = (song_names.getSelectedIndex()+1); trace(_root.outline.songnum); _root.outline.totalsongs = int(13); filename = (_root.outline.album+songnum); if (_root.outline.pause.paused == false) { loadMovieNum("http://www.kowalick.net/"+filename+".swf", 1); _root.outline.spectrum.gotoAndPlay(2); } } }


now on your component properites, there is a field called
"ChangeHandler"

for droppy i have 'OnSelectAll' (my first function)
for song_names i have 'OnSongPlay' ( my second function)

let me knowif you dont understand..

im posting my new swf now

www.kowalick.net/sony3.html



Report this post to a moderator | IP: Logged

Old Post 07-31-2002 09:23 AM
TGixer is offline Click Here to See the Profile for TGixer Click here to Send TGixer a Private Message Click Here to Email TGixer Find more posts by TGixer Add TGixer to your buddy list Edit/Delete Message Reply w/Quote
kristin
Young Devil

Registered: Jul 2002
Local time: 11:47 AM
Location: Toronto, ON
Posts: 166

Post #7

totally understood now that i see what you wanted to do.
(I was thinking in a different direction when you made your original post)

thank you for sharing. :-)
this could be applied to so many things
--K

__________________
--K
aka:K-dog



Report this post to a moderator | IP: Logged

Old Post 07-31-2002 09:45 AM
kristin is offline Click Here to See the Profile for kristin Click here to Send kristin a Private Message Find more posts by kristin Add kristin to your buddy list Edit/Delete Message Reply w/Quote
Plankton
Little Devil

Registered: Dec 2002
Local time: 04:47 PM
Location:
Posts: 26

Post #8

The best way to write a change Handler, that i have experienced so far is to write it similar to this:

testObj = new Object();
testObj.testHandler = function(){
//place code here
}

whateverObject.setChangeHandler("testHandler", testObj);


Just thought i would try and contribute.

Plankton



Report this post to a moderator | IP: Logged

Old Post 02-07-2003 01:44 AM
Plankton is offline Click Here to See the Profile for Plankton Click here to Send Plankton a Private Message Click Here to Email Plankton Find more posts by Plankton Add Plankton to your buddy list Edit/Delete Message Reply w/Quote
marrydavidson10
Little Devil

Registered: Apr 2010
Local time: 04:47 PM
Location:
Posts: 1

Post #9

thanks for sharing this its so good

__________________
here is more information available about cheap vps and website hosting as well about dedicated server



Report this post to a moderator | IP: Logged

Old Post 04-14-2010 06:21 AM
marrydavidson10 is offline Click Here to See the Profile for marrydavidson10 Click here to Send marrydavidson10 a Private Message Click Here to Email marrydavidson10 Find more posts by marrydavidson10 Add marrydavidson10 to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 04:47 PM. Post New Thread    Post A Reply
  Last Thread   Next Thread
Advertising
Show Printable Version | Email this Page | Unsubscribe from this thread | Download thread

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

< FlashDevils - Terms of use >

Copyright, FlashDevils Community, 2002 -
Flash Archive

Links
Books