ActionScript 3.0 :: Get UIComponent By Id Or Name, The GetChildByName Does Not Return Childrent Of Children

Sep 23, 2009

My application will load an xml file that has the name or id of a UIComponent. Later this will be used to set text or images.
 
This component could be on a panel or a panel in a panel, I am not familiar with flex but in javascript getElementByid would return the element wherever it is on the document (when called on the document). There is no get....Byid in fex and getChildByName does not look in children.For example

<mx:Text name="works" id="works"></mx:Text>    <mx:Panel>        <mx:Panel>            <mx:Text id="noWorkie" name="noWorkie" text="a test"></mx:Text>        </mx:Panel>    </mx:Panel>
this.getChildByName("works"); // worksstage.getChildByName("works"); // returns nullthis.getChildByName("noWorkie"); // returns null
  
Thinking of creating a getElementByid but has to be called from the top element, have no idea what the top element is.
For example this.root does not have a getChildren method to go through nor does stage. Guess I need to find the highest possible Container class starting with this.parent.There must be a "simple" way to do this but all examples I could find would not go from top level to lowest child as javascript would do in document.getElemetByid.

View 7 Replies


Similar Posts:


ActionScript 3 :: Calling Children Inside MC - GetChildByName / GetChild At?

Jul 20, 2010

I found out that I can't target a object inside the main MC if I use getChildAt / getChildByName. It will return me
Error #1119: Access of possibly undefined property someProperty through a reference with static type flash.display:DisplayObject.

I was trying to use something like
this.getChildAt(0).getChildByName("objectName")....

View 1 Replies

ActionScript 3.0 :: GetChildByName Return Null If Public Setting Is Flash 9

Jan 18, 2011

I am facing a weird problem. The following code returns null if targeted player is Flash player 9 but works fine for Flash Player 10.

[Code]...

It works fine if I give a delay using setTimeout. I am not sure what I may be doing wrong. I have attached the source files. (Flash CS5 format)

View 5 Replies

Actionscript 3 :: Children Of Image Or UIComponent Not Displayed?

Aug 17, 2010

For instance the mx.controls.Image objects are only displayed when i add them directly to the main application object. If i add a "subimage" to the previously created Image object it simply doesnt show.

What I want to do:

var img : Image = new Image;
var subimg : Image = new Image;
img.source = "images/panel.png";

[Code]....

View 1 Replies

Actionscript 3 :: Traverse Through Children Of A UIComponent Class In Flex?

Mar 3, 2011

I am dynamically creating a UI component based on XML templates stored in database. Now I want to access one of the child component of this UIComponent Class. I dont see any children property in this class? How could I possibly traverse through each child comppnent of this class and set its properties according to some logic in code(which I could not do in templates itself).

[Code]...

View 1 Replies

Flash :: UIComponent In Swc - New Instance Doesn't Seem To Construct The Children Arranged On The Layers

Jun 7, 2010

In Flash, if i create a custom Movieclip, and compile it to a SWC, i can use it in .fla files (by linking to the .swc)..

[Code]...

All the arrangement of graphics on the custom movieClip's layers is preserved. If i subclass UIComponent and compile to a swc, I can use the custom Class in my .fla file, but the new instance doesn't seem to construct the children arranged on the layers.

I know that the correct way to make a custom component is to have the two frames, first to specify bounding box, second frame for assets, and that the first graphic in frame 1 is removed at runtime. But i'm not really trying to make a reusable component - i just want to use the UIComponent class (It seems to have some nice extensions to Sprite). As i really want some hand-positioned layers inside the component i figured i could have the bounding box as the first element on frame 1 (knowing that it would be removed), but any other items i put on frame 1 would be preserved - buttons, images, lines, etc.

View 2 Replies

ActionScript 3.0 :: XML Return All Children

Jan 6, 2010

Ok, using the xml example below

[Code]...

Is there a way to create XML or an array of the <act> content (ie: p12_intro) in one swoop as apposed to having to loop through each node and use hasOwnProperty('act') or something similar? At the moment im looping through XML created with this line...

[Code]....

View 4 Replies

