PDA

Volledige versie bekijken : 2 textfields 1 html tabel


Joepiooo
%Europe/Berlin %351 %2010, 09:26
Hallo,

Ik heb nu een score systeem gemaakt in Flash waar hij score en naam in een textfield stopt. Nu doet hij deze er alle 2 tegelijk in. Hoe kan ik deze in 2 aparte textfields stoppen?

Dit is de code die ik heb:


var variables:URLVariables = new URLVariables();

var request:URLRequest = new URLRequest();

////insert in the location of the php script ////////////////
request.url = "http://www.justenter.nl/scorehitgame.php";
//////////////////////////////////////////////////////////////

request.data = variables;
var loader:URLLoader = new URLLoader();
///////////////////////////////////////////////
var punten:Number = 0;
balletje.addEventListener(MouseEvent.CLICK, onButtonclicked);



function onButtonclicked(e:MouseEvent):void {
punten ++;
score.text = String (punten);
}
stop();
submitBtn.addEventListener(MouseEvent.CLICK,submit F); // where submitBtn is your button

function submitF(e:Event){
variables.name=nameTF.text; // where nameTF is your input texfield
variables.final = score.text; // where score is the variable you use to tally user score
loader.load(request); //sends the request
gotoAndStop(6);
}
restart1.addEventListener(MouseEvent.CLICK,restart _game1);

function restart_game1(e:Event)
{
gotoAndStop(1);
}

stop();
//when the request is done loading, it goes to the completeWriting function
loader.addEventListener(Event.COMPLETE, completeWriting);

function completeWriting(event:Event):void {
var f:TextFormat = new TextFormat("Arial",12,0xFFFFFF,true);
var writingCompleted:TextField = new TextField;
writingCompleted.name = "theHighScores";
writingCompleted.defaultTextFormat = f;
writingCompleted.htmlText= event.target.data;
writingCompleted.autoSize = "center";
writingCompleted.selectable = false;
writingCompleted.border = true;
writingCompleted.x = 150;
writingCompleted.y = 50;
addChild(writingCompleted);
}
restart.addEventListener(MouseEvent.CLICK,restart_ game);

function restart_game(e:Event)
{
removeChild(getChildByName("theHighScores"))
gotoAndStop(1);
}
stop();
Is er iemand die weet hoe ik deze beide apart in een textfield uit kan lezen?
Bedankt

cornedor
%Europe/Berlin %363 %2010, 09:43
je kunt split gebruiken om de score in een array te doen, dan kunt je de ene helft van de array in het ene textveld doen en de andere en de andere helft.