1
votes

Does anyone know if its possible to access children elements in a SWC? I have created some MC's and inside of some of these MC's I have some dynamic textFields. I export the content to a SWC and load it into my Flex project. No problem loading it or accessing the parent elements, they display fine. But I want to access the textfields nestes in the MC's and modify the text. When I debug the app, I can see the textfields as child elements. It's typed as a TextField and the Instance Name is the same as input in the Flash IDE but I cannot access it. When Flex compiles it throws an error saying it doesn't recognize the method. I've tried to insert actionscript on the timeline, linked external classes and nothing can be accessed. Does anyone know of a way to do this?

2
I think you're going to need to show us what you're trying--your comment to Cory makes it look like you're just trying to access fields of the imported class. Are they public? Are their types exported in the SWC?Michael Brewer-Davis
I know, problem is, Im not sure how to show you, its not all code, screenshot maybe? I'm exporting each component for runtime in the Flash IDE via the Linkage option on each MC, so that exported class is what I can access through the swc. I'm not sure how to make the child element(textfield) public this way though. This is my first time using a swc. Is this the correct way? Im placing each of these components in another, parent, container element and exporting it as a swc.Daniel Dunn

2 Answers

1
votes

It's hard to say since you're not showing your code that fails, but I suspect you're doing:

import myswc.*;

myswc.Symbol1.myTextField.text = "Foo"

instead of

var clip:MovieClip = new myswc.Symbol1();
clip.myTextField.text = "Foo"
0
votes

I just bumped into this as well, and am curious as to why you're suggesting he's NOT using the instance name since myTextField is obviously an instance name for the TextField he's using....