ActionScript 3.0 :: Xml.children() Returns Grand-children And Gr8-gran-children?

Nov 18, 2009

I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)

Code:
<root>
<dir name="images">

[code]....

View 2 Replies

Flex :: UIComponent Extended Class Isn't Showing UIComponent Extended Class

Aug 18, 2009

I have 1 class (that is extending a UIcomponent) that is representing a component. In that component I create different instances of another class that is also a UIComponent but this class doesn't show up in de first class. I see that it is running and that it has the correct hights but I got the feeling that it doesn't show up with this hights. If I trace I see the width and height is 200 X 200 but there is still nothing visible in my component.

View 1 Replies

ActionScript 3.0 :: Multiple Children Spawned With Timer Makes Old Children Inactive?

Mar 24, 2009

In this game attached I need the old Children (rats) to hurt the character when he walks into them, however only the most recently added Child is active in that way... also the rats seem to appear above the character instead of below, is there any way to resolve these issues??

View 4 Replies

ActionScript 3.0 :: [CS4] Children Inside Children - 1119: Access Of Possibly Undefined Property NumChildren

Jan 12, 2011

I have a Sprite called pageContent. Inside pageContent are 12 more Sprites with unique names, a couple of Buttons, and some TextFields. Inside each of the 12 Sprites I have either one or two TextFields and one TextInput. My question is, since they are children inside a child of pageContent, how can I access them? Here is how I am trying to do it:

[Code]...

In my mind, this should totally work. But surprise, surprise, it doesn't. I have debugged it and it works fine for the first two lines, but when it tries to get numChildren of a Child of pageContent (line 3), I get this error: PHP Code: 1119: Access of possibly undefined property numChildren through a reference with static type flash.display:DisplayObject.

View 4 Replies

ActionScript 3.0 :: GetChildByName Mc Inside Mc

Feb 28, 2009

I'm trying to declare a movieclip variable in a class by finding the instance name of the movieclip.

On my stage I have a 'Container' (linkage class name) MC, inside that is a 'PlayerInfo' (linkage class name) MC inside that is a 'healthBar_mc' (instance name) MC. healthBar_mc is what I'm trying to access.

the class where I'm trying to run this function is linked to a MC inside 'Container'

So I tried the following code:

[Code]....

View 11 Replies

ActionScript 3.0 :: GetChildByName() With Loop?

Oct 28, 2008

I'm trying to use XML to load in 4 images to a movieclip within a movieclip that is already created on the stage. I'm trying to do this in a loop since there are 4 movie clips I'm trying to access. I can get it working without the loop, but it's figuring out the syntax that's causing the problem. Currently I have the following code:

