adifrank
05-03-2010, 02:01 PM
Hi. I'm building my first Object Oriented Project in Flash CS4, using AS3, which I'm just starting to get the hang of, but apparently still not quite. I'm learning by myself, with the aid of some tutorials, forums such as this and ebooks...
Without going into excessive details, i'll want to ask some general questions. Hopefully your replies will help me work things out with my specific problem. If not, I'll post again with a more elaborate description of the particular hurdle I'm trying to overcome.
The general questions all have to do with accessing properties and methods of display objects which exist either in the Flash UI or in code, written in a different .
1. When dealing with a display object which was created within the Flash API - I have understood that I can access their instances by name only when the objects are Movie Clips, Buttons or Dynamic Text Fields. Only in these cases I have the option of giving an instance name in the Properties Window. So am I correct to assume that if I want to make a simple shape to function as a mask layer, but I wish to later access this shape from code in external action script files - I should place this shape in a Movie Clip, regardless of the fact that it has no use of timeline functionality?
2. What kind of syntax must I use to access properties and methods of a display object, when dealing with an object instantiated in a different .as file?
3. Say I have a display object (in this case - a Movie Clip, Button or Dynamic Text Field), which I drew and placed on the stage within the Flash API (not through code). I gave it an instance name - for this example I'll call it myMovieClip. How do I access the properties and methods of myMovieClip from an external .as file? is it stage.myMovieClip.propertyOrMethod?
4. Am I correct in thinking that the only way to access a display object (from code) that is not a Movie Clip, Button or Dynamic Text Field - is to figure out its child index and accessing it that way?
5. I remember reading that recommended to add _mc to the end of Movie Clip instance name. But I don't remember why?
Thanks!
Without going into excessive details, i'll want to ask some general questions. Hopefully your replies will help me work things out with my specific problem. If not, I'll post again with a more elaborate description of the particular hurdle I'm trying to overcome.
The general questions all have to do with accessing properties and methods of display objects which exist either in the Flash UI or in code, written in a different .
1. When dealing with a display object which was created within the Flash API - I have understood that I can access their instances by name only when the objects are Movie Clips, Buttons or Dynamic Text Fields. Only in these cases I have the option of giving an instance name in the Properties Window. So am I correct to assume that if I want to make a simple shape to function as a mask layer, but I wish to later access this shape from code in external action script files - I should place this shape in a Movie Clip, regardless of the fact that it has no use of timeline functionality?
2. What kind of syntax must I use to access properties and methods of a display object, when dealing with an object instantiated in a different .as file?
3. Say I have a display object (in this case - a Movie Clip, Button or Dynamic Text Field), which I drew and placed on the stage within the Flash API (not through code). I gave it an instance name - for this example I'll call it myMovieClip. How do I access the properties and methods of myMovieClip from an external .as file? is it stage.myMovieClip.propertyOrMethod?
4. Am I correct in thinking that the only way to access a display object (from code) that is not a Movie Clip, Button or Dynamic Text Field - is to figure out its child index and accessing it that way?
5. I remember reading that recommended to add _mc to the end of Movie Clip instance name. But I don't remember why?
Thanks!