A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: value from listbox to load external swf - URGENT!! aahhhh!

  1. #1
    Junior Member
    Join Date
    May 2006
    Posts
    19

    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

  2. #2
    Junior Member
    Join Date
    May 2006
    Posts
    19
    :::BUMP:::

    i'm sure the solution is easier than you think. please help! i'm desperate!


    thanks again in advance,
    James

  3. #3
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    Code:
    switch(listBox.text){
        case "booklet":
            loadMovie(listBox.text+".swf")
            break;
        case "something":
            loadMovie(listBox.text+".swf")
            break;
    }
    ?
    New sig soon

  4. #4
    Junior Member
    Join Date
    May 2006
    Posts
    19
    thanks dudeqwerty,
    no luck with that code i'm afriad. anything else i can try!?

    thanks,
    James

  5. #5
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    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
    New sig soon

  6. #6
    Junior Member
    Join Date
    May 2006
    Posts
    19
    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.

  7. #7
    Junior Member
    Join Date
    May 2006
    Posts
    19
    fixed it!!

    Code:
    stop();{
    
    if (listBox.product = "Brochure")
            gotoAndStop(44);
    }
    thanks for the help zlatan, it helped me out to the solution! YAY!

    James

  8. #8
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    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
    New sig soon

  9. #9
    Junior Member
    Join Date
    May 2006
    Posts
    19
    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

  10. #10
    Junior Member
    Join Date
    May 2006
    Posts
    19
    ^^bump^^

    please guys. i'm still mega stuck on this issue!!

  11. #11
    I am not an expert
    Join Date
    Aug 2005
    Posts
    175
    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.

  12. #12
    Junior Member
    Join Date
    May 2006
    Posts
    19

    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center