function ParsePics(picsInput:XML):void {
var picsList:XMLList = picsInput.pic.image;
for (var i:int = 0; i < picsList.length(); i++) {[code]..............

View 4 Replies

ActionScript 3.0 :: Cannot Set Property After Using GetChildByName?

May 2, 2009

I am adding a MovieClip to the container with the following code

ldr = new MovieClip();
ldr.graphics.beginFill(0xf0f0f0);  l
dr.graphics.drawRect(xPos,yPos,IMAGE_WIDTH,0);
 
[code]......

View 5 Replies

Flash :: Getting Instances Besides GetChildByName()?

Jul 7, 2010

I have many MovieClips and each has a name like "mcDummyClosed" and then and instance name "slideDummyClosed". Another MovieClip has a link to e.g. slideDummyClosed which I then call DummyClosed. I add a MouseEvent.CLICK event to DummyClosed.

Now without adding slideDummyClosed to the stage nor any other MovieClip can I with a string containing it's name get that instance? I've tried using getChildByName() but that only seems to work if I've already added the MC to be found and added before. My code looks something like this:

[Code]...

View 2 Replies

ActionScript 3.0 :: GetChildByName Functionality For XML?

Sep 7, 2011

I am not sure if this is even possible so this is why I am asking. So you know how we can access a nested movie clip by name with the following code:

mainMC.getChildByName("nameOfMC");

I was wondering if it is possible to do the same thing with XML data. So for exaple:

xmlData.house would be mainMC.getChildByName("house");

(obviously I know that getChildByName doesn't work for XML and am looking for an equivalent command)

View 2 Replies

ActionScript 2.0 :: RollOver & RollOut In Children's Children's Movieclip?

Jan 11, 2010

I want to have a rollover effect of a movieclip (mo1) inside a movieclip (mo) of another movieclip (popup1).Is it possible to do that? I try calling it using this code in the frame 1 of my flash, am i doing wrongly?

Code:
popup1.mo.mo1.onRollOver = function() {
popup1.mo.mo1.gotoAndStop(2);

[code]......

View 9 Replies

ActionScript 3.0 :: Changing Text With GetChildByName?

Jul 1, 2009

ok so im trying to change a dynamic txt in each button but i started with this one and i keep getting this error.

1087: Syntax error: extra characters found after end of program.

what is added or needs to be added? ive gone over the code several times and cant figure it out.

ActionScript Code:
var btnNum:uint = 7;
var spacing:Number = 0;

[Code].....

View 5 Replies

ActionScript 3.0 :: Accessing Methods And Properties Via GetChildByName

Dec 2, 2007

I seem to be having a bit of a problem here. I'm generating a load of class instances using the following code:

maxpersons=25;
for (var i:Number=1;i<=maxpersons;i++)
{
var person:Person = new Person;

[Code].....

OK. I then need to run through each of them and check for a collision with an object from the main stage (called redDot), which I pass to a method (called doDamage) within the class. I'm using the following code:

for (i=1;i<=maxpersons;i++)
{
if (game.getChildByName("person"+i).hitTestObject(red Dot))
{
game.getChildByName("person"+i).doDamage(redDot);
}
}

I keep getting an error saying "1061: Call to a possibly undefined method doDamage through a reference with static type flash.displayisplayObject."!

It just won't work. I've tried altering the code to:

game["person"+i].doDamage(redDot);

but I get an unexpected trace output saying "TypeError: Error #1010: A term is undefined and has no properties."

View 6 Replies

ActionScript 3.0 :: Call Variable By Name Similar To GetChildByName?

Feb 23, 2011

I have a several functions that I can compact into 1 function via a for loop if only I can find a way to call the variable by name.

For example:This is what I want to accomplish: (However I do not have the slightest clue as to how to go about doing the below...)

ActionScript Code:
var test1:String = "testing 1";
var test2:String = "testing 2";

[code].....

I am able to do something similar to the above when using objects using methods such as: (I know not efficient, but its just an example to show what I am trying to accomplish.)

ActionScript Code:
var test1:String = "testing 1";
var test2:String = "testing 2";

[code].....

View 7 Replies

ActionScript 3.0 :: GotoAndStop Doesn't Work With The GetChildByName?

Jul 22, 2009

I have this line on my code:

nav_mc.getChildByName("go" + i + "_mc").alpha = 0; // this works fine

but then if I add this:

nav_mc.getChildByName("go" + i + "_mc").gotoAndStop(2); // Doesn't work
nav_mc.go1_mc.gotoAndStop(2); // Works

nav_mv is a MC on stage, it's child is another mc whit 2 frames in use.why the gotoAndStop doesn't work with the getChildByName?this is the error I'm getting: 1061: Call to a possibly undefined method gotoAndStop through a reference with static type flash.display: DisplayObject.

View 2 Replies

ActionScript 3.0 :: Error #1006: GetChildByName Is Not A Function?

Mar 11, 2012

I'm trying to use the getChildByName function and for some reason it's not working. Here's the line that is causing the error of "TypeError: Error #1006: getChildByName is not a function."

PHP Code:

var contactBox:MovieClip = anyBox.getChildByName("earthBox" + i); 

It is in a for loop and is definitely calling to a movieclip of the correct name in the MC array anyBox. I've searched the internet and haven't found anything (On the first page of google...)

View 5 Replies

Data Integration :: Pulling In Children Of Children In XML

Sep 23, 2006

Newbie to XML here and I have what I *hope* is an easy problem, but I just don't know the answer. And as I have to try and show this by Monday, I'm sort of stuck. I am trying to pull in information about houses via an xml file. Each house has 1 address, 1 owner, 1 description, and about 6 photos. I have no problem accessing the address, owner, etc, and I can always access the first photo, but whenever I cycle through the photos, I seem to cycle through the first photo for every house, not every photo for each house.

Basically, I need the children <images> to go up by one, without the the parent going up by 1. I am hoping I am describing this well. My code looks like this:

[Code]...

View 4 Replies

Flex - Access Children Of Children Recursively?

Mar 10, 2010

I have a Canvas which has many components inside it and those again, have many components inside them.

getChildren() returns only the top level children. What is the best way to retrieve all the children (children of children of children and so on).

Well, I sorta know how to do this by iterating through the children, but the code is really messy. I'd prefer to use a nice recursive function. Has anyone written this before? Or is there a Util class to do this?

View 3 Replies

Data Integration :: Pulling In Children Of Children In XML?

Jul 24, 2010

I am trying to pull in information about houses via an xmlfile. Each house has 1 address, 1 owner, 1 description, and about 6photos. I have no problem accessing the address, owner, etc, and Ican always access the first photo, but whenever I cycle through thephotos, I seem to cycle through the first photo for every house,not every photo for each house.Basically, I need the children <images> to go up byone, without the the parent going up by 1. I am hoping I amdescribing this well.My code looks like this:

total = xmlNode.childNodes.length;
totalb =
xmlNode.childNodes[0].childNodes[5].childNodes.length;

[code].....

View 1 Replies

Actionscript :: Add Children To Accordion Children In Flex 4?

Oct 28, 2011

I have an ArrayCollection that is read to generate containers in an accordion programmatically:

<s:ArrayCollection id="_ac_ps">
<fx:Object label="Block and lot" data="_blocklot" searchType="districtblocklot"
info="" />

[code].......

View 1 Replies

Referencing Symbol On Stage - GetChildByName Returning Null

Sep 8, 2010

I have just recently started playing around with AS3 and am pretty new to what is going on in Flash (though I do have a lot of programming experience.) I have an object that I am dragging around on the mouse. I want it to be destroyed if I drop it anywhere but in a target location. I have the part where it is destroyed working, but I am running into a problem trying to find the target. When I try the following...

PHP Code:
public function DropObject(){
if (! this.hitTestObject(stage.getChildByName("Target"))){
stage.removeChild(droppedObject);
stage.removeEventListener(MouseEvent.MOUSE_MOVE,droppedObject.MouseCursorMove);
}}

I get "TypeError: Error #2007: Parameter hitTestObject must be non-null." So, "getChildByName" is returning null, but I'm not sure why. I've verified that there is an Instance name of the Target on the stage. Why can't I find it?

View 4 Replies

ActionScript 3.0 :: Converting GetChildByName() Acquired Object To Other Class?

Feb 17, 2009

I've been wondering if it is possible to convert an object acquiredby a getChildByName() function to another class?Let's say i have a library item designated as MovieClip and it is a part of some "sprite sheet". Now, when i need some sprites for my program i create a new sprite sheet instance and then i take sprites from it using the getChildByName():

Code:
sourceSheet = new UISpriteSheet();
someObject = sourceSheet.getChildByName("someObject");

[code]......

View 6 Replies

ActionScript 3.0 :: Setting Properties Of Objects Found Using GetChildByName

Mar 9, 2009

I am attempting to set the propreties of a navigation button (movie clip) that has been built dynamically. The button contains a text field that I want to format and a movie clip that I want to adjust the alpha. I find the object using getChildByName(), however do not seem to be able to set the properties using the code below.[code]

View 2 Replies

ActionScript 3.0 :: Accessing Property Of A Custom Component Through The GetChildByName Method

Jul 23, 2010

I have written a piece of code where I have created a custom class containing some of my custom properties.I have used multiple instances of this custom class in my main class and added it to a container.Now I need to access one of my custom property in the main class through container.getChildByName()."custom property", but I am not able to access my custom property using this.I get an error saying
Access of possibly undefined property orientation(this is my custom property) through a reference with static type ..name of my main class.

Is there no way that can i access custom property of components through the getchildbyname method of the parent container ??

View 0 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved