A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: different variables per frame

  1. #1
    Junior Member
    Join Date
    Jan 2005
    Location
    Chicago
    Posts
    4

    different variables per frame

    Ok, quick question.

    I am new to flash, I am basicaly trying to make a simple trivia game using dynamically loaded text to feed the questions and answers into text boxes on a per frame basis. I am able to get the text to go in the dynamic type boxes no problem, however, what I am having trouble getting my head around is what I need to input so that the dynamic text box variable changes every frame, basically to accept a new question or answer.

    Also.. the mechanics of the game are quite basic. You press a button to start the game, which takes you to the first question page. You press the button again to reveal the answer. Repeat process until you reach the last question. From that point it will exit you back to the loading screen.

    Any help would be appreciated. Also, I did browse to find the inital syntax which works great. Thanks for whomever posted that example file. I based it for what I have below.


    This is what I have so far. I am looking for my sequental frames to have the equivilant text according to the frame number.


    rock = new LoadVars();
    rock.onLoad = function() {
    t_001.text = rock.t_001;
    t_002.text = rock.t_002;
    t_003.text = rock.t_003;
    t_004.text = rock.t_004;
    t_005.text = rock.t_005;
    t_006.text = rock.t_006;
    t_007.text = rock.t_007;
    t_008.text = rock.t_008;
    };
    rock.load("rock.txt");




    Thanks in advance!

  2. #2
    Member
    Join Date
    Nov 2001
    Posts
    96
    Hi

    In the textbox property inspector, you should be able to change the variable with which the textbox is associated in each keyframe, so that on frame 1 the variable is "rock.t_001", frame 2 its "rock.t_002", etc...

    Is this not the case?

    Cheers

  3. #3
    Senior Member pellepiano's Avatar
    Join Date
    Feb 2000
    Location
    Stockholm, Sweden
    Posts
    15,151
    You dont need different frames. Just a text box and the buttons.

    If you have named vars like...

    q1=What is bla bla;
    q2=who is bla bla


    You can assign the next question to the same textbox ....

    on(release){
    textBoxName=this["q"+i];
    i++;
    }

    If you want a example to look at ( dynamic quiz where all q's and answers are defined in the first frame )....check...

    www.pellepiano.com/tester/quiz.fla

    -Pelle Piano
    // Image Gallery
    www.studiobild.com
    // Photo Blog
    http://talesofthepixel.blogspot.com

  4. #4
    Junior Member
    Join Date
    Jan 2005
    Location
    Chicago
    Posts
    4
    Oh, I am not sure about that one. Like I mentioned previously, I am very new to flash, as in 12 hours. However I have worked in other scripting enviorments as well as basic html. I will have to investigate that suggestion a bit. If what you're stating is correct than that is an easy answer

    Thanks!


    Originally posted by Surgpig
    Hi

    In the textbox property inspector, you should be able to change the variable with which the textbox is associated in each keyframe, so that on frame 1 the variable is "rock.t_001", frame 2 its "rock.t_002", etc...

    Is this not the case?

    Cheers

  5. #5
    Junior Member
    Join Date
    Jan 2005
    Location
    Chicago
    Posts
    4
    Oh, I am not sure about that one. Like I mentioned previously, I am very new to flash, as in 12 hours. However I have worked in other scripting enviorments as well as basic html. I will have to investigate that suggestion a bit. If what you're stating is correct than that is an easy answer

    Thanks!


    Originally posted by Surgpig
    Hi

    In the textbox property inspector, you should be able to change the variable with which the textbox is associated in each keyframe, so that on frame 1 the variable is "rock.t_001", frame 2 its "rock.t_002", etc...

    Is this not the case?

    Cheers

  6. #6
    Junior Member
    Join Date
    Jan 2005
    Location
    Chicago
    Posts
    4
    Thanks also for the advice. It's nice to see several solutions to the problem. I will check out the sample you posted momentaraly.

    Thanks!


    Originally posted by pellepiano
    You dont need different frames. Just a text box and the buttons.

    If you have named vars like...

    q1=What is bla bla;
    q2=who is bla bla


    You can assign the next question to the same textbox ....

    on(release){
    textBoxName=this["q"+i];
    i++;
    }

    If you want a example to look at ( dynamic quiz where all q's and answers are defined in the first frame )....check...

    www.pellepiano.com/tester/quiz.fla

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