Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-20-2004, 04:34 PM   #1
Registered User
Join Date: Aug 2004
Posts: 21
Default Dropdown Change Handlers

I'm having some difficulties getting my Change Handler to work on a dropdown list.

Here's the .fla:


I have a textbox on the left side of the stage, it is dynamic, and the instance is named "inscription." I have a dropdown in the middle (nameBox), with values and data, and a piece of code in its 'change handler' as follows:
inscription.htmlText = nameBox.getSelectedItem().data;
I cannot get the inscription box to display any text! What am I doing wrong here? I've tried placing the above line into the AS of the inscription box, but then I only get the data displayed of the first item in the dropdown - if i change items the text remains the same.

Can anyone help me with this?

Last edited by ninjapheret; 08-20-2004 at 04:36 PM.
ninjapheret is offline   Reply With Quote
Old 08-20-2004, 06:22 PM   #2
Registered User
Join Date: Aug 2004
Posts: 21

bringing this up top....anyway i can get some tips?
ninjapheret is offline   Reply With Quote
Old 08-22-2004, 05:40 AM   #3
Registered User
Join Date: Nov 2003
Posts: 189

hi ninjapheret.

PHP Code:

.html true;



selectedCB:Object eventObject.target;
selectedData selectedCB.selectedItem.data;

inscription.htmlText selectedData;

hope that helps
tdoublea is offline   Reply With Quote
Old 08-23-2004, 06:11 PM   #4
Registered User
Join Date: Aug 2004
Posts: 21

tdoublea -

Do I apply this to Frame 1? I'm not getting any results with it... sorry, but do you know what my problem is? and WHY wouldn't the line on change handler

inscription.htmlText = nameBox.getSelectedItem().data;

not do anything? i mean wtf?

any help from anyone would be appreciatd.
ninjapheret is offline   Reply With Quote
Old 08-23-2004, 07:45 PM   #5
Registered User
Join Date: Nov 2003
Posts: 189

hey ninjapheret.

I don't think there is a method calles getSelectedItem()

there is getItemAt('the number')
or selectedItem

if you wanted to grab info from an item in the comboBox, you would use getItemAt()

var theItemNum = comboBox.selectedIndex;
var theData = comboBox.getItemAt(theItemNum).data;

and selectedItem is the item selected from the comboBox


var theData = comboBox.selectedItem.data;

I would set all the text formatting and the change function on frame one
and then set the changeHandler for the comboBox when ever you attach it of it appears on the stage, and the textFormat for the textbox whereever that shows up

frame 1:

var myTF = new TextFormat();
myTF.font = "_sans";
myTF.embedFonts = true;
myTF.html = true;

function change(eventObject:Object){
var selectedCB:Object = eventObject.target;
var selectedData = selectedCB.selectedItem.data;
inscription.htmlText = selectedData;

whereever the textbox 'inscription' appears (make sure inscription is the Instance Name and not the Variable Name in the properties panel):


whereever the comboBox makes its appearance:

nameBox.addItem({label:"theName", data:"myData"});
nameBox.addEventListener("change", this);

re: inscription.htmlText = nameBox.getSelectedItem().data;

i would stay away from using functions within the assigning of variables
tdoublea is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT. The time now is 09:13 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.