Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 3.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-05-2006, 10:47 AM   #1
flexy
Everything about me's...
 
Join Date: Aug 2006
Location: UK
Posts: 198
Default Undefined properties of dynamic fields

I'm creating a load of form fields on-the-fly, and I'm getting errors in the Eclipse problems panel telling me that the properties of these fields that I am refering to are undefined. How can I 'trick' Eclipse into thinking it's fine (as it would be a runtime)??
flexy is offline   Reply With Quote
Old 09-05-2006, 11:29 AM   #2
Tink
Addict
 
Tink's Avatar
 
Join Date: Nov 2001
Location: London
Posts: 2,128
Default

can ya post the code?
Tink is offline   Reply With Quote
Old 09-05-2006, 01:16 PM   #3
flexy
Everything about me's...
 
Join Date: Aug 2006
Location: UK
Posts: 198
Default

Sure. Here's a summary of what I'm trying to do:

Code:
private function createFields():void
{
var label1:Label = new Label(); label1.text = "Payment:"; thisBox.addChild(label1); var input1:TextInput = new TextInput(); input1.id = "payment; thisBox.addChild(input1); panel3.addChild(thisBox);
} private function addValues():void {
theSum = 150+Number(payment.text);
}
Currently generates an error Access of undefined property payment.
flexy is offline   Reply With Quote
Old 09-05-2006, 03:41 PM   #4
Tink
Addict
 
Tink's Avatar
 
Join Date: Nov 2001
Location: London
Posts: 2,128
Default

the id propery in AS is not the same as the id property in MXML.

i.e. the following is the same

AS
var input1:TextInput = new TextInput();

MXML
<mx:TextInput id="input1"/>

Because you create your dynamic objects as vars within a function you can't reference them directly outside the function.

To get round this you could store a reference to your objects in an Array and then access them from there.
Tink is offline   Reply With Quote
Old 09-08-2006, 03:19 PM   #5
flexy
Everything about me's...
 
Join Date: Aug 2006
Location: UK
Posts: 198
Default

Thanks for that. The whole object method is certainly the best way to approach it.
flexy is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
multiple dynamic text fields in one movie rockingmyworld ActionScript 2.0 1 04-25-2006 03:25 PM
construct a variable name by concatenating two strings/variables raldred ActionScript 2.0 13 12-05-2005 02:29 PM
Dynamic text fields with PHP and MySQL Jason129 ActionScript 2.0 2 02-26-2005 05:38 PM
Blurred Dynamic Text Fields, Masks, Embedding, and Frustration pajhonka ActionScript 2.0 5 02-07-2005 11:51 PM
dynamic text 'undefined' in browser only banca ActionScript 2.0 2 02-07-2005 07:33 AM


All times are GMT. The time now is 10:06 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.