dcsimg
A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 40 of 40

Thread: loading variables into textbox

  1. #21
    shorter than most, but not all findShorty's Avatar
    Join Date
    Apr 2002
    Location
    brisbane
    Posts
    239
    can you resend you fla with the new changes?

  2. #22
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48
    all i have is what you gave me, thats what im testing
    Attached Files Attached Files
    it makes my head spin..

  3. #23
    shorter than most, but not all findShorty's Avatar
    Join Date
    Apr 2002
    Location
    brisbane
    Posts
    239
    your textfield has both the instance name and the variable name filled in. remove the variable name and all should work.

  4. #24
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Try this...
    Attached Files Attached Files

  5. #25
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48
    i appreciate your help through this
    it makes my head spin..

  6. #26
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48
    unfortunately turns out i have 18 variables to create, is there a way to add an if statement to shorten the code here
    Code:
                    var1 = this.var1;
    		var2 = this.var2;
    		var3 = this.var3;
                    .... . .........;
                    var18= this.var18;
    or even shorten the handler to accomadate 18 variables.....

    Code:
    function loadit() {
    	if (comTV.getValue() == "var1"){
    		myTxt.text = var1;
    	}
    	if (comTV.getValue() == "var2"){
    		myTxt.text = var2;
    	}
    	if (comTV.getValue() == "var3"){
    		myTxt.text = var3;
    	}
    };
    yikes, thanks
    it makes my head spin..

  7. #27
    shorter than most, but not all findShorty's Avatar
    Join Date
    Apr 2002
    Location
    brisbane
    Posts
    239
    if i'm understanding you right, you want to add 18 items to the combo box, all of them named var1-var18?

    the following code will do that for you:
    code:

    importVars.onLoad = function () {
    for (var i=0; i<18; i++) {
    comBo.addItem("my label "+i,importVars["var"+(i+1)]);
    }
    }


  8. #28
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    This thread is surreal to the point of deep-fried pizza encrusted fish and a one-legged duck clapping alone in a wood with one hand.

    Oldnewbie, have you been deleting posts so that you can stay a while?

    Is it true that the soon to be decimillarian snapped and lost his temper on FK or is that a vicious rumour?

    And who is the wee bairn?

    I think we should be told.

  9. #29
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    I have... I did... I'm it if it makes you happy!

  10. #30
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    A lot of similarities with this thread...

    http://www.flashkit.com/board/showth...hreadid=487326

    Going out though for the rest of the day...
    Will look into it later, if Shorty doesn't convince you of doing it his way!

  11. #31
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48
    Originally posted by findShorty
    if i'm understanding you right, you want to add 18 items to the combo box, all of them named var1-var18?

    the following code will do that for you:
    code:

    importVars.onLoad = function () {
    for (var i=0; i<18; i++) {
    comBo.addItem("my label "+i,importVars["var"+(i+1)]);
    }
    }

    but the labels are already in place, if i change them the user wont know the difference between mylabel0 and mylabel1

    and i have looked into that thread oldnewbie (even responded to it) thanks, the problem is he wanted multiple text files, i just want one to load variables

    keep in mind my main goal posted couple threads above, if this isnt possible, lets try and think of a way around it, it may come down to me using one txt file for each combo item
    Last edited by suprme32; 09-04-2003 at 05:36 PM.
    it makes my head spin..

  12. #32
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Then your last tester2 works I guess, if you clear out the Var box in the textfield's properties... While you're at it, you can also unselect the "Selectable" tab (Ab), useless in your case!

    http://odin.prohosting.com/~oldnew/tester2.swf

  13. #33
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48

    finale

    i believe we have just come to the fact that we are all stumped, please no more replys to this post, im going to have to go a different route, thanks for all the effort and possible solutions guys
    it makes my head spin..

  14. #34
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    Looking at the calibre of the people responding, it seems a bit hard to believe what you want can't be achieved.

    Before you give up, read through all of their responses and see what you can collect. If that doesn't work, think about if you can rephrase the question to include the missing part of the puzzle.

    I haven't followed this thread closely due to its surreal nature, but I haven't read anything that seems impossible - or even difficult - to achieve.

  15. #35
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    For example, no matter how I read your posts, either version 1 or version 2 of this must answer your problem.

    This is nothing new, and not all that different to what FindShorty and Oldnewbie were on about.

  16. #36
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48
    ill try and explain one last time what i would like to achieve:

    i have almost 30 variables i am loading from a text file:
    Code:
    var1=<u>tvshow1</u><br><b>role played</b><br><i>more info</i>
    &var2=<u>tvshow2</u><br><b>role played</b><br><i>more info</i>
    &var3=<u>tvshow3</u><br><b>role played</b><br><i>more info</i>
    &var4=<u>commercial1</u><br><b>role played</b><br><i>more info</i>
    ...
    &var30=<u>movie1</u><br><b>role played</b><br><i>more info</i>
    and 3 comboboxes with labels and data as so.. these are hardcoded into movie:

    Code:
    //comTV
    labels: tvshow1, tvshow2, tvshow3, ... //all tv shows in one cbox
    data: var1, var2, var3,...
    
    //comCom
    labels: commercial1, commercial2, ...
    data: var4, var5, var6, ...
    
    //comMovies
    labels: movie1
    data: var30
    now when i click on the item in the combo box i need to load that variables html text from the file, i would rather not do this over and over:

    Code:
    var1 = this.var1;
    var2 = this.var2;
    ....
    var30 = this.var30;
    
    //and then
    //change handler
    function loadit() {
    	if (comTV.getValue() == "var1"){
    		myTxt.html = true;
    		myTxt.htmlText = var1;
    	}
    	if (comTV.getValue() == "var2"){
    		myTxt.html = true;
    		myTxt.htmlText = var2;
    	}
    ...
    	if (comTV.getValue() == "var6"){
    		myTxt.html = true;
    		myTxt.htmlText = var6;
    	}
    }
    and of course a loadit function for each combobox is necessary..
    however this does achieve what i want, i hav 30 variables and the size of the file is approx. 350 kb.. if this can be simplified in any way would be my ultimate question.. i have looked into ways to achieve this through XML and have become just as stumped, even though that way looks a lot more efficient, anyone with an example of that?...good luck if youre not giving up, i guess i have no choice.. ..thanks
    it makes my head spin..

  17. #37
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Now my head is spinning...

    Anyway you can attach, e-mail or provide a link to download from your server, the full and complete .fla for this thing?

    That said, again I believe your own second zip you attached here, assuming you made the corrections I proposed, seemed to work fine. That's why seeing the real thing (if it is!"), is a must.

  18. #38
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48
    enter the .fla, in this version i am using the style that works, but as reported the .fla is huge, simplification is a must

    http://www.documince.com/useless/pages.zip
    it makes my head spin..

  19. #39
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Just spent a few hours on your file... And my conclusion is that the simplification you're asking for isn't pinpointed!
    Are you more preoccupied by overall size (your 75kbs pages.swf is not that bad for what you have going on...), is it simplification of code (eliminating multiple if statements for example, which wouldn't translate in a significant difference in file size...), or the fact that this would be easily dynamically updatable (assuming nothing was hard coded...)?

    If you're going to hard code everything, might as well hard code your actual data in your combos, rather than going through variables you'll then have to evaluate for them to correspond to the actual data. If you want all of this to be easily updatable through text files (without ever editing the core of the movie), then everything should be dynamic including the number of items, their names and their associated data.

    A simple dynamic combo with however number of items outputs at about 16kbs and I don't think (even without testing it!) that the way they're coded would make a significant difference in file size.

  20. #40
    semi-experienced
    Join Date
    Dec 2002
    Location
    CA
    Posts
    48
    thanks much oldnewbie for everything youve worked on with this code, i guess when it comes down to it, my main concern is the updatable files, im going to shy away from the hardcoding and use the XML format to load items into the comboboxes and just use text files for individual items, turns out the answer i was looking for wasnt in the code, but in the the actual necessity of what needed to be accomplished, your last post was by far the most rewarding for the completion of this project, thank you
    it makes my head spin..

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