We help IT Professionals succeed at work.

Actionscript problem with attachMovie and displaying text in a textinput

jockmahon
jockmahon asked
on
360 Views
Last Modified: 2012-06-21
Actionscript / Flash Problem

I have created a dynamic movie clip which has a number of text inputs in it i need to create this movic clip and then put text in the inputs ,
if i trace out to the output panel the text value of the inputs i get the right value but it wont display in the text input

here is the as class


import mx.controls.DateField;
import mx.controls.Button;
import mx.controls.TextInput;
import mx.controls.DataGrid;
import mx.utils.Delegate;


class CreateMARChartForm extends arpx.ArpXForm
{
            
      var startDateField:DateField;
      var endDateField:DateField;
      
      var pDataGrid:DataGrid;
      
      var saveDetailsButton:Button;
      
      var detailsArray:Array;
      
      //-------------------------------------------------------------------------      
      //-------------------------------------------------------------------------      

      function CreateMARChartForm()
      {

      }

      
      function onLoad()
      {
            
            setUpDataGrid();
            
            saveDetailsButton.addEventListener("click", Delegate.create(this , saveDetails) );
            
            _parent.dispatchEvent({type:"loaded"});
            
      }
      
      var pVO;
      var mcArray:Array;
      
      var intervalID;
            
      public function populatep(pVO:PVO):Void
      {
            mcArray = new Array();
            this.pVO = pVO;
            
            for(var i = 0; i < pVO.getPArray().length; i++)
            {                                      
                  var p = pVO.getPArray()[i];

                  var rowItem:Array = new Array();
                  
                  rowItem['Qty']      = p.getQuantity() + " " + p.getUomName();
                  rowItem['Item'] = p.getPName();

                  pDataGrid.addItem(rowItem);
                  
                   mcArray[i] = this.attachMovie("marTimings", "marTimings_mc"+i, this.getNextHighestDepth(), {_x:50, _y:180 + (i * 60)});
                  


            
            }
            
            

            p.getColumnAt(0).cellRenderer = "MultiLineCell";
            .selectedIndex = 0 ;
            
            prepopulateDetails();
            
      }


      private function prepopulateDetails():Void
      {
            for(var i = 0; i < VO.getPItemArray().length; i++)
            {      
                  var pItem = pVO.getItemArray()[i];
                  var detailsArray:Array = pItem.getMARDetails();
                  
                  if(detailsArray != undefined)
                  {
                        mcArray[i].time1TextInput.label.text = detailsArray[0][0];
                        mcArray[i].time2TextInput.label.text = detailsArray[0][1];
                        mcArray[i].time3TextInput.label.text = detailsArray[0][2];
                        mcArray[i].time4TextInput.label.text = detailsArray[0][3];
                        mcArray[i].time5TextInput.label.text = detailsArray[0][4];

                        mcArray[i].quantity1TextInput.text = detailsArray[1][0];
                        mcArray[i].quantity2TextInput.text = detailsArray[1][1];
                        mcArray[i].quantity3TextInput.text = detailsArray[1][2];
                        mcArray[i].quantity4TextInput.text = detailsArray[1][3];
                        mcArray[i].quantity5TextInput.text = detailsArray[1][4];            
                        

                  }
            }
      }
      
      private function setUpDataGrid():Void
      {
            pDataGrid.getColumnAt(0).width = 250;
            pDataGrid.getColumnAt(1).width = 75;
            
            pDataGrid.sortableColumns = false;
            pDataGrid.rowHeight = 40;
      }
      
      private function saveDetails():Void
      {
            detailsArray = new Array();

            for(var i = 0; i < pVO.getItemArray().length; i++)
            {
                  var timeingsArray = new Array(new Array(), new Array());
                  timeingsArray[0][0] = mcArray[i].time1TextInput.text;
                  timeingsArray[0][1] = mcArray[i].time2TextInput.text;
                  timeingsArray[0][2] = mcArray[i].time3TextInput.text;
                  timeingsArray[0][3] = mcArray[i].time4TextInput.text;
                  timeingsArray[0][4] = mcArray[i].time5TextInput.text;

                  timeingsArray[1][0] = mcArray[i].quantity1TextInput.text;
                  timeingsArray[1][1] = mcArray[i].quantity2TextInput.text;
                  timeingsArray[1][2] = mcArray[i].quantity3TextInput.text;
                  timeingsArray[1][3] = mcArray[i].quantity4TextInput.text;
                  timeingsArray[1][4] = mcArray[i].quantity5TextInput.text;

                  detailsArray.push(timeingsArray);
                  
            }
            
            _parent.dispatchEvent({type:"saveTimeings"});
      }
      
      
      public function getTimeings():Array
      {
            return detailsArray;
      }
      

}
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2008
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
The inputs are the TextInput UI component not a textinput does that make a difference

cheers
CERTIFIED EXPERT
Top Expert 2008

Commented:
if you have used any mask on the movieClip which has textInput UI components, then you must used embed fonts..

instance.embedFonts = true;

Author

Commented:
There are no masks applied to the mc, when the form is loading i can briefly see the values before the inputs full load this is when i use the following to place the values ins

mcArray[i].time1TextInput.label.text = detailsArray[0][1];

Author

Commented:
ok changed all the components to textinputs and have it working now not exactly what i wanted but have been at it all day and getting so buggered off with it , thanks for your help

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.