A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: AS3: Populate dynamic text box in nexted MC and not on frame 1

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    3

    AS3: Populate dynamic text box in nexted MC and not on frame 1

    OMG somebody, please help!!! I have most of my AS on the main timeline and have these lines in frame #20:

    btnTISB.svcHitArea.addEventListener(MouseEvent.CLI CK,showTISB);
    btnTISB.buttonMode = true;
    btnTISB.descMC.serviceMainTitle.text = "TIS-B"
    btnTISB.descMC.serviceMainText.text = "TIS-B is a surveillance service that derives traffic information from ..blah blah."

    btnFISB.svcHitArea.addEventListener(MouseEvent.CLI CK,showFISB);
    btnFISB.buttonMode = true;
    btnFISB.descMC.serviceMainTitle.text = "FIS-B"
    btnFISB.descMC.serviceMainText.text = "FIS-B is a service that derives weather information from ..blah blah."


    The btnTISB and btnFISB make their first appearance in frame 20. so all of the functions and Event Listeners work GREAT. One thing for both button movie clips (and I'll talk only about one, but am refereing to both buttons and all 4 dynamic text boxes at once since they all live in the same places)...

    ...the "btnTISB.descMC.serviceMainTitle" (Dynamic Text Box) lives on frame 1 of the movie clip "descMC."

    Then, descMC has been placed on frame #10 of btnTISB.

    HOW IN GOD'S NAME can I pass text into that dynamic text box? It doesn't work even if I place the descMC onto frame 1 of btnTISB. I've played with moving it to frame 1 and using the .visible = true/false, but that's not working. I've traced btnTISB.descMC.serviceMainTitle.text from the main timeline and the variable comes out as "TIS-B", but I've also traced the result from within the movie clip(s) and the variable doesn't pass into it at all. It just reports the "placeholder" text in the dynamic text box.

    I have no hair on my head and am dying to grow some so that I can pull on something (.

  2. #2
    Junior Member
    Join Date
    Aug 2012
    Posts
    3
    There is no space between CLICK... that was just weirdness from when I posted???

  3. #3
    Junior Member
    Join Date
    Aug 2012
    Posts
    3

    Anybody please?

    My first time posting... I've waited through the weekend. Does it normally take this long to get responses?

  4. #4
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    Hi,

    usually when someone doesn't get any replies, especially this long, it's because either your question is too vague and hard to understand or that people are intimidated by the huge text and coding, so they're like tl;dr (too long, didn't read) and ignore the post.

    Anyways, I myself am not quite sure what you're having trouble with. The text inside the Dynamic Textfield is showing, right? If not, then it might just be a case of forgotten embedded characters, meaning that you can't see anything inside your Dynamic Textfield (except for some characters, sometimes), in that case, simply click on your textfield, open Properties Panel [CTRL+F3], press Embed.../Character Embedding button, tick/check the ones you'd like (for all common characters, tick/check Uppercase, Lowercase, Numerals and Punctuation) and press OK. Does this solve your problem?

    If not, then another thing to consider, is that when you give your textfield a value using text_field.text = "some text";, it's not being saved as a variable, you're only changing the value of the textfield, what's inside it, no variables are created during that process. Textfield.text is just a property all Textfields share, because it can be used to access their display value. Therefore, no variables are saved inside your movieclip.

    From my understanding, you want to change the text of textfields placed on Frame 10, right? If so, then you can't do this directly unless you are on Frame 20 of that movieclip at the time of changing the textfields' value. What you can do, is to save the text you want to assign your textfield, in a variable, and when you later come to Frame 10, you can set its value to whatever the variable's value is. To do this, create a variable inside your main movieclip, btnFISB/btnTISB, using this code:

    Code:
    btnFISB.textVar1 = "some text";
    Then that variable will be accessible within your movieclip, as long as the movieclip exists. Now, on Frame 10, or whatever frame you'll be placing descMC, type this on that Frame:

    Code:
    descMC.serviceMainTitle.text = textVar1;
    you don't need to reference your variable with an absolute path (which in this case would be, this.textVar1), because your variable already belongs to the movieclip you're inside, so need to do so.

    If this does not help you, then please be kind enough to elaborate on your matter, to give us a better insight on what you're desiring.
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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