PDA

View Full Version : Dot Syntax help


yourguide
11-22-2005, 05:21 PM
I have a text box "Itm1Qty" within a movie clip "Item1" and I am trying to get the value of it in my main movie.

I have tried multiple ways, nothing seems to work.

Datasender.Itm1Qty = Item1.Itm1Qty.text

Do I need to do it from within the movie clip instead of the main timeline?

Like in the MC have: _root.Datasender.Itm1Qty = Itm1Qty.text ?
Thanks.
:eek:

Gibberish
11-22-2005, 05:31 PM
Where is this code being run? Datasender.Itm1Qty = Item1.Itm1Qty.text

From root or inside the Item1 mc? if it is inside the item1 mc then you need to do _root.Datasender.Itm1Qty = Itm1Qty.text

yourguide
11-22-2005, 06:05 PM
The Code is actually running from the root right now.
Which I would prefer because I have more text boxes in the root that I want to include in my Datasender object.

But I just cant get it to work... it always says "Undefined" in the field.

You can download my code here (http://www.outofthegarage.org/excessinvform.zip)... It was just a little too big to upload to this webboard.

Then the code is on the "Logic" layer, line 219 and on.
The first lines are all for applying styles, etc... so they can be ignored.

bombsledder
11-22-2005, 06:16 PM
dont have time to look at your code but your textfield "Itm1Qty" is that its variable or its instance name because if its its variable you dont need the .text part but like i said i have no time to look at your code

yourguide
11-22-2005, 06:21 PM
That is its instance name.
It works when I have the text field in the main movie.... but when I try to access from within the MovieClip thats in an accordion component... it just wont work.

Gibberish
11-22-2005, 06:34 PM
replace your code with this in the appropriate place. I grabed te first few lines of the above code and lines of the below code so you could see where it goes, its about line 108.

The problem was you were calling the items wrong. You need to tell it to look into the accordian comp and then which child item in the accordian.

I also put it into a for loop to streamline it for you.

//assign properties to LoadVars object created previously
dataSender.Contact = Contact.text;
dataSender.CoName = CoName.text;
dataSender.Email = Email.text;
dataSender.Phone = Phone.text;
dataSender.Fax = Fax.text;

// Loop through all children and assign varaibles to dataSender
for(var i=0; i < Items.numChildren + 1; i++){
dataSender["Itm"+(i+1)+"Qty"] = Items.getChildAt(i)["Itm"+(i+1)+"Qty"].value;
dataSender["Itm"+(i+1)+"Brand"] = Items.getChildAt(i)["Itm"+(i+1)+"Brand"].value;
dataSender["Itm"+(i+1)+"Desc"] = Items.getChildAt(i)["Itm"+(i+1)+"Desc"].value;
dataSender["Itm"+(i+1)+"Cmnts"] = Items.getChildAt(i)["Itm"+(i+1)+"Cmnts"].value;
//trace(Items.getChildAt(i)["Itm"+(i+1)+"Qty"].value);
}
//callback function - how to handle what comes abck
dataReceiver.onLoad = function() {

yourguide
11-28-2005, 01:39 AM
Thank you so much for taking the time to look at my code and helping me with this.

I really appreciate it and hope I am able to oneday return the favor.

Thanks again,
Dan