-
i completed the quicktime tutorials provided by macromedia but have hit a snag during the second movie. it shows how to setup a combo box and use a function, and that part works fine. my problem is i wanted to experiment with reusing functions, so i setup another combo box, with new values and data, and set it to read the function i setup for the previous combo box. but when i try using this combo box, instead of opening the URLs i want it to, it opens up the temp folder on my computer. now i know im not supposed to have seperate functions for each combo box, because that would defeat the purpose of functions. if someone could help me out id appreciate it. heres the code in the function im using
function fun() {
getURL(web.getSelectedItem().data);
}
-
Moderator
In Flash MX
Help > Using Flash
In the search box type in components
this section helped me alot.
-
I seem to be having problems with this function, too. I've gone through this tutorial several times and can't get it to work.
I get no response from my combo box when I test movie.
I thought maybe it was something about testing locally so I put it on my server. So then it looked for those sites on my server.
HELP!
-
yearn: are you sure you gave an instance name to your combo box? it wont work without being named.
-
-
Originally posted by proxy07
yearn: are you sure you gave an instance name to your combo box? it wont work without being named.
LOL, I'm not sure about anything at this point.....
but I named it websites (under the component title in properties) , shows up under properties as "websites"...change handlers fun.... pulled the "websites" target from the drop down listing and the function looks right.
That is what your talking about isn't it?
Sorry used to running flash 4 and having "instance" in the modify menu..
-
Check out the files I just put up
-
Hey I even put Squareball2 code into it (after looking to see if anything was different) Not that I could see...
In his app..works great....place in mine nothing.
I'm going to start the combo box from scratch in a new file and see whats up.
Thanks for the files
-
getting one combo box to work is simple, but getting multiple to work calling one function isnt so easy, i think maybe where you call the instance name, if you use an operator to say "web OR sites" (both "web" and "sites" referring to seperate combo box instance names) may work, but i dont know much about operators.
-
I misread your post.. sorry.. working on the 2 combo box thing
-
Ok got it, check out the same source again
-
If you'd post your code, it would be easier, but I'll take a stab:
You're only ever calling the "web" comboBox's URLs with your reused function. You really want to get the data from whichever combo actually got selected. The changeHandler, luckily, lets you do this.
say you've got 2 combos (or listBoxes, or any FUIComponent) and you want them to use the same changeHandler:
Code:
combo1.setChangeHandler("onChange");
combo2.setChangeHandler("onChange");
(you can use the component parameter to set these as well.)
The good thing about changeHandlers is that they actually pass an argument, which is a reference to the component that actually changed :
Code:
function onChange(component)
{
getUrl(component.getSelectedItem().data);
}
The argument is optional, but nice for when you're using the same function to handle multiple components, because it gives you acces to the component you're interested in (you don't have to name it "component" in your function, you can name it anything).
hope that helps - it's no so easy to explain.
nig
npegg@macromedia.com
-
so all I did was the following...
I set the change handler
myComboBox.setChangeHandler(fun(myComboBox));
I setup the function called fun() and tell it to accept a variable cmb.
then
theCombo = cmb;
and in the function I call
getURL(theCombo.getSelectedItem().data);
-
oh yeah you could do that too
hehe i'm learning...
-
Actually, SquareBall, you've been super helpful - I'm only taking this week to hang around the forums, so having people to spread word is really appreciated!
nig
-
squareball and nigel, youve both been really helpful, thanks for taking the time to post your flas & code, its much appreciated.
-
No problem
It brings a smile to my face when I can help.
-
How can I get this to within a movie clip. I have a flash movie. I created the instance of a movie clip. The combobox is inside the movie clip. I copied squares example, but it doesn't work properly when not in the main movie.
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
|