Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash


ActionScript 3.0 :: Accessing Stage Elements From Within Nested MC?

After quite some time I finally decided to pick up Flash again, this time taking the OOP route. I'm a bit rusty though, so I'm stuck on something pretty basic.Here's my Layout of relevant objects and scripts:

Stage > gunAmmo (TextField)
Stage > player (MC) > pistol (MC)
........ > >

As you might've guessed, what I'm trying to do is set the gunAmmo.text property from within my pistol class. I've tried using MovieClip(root).gunAmmo, stage, etc., but neither seems to be working. I sort of get why, but I don't know what the correct syntax is. (And yes, the TF's instance name has been set correctly.

View 2 Replies (Posted: 04-03-2011, 12:37 PM)

Sponsored Links:

Related Forum Messages For Flash category:
ActionScript 2.0 :: Accessing Elements On The Stage From A Linked Class
I'm trying to link a clip to a class, and it goes well until I try to access MovieClips or TextFields placed on the stage within that clip from code in the class. My code is below; there is a TextField called output_txt on the stage within this clip.

class Main extends MovieClip{
public function Main() {
//trace("123"); <--if I replace the line below with this, it traces nicely
output_txt.text = "123";

Posted: November 28th, 2007

View 3 Replies!   View Related
ActionScript 3.0 :: Accessing Stage From Nested Movieclip?
I have the following code nested in a movieclip, how can I reference the stage correctly from that movieclip?

stage.addEventListener(KeyboardEvent.KEY_DOWN, reactToArrowKeys);
function reactToArrowKeys(keyEvent:KeyboardEvent):void
if (keyEvent.keyCode == 37)


Posted: May 22, 2010 3:38 PM

View 8 Replies!   View Related
Actionscript 3 :: Namespaces In Nested Xml Elements?
I have seen afew answers to the problem i am having now but mine is that of a nested one.

I have an xml looking like this:

<type xmlns="" xmlns:xsi="">


now, how do i access the element of the implemented_with node?

ofc i could access the xmlList this way:

namespace ns =;

but now, how do i access the implemented_with node in the model xmlList? i tried type.ns::model.implemented_with, but didn't work.

Posted: Dec 30 10 at 13:04

View 1 Replies!   View Related
Flex :: Converting Nested ArrayCollection Elements To Another Class?
I have an ArrayCollection and each element is an instance of the TreeNode class (a custom class made by me) that has a "children" property which is an ArrayCollection of more TreeNode elements. That way, I have a tree of elements in an ArrayCollection structure:

tree = new ArrayCollection([
[new TreeNode(param1, param2, new ArrayCollection([
[new TreeNode(param1, param2, null)],


But my problem is: I need to have the same "tree" structure (it doens't need to be the same variable) filled with instances of another class. How can I achieve that?

Posted: Feb 1 11 at 11:36

View 1 Replies!   View Related
ActionScript 3.0 :: Accessing Elements In Xml
I have the following descriptive xml and code... the code doesn't work as it should be


Posted: November 17th, 2011

View 4 Replies!   View Related
ActionScript 3.0 :: Accessing Values From Child Elements?
I have a movieclip, with the instance name SizingBox, on the main timeline. Within that mc, I have a Slider component, with the instance name Sizer. I want to declare an action listener on the main timeline which will listen to changes for Sizer and do something based on the current value of the slider.In AS2 this was really easy, but I cannot seem to figure it out for AS3.

var X = SizingBox.Sizer.value;
this code gives an error.


Posted: 07-09-2009, 06:38 PM

View 0 Replies!   View Related
ActionScript 3.0 :: Difficulty Accessing JSON Values Of Elements
I am working on a information visualization project that involves visualizing json data from online forums. The problem that I'm having is that I'm not able to access all of the values of elements the json. Here is my Schema:

[{"course": "compsci 101",
"forums": {
"forum": {
"forum_title": "Week 11 - Cable and the Specialization of Television",
"forum_word_count": "1000",
[Code] .....

I tested and the json is valid but when I run it with this code it only is able to pull the last value (Week 2 Discussion 1 - Cable and Broadcast Television).
for (key in tuples) {
trace("forum title: "+ tuples[key];
So, my question is, why isn't it tracing all of the values for the forum title? and what do I need to change to access those values?

Posted: 08-25-2009, 06:18 PM

View 2 Replies!   View Related
ActionScript 2.0 :: Accessing Authoring Elements Of Component At Runtime
Is it possible in Flash 8 accessing from the linkage class, associated to a component, the graphics elements (for instance, a standard UI component, like a tree or a comboBox) that are on the movieclip this class refers to?

Posted: March 6th, 2007

View 1 Replies!   View Related
ActionScript 3.0 :: Accessing Nested Buttons In Mc's?
I'm trying to organize a presentation using several movieclips as "scenes." The problem I have is related to buttons nestedwithin those mc's--I would like them not to be available until eachindividual mc begins, but if I don't include the buttons on thefirst frame of the mc timeline, the main timeline cannot accessthem (and throws me an error)

Posted: Feb 12, 2009 1:10 PM

View 8 Replies!   View Related
ActionScript 3.0 :: Accessing A Property In A Nested Mc?
I would like to rotate the yellow circle mc, w/ it's nested white circle movie clip, and use the drawing API to have a line continuously drawn to the white circle as it moves around.

I'm using the code below. The line gets drawn to a static point, and not to the white circle (smBall) movie clip as I would expect.


Posted: Mar 19, 2010 7:02 PM

View 5 Replies!   View Related
ActionScript 3.0 :: Accessing Dynamic Nested MC's?
I'm working on an educational game that interacts with randomly selected characters. The names and attributes are imported from xml. I have a mc called characters that contains each character on a frame tagged with their name. The frame label is the characters name and I am having no problem displaying each character as they are randomly called.

characters = new Characters();
characters.y = 350;

Each charater is a mc with 2 frames one with mouth closed and one with mouth open. Because the characters are accessed using the variable characterName as the frame tag I can't figure out how to tell the movie in AS3 to gotoAndStop on frame 2 of the character mc. I've tried numerous variations and just can't get it to work.

Posted: 07-30-2009, 03:39 PM

View 0 Replies!   View Related
ActionScript 2.0 :: Accessing A Nested Movieclip?
This is probably a very simple solution, but I can't seem to find it online. Basically, I have a button that need to change a movieclip's frame in it's parent.So I tried:

ActionScript Code:

But it's not working! I know I'm getting to the right locaiton because _parent holds a variable, and I can access that just fine. But I for some reason can't access the movieclip at all.

Note: I can't upgrade to AS3 (What I'm used to) as this isn't my file.

Posted: 09-01-2010, 05:15 AM

View 9 Replies!   View Related
Actionscript 3.0 :: Accessing A Nested Clip?
I'm trying to activate a nested movie clip with a button in the main timeline. I want the button to move the nested clip to the 2nd frame, thereby passing over the stop(); in the first frame. I'm not sure how to point the button at the correct timeline, though.

Posted: Sat Sep 11, 2010 4:08 pm

View 1 Replies!   View Related
ActionScript 2.0 :: [F8] Accessing Nested Nodes In XML
I'm trying to access some information in XML. I got the first few nodes working, but for the life of me, I can't figure out how to get to the nested nodes. I've tried everything i can think of. I thought it would have to do with nested for loops, but i couldn't get it to work. What am I missing? I've been pretty successful with simple XML, and this is relatively simple too, but more than I'm used to at this point... If there is a better way to do any of this, I'm all ears (or all eyes in this case )


Posted: October 3rd, 2006

View 7 Replies!   View Related
ActionScript 3.0 :: Accessing Nested Movieclips?
I have a movie clip (assigned to a class) with several keyframes. Each keyframe consists of another movieclip, which contains an animation and all use the same name. Lastly, several of the animations contain a third movieclip, which is also assigned to a class and also use the same name. I need the first movieclip to speak to the third, unfortunately, it simultaneously tells me that the clips in the second layer (the ones at the keyframes) exist and do not exist. Namely: second layer "does not exist" in that the primary movieclip has only one child: a null. If I add other movieclips to the primary's frames, they also report back as nulls depending on what frame I'm on. I've tested this in several parts of the code, though I suppose it's possible that I managed to pick five equally bad spots. It's just so bizarre I still don't know what to think about it. However, the second layer of named clips are there, but I can only prove it by deliberately breaking the code in hopes of deliberately getting a reference error (by attempting to make the clip private, which isn't allowed given my setup).

Posted: 12-05-2009, 11:41 PM

View 0 Replies!   View Related
ActionScript 3.0 :: Load The .swf With The Exact Stage Size So The Graphic Elements Do Not Float Outside The Loaded Movies Stage Area?
I'm making a mockup for a client and I need to Load the .swf with the exact stage size so the graphic elements do not float outside the loaded movies stage area. [URL]Basic load code I'm using...

Actionscript Code:
import flash.display.*;var adLoader1:Loader = new Loader();adLoader1.load(new URLRequest("100828_budlight_texas_fight_728x90_jn.swf"));adLoader1.x = 313;adLoader1.y = 162;addChild(adLoader1);var adLoader3:Loader = new Loader();adLoader3.load(new URLRequest("100828_budlight_texas_fight_300x615_jn.swf"));adLoader3.x = 738;adLoader3.y = 0;addChild(adLoader3);

Posted: 09-07-2010, 01:15 PM

View 3 Replies!   View Related
Actionscript 3 :: Accessing GUI-created Elements In A Class Definition File?
I've used the GUI to create a rectangle that I turned into a button symbol (SimpleButton). I then edited the button so that it had 4 different button states and a text layer on top. I then created a class definition file for this object so that I could dynamically change the label text (the text layer) when adding instances of this button to the stage.

I was able to create and link a class file ( just fine, but when I try to access the text field that I created on the button, I get the error:

"Access of possibly undefined property btnLabel through a reference with static type com.examples:DynamicButton."

when i couldn't get that to work, I decided I'd try adding the TextField directly within the class definition file, using the following code:

package com.examples
import flash.display.Sprite;
import flash.display.SimpleButton;


The problem is that I can't seem to add the TextField to the SimpleButton, as it's not a display object. So, I tried adding it to the parent of the simple button (and I figured, I'd just place it exactly above the button). But then I get a "null object reference." error.

is there a way to access GUI-created elements from w/i a class definition file? How would I add the TextField to the button using only AS3 inside of a my class definition file?

Posted: Mar 18 10 at 14:42

View 1 Replies!   View Related
ActionScript 3.0 :: Accessing Graphic Symbols Through Nested MC's?
Let's say I have Class Holder linked to a MovieClip holder_mc. holder_mc has a child held_mc that has a Graphic Symbol pic_gr. pic_gr has multiple frames.

From the Class file of Holder, how would I change the frame of pic_gr? I also didn't see a way to name the instance of pic_gr, is that right?

Posted: 11-02-2009, 07:58 PM

View 0 Replies!   View Related
ActionScript 3.0 :: Accessing Nested Instances From Another Class?
I made a movieclip (map) with nested instances (cities) in IDE and I want to access them from non-document class.

But the class can't access them until it's added at the stage too.

If I add the class at stage, class can see and access only map, but not cities inside of it.

Both class and map are children of document class...

Posted: 02-02-2010, 12:47 PM

View 0 Replies!   View Related
ActionScript 3.0 :: Accessing Nested Text Fields?
I have a dynamic text field, which I then converted to an object and instanced. Both the text field and the object have a instance.I tryed both:

//startbtn being the object, text1_txt being the text field.
startbtn.text1_txt.text = "lol";


text1_txt.text = "lol";

I found the ladder to be more logical, but neither worked. Anyone have a way to get at these nested text fields?

Posted: February 19th, 2009

View 1 Replies!   View Related
ActionScript 3.0 :: Accessing Nested Functions And Scope?
How can one class access a nested function in another class.Examplish.

main class{
public function main(){


Posted: June 22nd, 2009

View 3 Replies!   View Related
ActionScript 3.0 :: Accessing Nested Movieclips From Loaded SWF?
I am having a newbie problem here. I am loading an external SWF with embedded movieclips (all clips are set to export in the original file). However, I can't figure out how to access those embedded clips in my new, parent, flash file. Here is my code:

var container:MovieClip=new MovieClip()
var house_Loader:Loader = new Loader();


Posted: January 18th, 2010

View 4 Replies!   View Related
ActionScript 2.0 :: Accessing (Nested) Component Properties From Class
(Actionscript 2 btw - and actually cs4, not that it really makes any difference?) I have a class that instantiates a movieclip from the library, e.g.:
debugbar:MovieClip = thing.AttachMovie("debugbar", "debugbar_mc", 999);
So attaching it to the where ever "thing" is - could be movie clip or level0 or whatever, doesn't matter as "debugbar" is a private variable of the class. Now the important part - debugbar in the library is a movieclip that contains some components - buttons and textInputs. The problem comes when trying to access these components.

I would have thought that this would work:
debugbar.input_txt.text = "hello";
In order to set the text of "input_txt", the instance name of a TextInput component on the timeline of the movie clip (put there in author time). However, this does not work. Infact, I cannot access any specific "component" properties - they come back undefined. I can however set and retrieve MovieClip properties for the "input_txt", such as _x. However there is one added strange thing with this too - setting _visible to false doesn't seem to work (however perhaps a component by default overrides this).

I also appear not to be able to add event handlers to the component - at least for the usual component events. I tried casting it to a component, such as:
var temp:TextInput = TextInput(debugbar.input_txt);
which gave "temp" as null.
However if you trace the thing itself without casting to what it is, it gives the path to correctly. It almost seems like the components are somehow broken when trying to access them this way - or that they cannot be accessed this way?

The thing is, I was able to access all of this before, when the code to do it was placed on the timeline (frame 1, the only frame) of the debugbar itself, where the components were child instances. This meant I could just reference them directly too - so input_txt rather than debugbar.input_txt , although that is probably largely irrelevant. I need to have it in a class though, as I need to pass in certain objects that need to be accessed by the mc.

Posted: 07-29-2009, 08:08 PM

View 2 Replies!   View Related
ActionScript 3.0 :: Accessing A Nested Object Inside Array?
private var myObject:Object = new Object();
private var myArray:Array = new Array();
myObject[dynamic_name] = true;


Posted: 11-24-2009, 05:32 PM

View 1 Replies!   View Related
Copyright 2005-08, All rights reserved