Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 77806

Re: I need help with Variable Manipulation

$
0
0

Ok...after creating what you are looking for I think your confusion may be in global variables initialization with Director vs other languages.   Within Director it is necessary to reintialize the global variable within each script you need to access it in.

 

So what I have done is create a two slide movie...for lack of better names slide 1 and slide 2.

 

Step 1:  create the PrepareMovie Script - this script preloads the field (text box) with  "type your name".  In this case I just assigned "type your name" to the playerName global varialble.

 

On prepareMovie

  global playerName

  playerName="type your name"

  member("fName").text=playerName

end

 

Step 2:

Place cast members into slide 1

your name - text cast member

fname - field cast member

continue - sprite button

 

Step 3:

Place cast members into slide 2

verify - text cast member

recall - sprite button

reveal - text cast member

 

Result should look something like this in the score:

score.jpg

Step 4:  Scripts

 

Script 6 is nothing more than a "go to the frame" script to keep the play head in place.

on exitFrame me

  go to the frame

end

 

Script 7 just under the Slider 2 Marker

on prepareframe me

  global playerName

  member("verify").text="Just to be certain your name is "& playerName

end

 

 

The Continue Button Script - attach this to the button as button script

on mouseUp

  global playerName

  ---stuff within the field box

  playerName=member("fname").text

  go to next

end

 

The Reveal Button Script

 

on mouseUp me

  global playerName

  member("revealname").text=playerName

end

 

Thats it really....if its your first time using global variables inside director it can be a bit confusing if you are used to other programming languages.

 

Good luck


Viewing all articles
Browse latest Browse all 77806

Trending Articles