A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: multiple-load variables in 1MC/textfield

  1. #1
    Member
    Join Date
    Dec 2002
    Posts
    39

    multiple-load variables in 1MC/textfield

    Hi all,

    I have some questions about scrolling text. I have read most of the post and understand the whole loadvariable(test.txt,0) concept(I think) I currently load the text file in frame 1 on the main stage. I have a textfield assigned text and it loads just fine.

    The problem I am running into now is that I have 3 buttons 1 MC with the 1 textfield. When I click on button1 I want var1(sometext) to load into the textfield of MC, same for button 2 load var2, 3 load var3 etc... but I can't seem to ffigure out how to go about doing that because all the Var1 etc.. are on one file. I dont know how to assign the textfield multiple varnames( if this is even possible) The only thing I can think of is make 3 different MC each with it's own textfield with the appropriate varname and each button with the appropriate load action. This just seems like it's going to take up alot of computer resources. Currently my SWF is about 220kb and I am not sure if this is an acceptable file size for 56kers. Still learning about this fabulous invention called the PC. I have had broadband for about 2yrs now and dont remember the dark ages, thank god

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Did this for TNP03 yesterday. Loads several variables from 1 text file into 1 textfield. All this is done on the root level, but could be adapted to work within another mc.
    Only the first 2 buttons were coded, but the others would be programmed in the same manner, referring to other variables in the one text file.
    Attached Files Attached Files

  3. #3
    Member
    Join Date
    Dec 2002
    Posts
    39
    Thanks Oldnewbie,
    Great that is exactly what I am looking for. One question though. You said it could be adapted to work within another MC. Something like
    a text field inside a MC named scroller and have the buttons action like this:
    _level0.MC.scroller.text=loadVarsText.text1;

    Thanks for the help.
    Joey

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    That should work! Or can be made to work!

  5. #5
    Member
    Join Date
    Dec 2002
    Posts
    39
    Ok Oldnewbie,

    This is what I did. I took the sample movie you created just to see if what I want to do is going to work. I added a MC called mynewMC and placed inside it a textfield called scroller2. I also changed the action on button1 to the following.

    _level0.mynewMC.scroller2.text=loadVarsText.text1;

    that didnt work so I copied the actionscript from the mainstage, thinking I need that in the new MC, however that didnt work either. Any suggestions? Thanks I won't bother you again until my next problem

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    That set up wasn't really mine, it was TNP03's. Can you attach your test .fla?

  7. #7
    Member
    Join Date
    Dec 2002
    Posts
    39
    Here you go.
    Attached Files Attached Files

  8. #8
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    You simply forgot to give your mc an instance name. It doesn't suffice that the mc have the Library name of "mynewMC", the instance on stage needs to have an instance name so that you can target it. Just give it the same name in the instance box in the movie clip's properties and the following line will load it in:

    _level0.mynewMC.scroller2.htmltext=loadVarsText.te xt1;

    By the way, there are no html tags that I could see in the text file, and that ending /html thing at the end of text1 is useless. So using htmltext, which by the way, is incorrect, it should be htmlText, is also useless.
    Last edited by oldnewbie; 01-30-2003 at 09:47 PM.

  9. #9
    Member
    Join Date
    Dec 2002
    Posts
    39
    Thanks for the help Oldnewbie. I needed it to show links and scroller.text wasnt doing it so I through in a link at the beginning of the text2 section and it showed up just fine in the textfield with scroller.htmltext. I dont think its case sensitive. I could be wrong but it works. Thanks again for your help.

    Joey

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