dcsimg
A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: loading php data into flash textfields

  1. #1
    Junior Member
    Join Date
    Oct 2002
    Posts
    17

    loading php data into flash textfields

    ive created a munber of duplicate movie clips, and each clip contains 4 txt fields. the php file returns a bunch of variables:
    event_genre1 to event_genre10
    event_date1 to event_date10
    event_name1 to event_name10
    event_text to event_text10

    AS code in flash:

    //count is the number of clips needed as the amount of clips
    //needed will change
    for (i=1; i<=_root.count; i++) {

    //count%2 is what i think checks to see if count is even or odd
    //but its wrong

    if (count%2) {
    duplicateMovieClip("events1", "events"+i, i);
    _root["events"+i]._y = yvalue;
    yvalue = yvalue+100;
    _root["events"+i].genre.text = _root.event_genre+i;
    _root["events"+i].event_date.text = _root.event_date+i;
    _root["events"+i].nom.text = _root.event_name+i;
    _root["events"+i].info.text = _root.event_text+i;
    trace(i);
    trace("1");
    trace(yvalue);
    } else {
    duplicateMovieClip("events1", "events"+i, i);
    _root["events"+i]._y = yvalue;
    yvalue = yvalue+100;
    _root["events"+i].genre.text = _root.event_genre+i;
    _root["events"+i].event_date.text = _root.event_date+i;
    _root["events"+i].nom.text = _root.event_name+i;
    _root["events"+i].info.text = _root.event_text+i;
    trace(i);
    trace("2");
    trace(yvalue);
    }
    }

    but the prob is that all the text field in all the clips end up having the same text. any help is appreciated.

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Location
    Egypt
    Posts
    332
    "%" is an operator that gives the rest of the division.
    10%3 = 1
    6%2 = 0
    8%3 = 2
    if you want to check if a number is even, you'll see whether n%2=0

    to call the event_genre_i variable that is in the root timeline, where i is a variable, you use _root["event_genre_"+i] and not _root.event_genre_+i
    Code:
    //count is the number of clips needed as the amount of clips 
    //needed will change
    for (i=1; i<=_root.count; i++) {
    	//count%2 is what i think checks to see if count is even or odd
    	//but its wrong
    	if (count%2 == 0) {
    		duplicateMovieClip("events1", "events"+i, i);
    		_root["events"+i]._y = yvalue;
    		yvalue = yvalue+100;
    		_root["events"+i].genre.text = _root["event_genre"+i];
    		_root["events"+i].event_date.text = _root["event_date"+i];
    		_root["events"+i].nom.text = _root["event_name"+i];
    		_root["events"+i].info.text = _root["event_text"+i];
    		trace(i);
    		trace("1");
    		trace(yvalue);
    	} else {
    		duplicateMovieClip("events1", "events"+i, i);
    		_root["events"+i]._y = yvalue;
    		yvalue = yvalue+100;
    		_root["events"+i].genre.text = _root["event_genre"+i];
    		_root["events"+i].event_date.text = _root["event_date"+i];
    		_root["events"+i].nom.text = _root["event_name"+i];
    		_root["events"+i].info.text = _root["event_text"+i];
    		trace(i);
    		trace("2");
    		trace(yvalue);
    	}
    }
    regards,
    Hamza
    Last edited by hamzaf; 01-28-2003 at 02:49 PM.

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