PDA

View Full Version : dynamic variables (newbie question)


smirnie
05-06-2004, 10:32 AM
Hello,

here's my prob. I want something as simple as letting people put in some simple data that I can use through the hole clip. f.i. a name and adress

I'm guessing i'll have to use dynamic and input boxes and some script: this is how far??? I got:

I've got one input textbox: instance: inputname, variable sInputname
one button to go to frame two
I've got one dynamic textfield on frame two: instance name, variable sName

some code on layer two of my second frame:

sName = sInputname

suprise, suprise it doesn't work.

avatar
05-06-2004, 10:56 AM
your theorie should work fine...
check the zip file

smirnie
05-06-2004, 11:02 AM
I get an unexpected format error. Are you using flash mx 2004?

idid'nt reach that far yet. I'm stuck with MX

avatar
05-06-2004, 11:14 AM
yep now you should be able to open it in MX

smirnie
05-06-2004, 11:26 AM
thx


Yours works min doesn't although its the same thing. Strange,... very strange.
As long as I'm thinking in the wright direction, I don't feel completely stupid.

avatar
05-06-2004, 11:30 AM
Could you post your fla here?

smirnie
05-06-2004, 11:32 AM
I've deleted it. I'll restart and post it if it doesn't work.


Thx a lot

smirnie
05-07-2004, 04:23 AM
OK I've managed the name part

Now I have a new problem. I'm trying to create some kind of a selftest. The meaning is that people answer a few questions and than get a grade and some tips at the end. Also they get a survey of the answers thy've given.

This is how i thought solving this riddle:

Make question and give a few possible answers for each question. Each answers has a button each button gets following script:

on (release) {
gotoAndPlay(2);
vraag 1 = "Antwoord 1" ;
commentaar 1 = "commentaar 1" ;
score = score 3+ ;
}

My last frame would contain a few dynamic textboxes f.i. vraagA: variable vraag1 commentaar vraag A: variable commentaar 1....

It doesn't work I get the following error message:

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 3: ';' expected
vraag 1 = "Antwoord 1" ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 4: ';' expected
commentaar 1 = "commentaar 1" ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 5: ';' expected
score = score 3+ ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 3: ';' expected
vraag 1 = "Antwoord 2" ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 4: ';' expected
commentaar 1 = "commentaar 2" ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 5: ';' expected
score = score 5+ ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 2: ')' or ',' expected
gotoAndPlay(2 ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 3: ';' expected
vraag 1 = "Antwoord 3" ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 4: ';' expected
commentaar 1 = "commentaar 3" ;

Scene=Scene 1, Layer=Layer 1, Frame=1: Line 5: ';' expected
score = score 1+ ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 3: ';' expected
vraag 2 = "Antwoord 1" ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 4: ';' expected
commentaar 2 = "commentaar 1" ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 5: ';' expected
score = score 1+ ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 3: ';' expected
vraag 2 = "antwoord 2" ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 4: ';' expected
commentaar 2 = "commentaar 2" ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 5: ';' expected
score = score 3+ ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 3: ';' expected
vraag 2 = "antwoord 3" ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 4: ';' expected
commentaar 2 = "commentaar 3" ;

Scene=Scene 1, Layer=Layer 1, Frame=2: Line 5: ';' expected
score = score 5+ ;

it doesn't even go to the next frame. Also when I test it it goes automatically to frame two evn though I've put a 'stop' at each frame.

Can you see where my little script is gowing wrong? Or am I thinking in the wrong direction and is this never going to work?

I'll post my fla it's just a draft version so I didn't pay any attention at the lay-out.

thx

avatar
05-07-2004, 05:58 AM
the .fla seems to be empty...

smirnie
05-07-2004, 06:19 AM
sorry.

here you go.

avatar
05-07-2004, 07:09 AM
some remarks:

You can't name a variable > antwoord 1
Variables can't contain spaces, but you could use "_" > antwoord_1

score = score 3+;
doesn't work...
alternatives:
score += 3;
score = score+3;

Check out the tuts at this site. They help you figger out the basics of AS (syntax etc...) ;)

dangerouspuppy
05-07-2004, 07:55 AM
This will help you, I think...

smirnie
05-07-2004, 08:25 AM
OK thx you guys.


I kwno I'm at the very beginning but I'm trying. I'll check out the tut's...


c ya

avatar
05-07-2004, 08:46 AM
That's the spirit!!! :)