dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Passing a variable to a dynamic text field

  1. #1
    Junior Member
    Join Date
    Oct 2003
    Posts
    2

    Passing a variable to a dynamic text field

    I have been trying to create a small hangman game. I have a variable that is created from an array and is passed to a dynamic text field from another scene into the main scene and inside a movieclip. I know it must be just my referencing, but I have tried everything and it's driving me crazy.

    It looks like this (which might mean nothing so I have included the file for download):

    hangman.prototype.getWord = function() {

    randomNumber = Math.round(Math.random()*(wordlist.length-1));
    selectedWord = wordList[randomNumber];

    lettersLeftToGo = selectedWord.length;

    for (i=0;i<selectedWord.length;i++){
    lettersNeeded[i] = selectedWord.charAt(i);
    }

    for (i=0;i<selectedWord.length;i++){
    lettersGuessed[i] = "?";
    }

    this.interface.display = lettersGuessed.join("");
    trace(this.interface.display);
    }

    Thankyou!!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    107

    hangman game

    I downloaded your file and ....

    There are no actions on the button? That should be what drives the program.

    -Wiley

  3. #3
    Registered User
    Join Date
    May 2002
    Posts
    107

    hangman

    The function hangman isn't defined anywhere. You need a function called hangman for starters.


    thisGame = new hangman();
    thisGame.getWord();
    stop();


    -Wiley

  4. #4
    Junior Member
    Join Date
    Oct 2003
    Posts
    2
    Hi wiley173! Thanks heaps for replying to my post. I'm not sure if this is right or not, but this is what I think my game is doing. thisGame = new hangman(); is an object that's in the first frame of the intro scene. It should be creating a new instance of the object. You are right about the buttons that are in there not hooked up yet, but the text field should take the variable onLoad, not when you press the button. I tried not using objects as well to pass the variable into the text field and it still won't take it.
    I'm still quite puzzled about this.instance.display, and why it won't display.
    Thanks!

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