A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Flash Variables

  1. #1
    Junior Member
    Join Date
    May 2005
    Posts
    2

    Flash Variables

    Im working on a project which requires users input in order for the content to be customised. Similar to this site http://www.randomhouse.com/bantamdel...ur/index2.html how they use the users name throughout the site.

    I have a main screen that asks a number of questions, which these answers will be called upon in other frames.

    Here is the code i have in the main menu

    Code:
    {
    	var theObject:String = _root.object_txt.text;
    }
    In the main page my input text box is named object_txt

    so then when the user clicks the enter i want them to goto another frame where what they entered be displayed.

    Here is what i have on that frame in another text box but this time named content_txt

    Code:
    {
    	_root.content_txt.text = "I have allways wanted to own a " + theObject + " and now i finally will";
    }
    But when i test it instead of it displaying my text it reads "undefined" where the test should be in the sentence.

    Am i not calling it right or?? Does anyone know how i can fix this problem?

    I have attached a fla file that shows what im trying to do

    Thanks in advanced
    Attached Files Attached Files
    Last edited by Ralph007; 05-31-2005 at 08:18 AM.

  2. #2
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    The problem is you have this line
    Code:
    var theObject:String = _root.object_txt.text;
    executing on the frame, so when that code runs the textbox is empty as the user hasn't had a chance to put anything in yet.

    Put that bit on the button instead:
    Code:
    on (release) {
    	var theObject:String = _root.object_txt.text;
    	gotoAndPlay (10);
    }

  3. #3
    Junior Member
    Join Date
    May 2005
    Posts
    2
    it now works, thanks a TON man, it has been buggin me for days

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