A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Dynamic News Editing

  1. #1
    Huh, Radio.
    Join Date
    Nov 2006
    Location
    IL
    Posts
    22

    [RESOLVED] Dynamic News Editing

    I am trying to create a news editing system. All parts of the news (title, author, date, content) are loaded from a mySQL database. PHP is exporting the variables from the database to flash. I then load the variables into a combo box. Now, the name is working, or in essence, the "label" of the combo box. The entries show up in the combo box, however clicking on them does not change the text inside the textboxes I have created for this. My textboxes have the correct variables of "texttxt" and "authortxt" and so forth. I am using a mix of input and dynamic boxes.

    Please examine my script, I have been stuck on this for days and would really like to get over the hurdle.

    Code:
    //populating the combobox "dropDown"
    function AddItems() {
    	for (i=0; i<NumItems; i++){
    		var Name = eval("Name"+i);
    		var TextData = eval("TextData"+i);
    		var Author = eval("Author"+i);
    		var TheDate = eval("TheDate"+i);
    		var ListBoxData = { textData:TextData, author:Author, theDate:TheDate};
    		
    		dropDown.addItem(Name, ListBoxData);
    	}
    	dropDown.setChangeHandler("SelectItem");
    }
    //loading variables into text boxes "newstitle_input" and "newstxt_input"
    function SelectItem(){
    	titletxt = dropDown.getSelectedItem().label;
    	texttxt = dropDown.getSelectedItem().data["textData"];
    	datetxt = dropDown.getSelectedItem().data["theDate"];
    	authortxt = dropDown.getSelectedItem().data["author"];
    }
    Last edited by pyramidhead; 01-06-2007 at 03:58 AM.

  2. #2
    up to my .as in code Chris_Seahorn's Avatar
    Join Date
    Dec 2004
    Posts
    4,389
    Already tested with fake data
    http://flex.hobby-site.com/examples/pyramidhead.html

    Change this:

    dropDown.setChangeHandler("SelectItem");
    }

    function SelectItem(){
    titletxt = dropDown.getSelectedItem().label;
    texttxt = dropDown.getSelectedItem().data["textData"];
    datetxt = dropDown.getSelectedItem().data["theDate"];
    authortxt = dropDown.getSelectedItem().data["author"];
    }



    To this:

    dropDown.addEventListener("change", this);
    }

    function change(evt){
    _root.titletxt = dropDown.getSelectedItem().label;
    _root.texttxt = dropDown.getSelectedItem().data["textData"];
    datetxt = dropDown.getSelectedItem().data["theDate"];
    authortxt = dropDown.getSelectedItem().data["author"];
    }

  3. #3
    Huh, Radio.
    Join Date
    Nov 2006
    Location
    IL
    Posts
    22
    Thank you so much. This was a perfect fix... hours and hours of debugging and now it works!

  4. #4

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