-
value from listbox to load external swf - URGENT!! aahhhh!
Hi guys,
i'm populating my list box with dynamic xml fine, and I need some script that will allow me to load an external swf file if the value obtained by the list box is a certain string.
i.e, if the term 'booklet' is seen in the list box i want my booklet.swf to load.
any thoughts?
cheers in advance,
James
-
:::BUMP:::
i'm sure the solution is easier than you think. please help! i'm desperate!
thanks again in advance,
James
-
Senior Member
Code:
switch(listBox.text){
case "booklet":
loadMovie(listBox.text+".swf")
break;
case "something":
loadMovie(listBox.text+".swf")
break;
}
?
-
thanks dudeqwerty,
no luck with that code i'm afriad. anything else i can try!?
thanks,
James
-
Senior Member
well you gotta tell flash what index of the listbox your are looking at, so change,
listBox.text to listBox.selectedItem.data or selectedItem.label
zlatan
-
hi zlatan,
Code:
stop();
switch(listBox.product){
case "Brochure":
gotoAndStop(44);
}
I've tried a simple gotoAndStop to check if the function works and it doesn't.
i've got a value of "Brochure" in my list box component, i simply need a piece of code that when it says "Brochure" an external swf loads.
please help!
thanks,
James
Last edited by jameskeane; 05-24-2006 at 05:27 PM.
-
fixed it!!
Code:
stop();{
if (listBox.product = "Brochure")
gotoAndStop(44);
}
thanks for the help zlatan, it helped me out to the solution! YAY!
James
-
Senior Member
the swicth statment works, you just didnt put a break in there,
i only used a switch statment because i thought you were checking for more than one value,
zlatan
-
Hi again, yes i must be taking those stupid pills again.
ok, so my code is now:
Code:
stop();
switch(listBox.product) {
case "Brochure":
loadMovie("pageflip.swf", loader);
break;
case "Booklet":
loadMovie("pageflip.swf", loader2);
break;
}
loader is a movieclip with loader as the name for export for actionscript, and yet my swf (in the same directory) will not load. where am i going wrong here? I must be missing something completely obvious. flash tells me there are no errors with the script.
the code about is simply on the timeline and not attached to a button or anything, but that shouldn't matter right?
thankyou so much for your time on this zlatan. I really appreciate it!
James
-
^^bump^^
please guys. i'm still mega stuck on this issue!!
-
if of all u need to call ur loader movieclip on the stage only then u would be able to load anything in it or if it even been loaded then u haven't put it on the workarea to display. Think if u have something out the workarea and u r loading something in it. whats the use it woun't display to u.
so do the following
_root.createEmptyMovieClip("mymc", _root.getNextHighestDepts()):
_root.mymc.attachMovie("loader");
now u will use this path in ur movie
stop();
switch(listBox.product) {
case "Brochure":
loadMovie("pageflip.swf", _root.mymc.loader);
break;
case "Booklet":
loadMovie("pageflip.swf", _root.mymc.loader);
break;
}
ope fullt it will solve ur problem. i haven't tried this could b'coz i don't have flash, but in case if u see some problem them let me know i will write the code and send it to u.
-
changing tack..
Hi psb,
no joy with that i'm afraid. however, i have been able to get the value to read out in the output panel using:
trace (product.getItemAt(0))
can anyone supply me with a piece of code that can maybe set that as a variable and then if it = "brochure" for example, brochure.swf is loaded..
sorry for being such a noob.
thanks
James
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
|