Flex :: Actionscript 3 - Detect The Child Element Of A Variable Parent In E4X?

Jul 20, 2009

I have XML that looks like this:

<question>
<type_elt>
<opt_out_flag />
</type_elt>
</question>

type_elt is not an element name; it might be <single>, <multiple> or something else, determined at runtime. How, given this, can I detect the presence of the opt_out_flag element?

I tried this (where xml refers to the question element):

if (xml.*.opt_out_flag) {
do_something();
}

but even in cases without opt_out_flag the above expression returns true. Obviously I'm missing something, but what is it?

View 5 Replies


Similar Posts:


Flex :: How To Access Variable In Parent Component From Child

Sep 18, 2010

I have a public variable set within fx:Script tags in a parent component that I'd like to access directly from a child component. How can I do this? I don't want to pass the variable to the child component (I know how to do this and am currently using this approach). Following is a simplified version of the mxml:

Note: SimpleComp is an HBox with a couple of lists.
<mx:Accordion>
<comp:SimpleComp/>
</mx:Accordion>

View 4 Replies

Unable To Send Variable From Flash(parent) To Loaded Flex Swf(child)?

Mar 27, 2012

i am trying to load the variables from parent(flash) to child(flash).Its working fine,.

parent swf:(flash)
var parentMessage:String = "Hello";
var swf:MovieClip;
var l:Loader = new Loader();

[Code].....

View 4 Replies

Actionscript 3 :: Propagate Custom Event To Parent Swf From Element Inside Child Swf

Jul 19, 2011

I have two swf file, A.swf and B.swf, each with its Document Class: B.swf is loaded in a MovieClip of A.swf. When loaded, B.swf creates an instance of CSDragger (it is a library object with its class extending MovieClip) and sets an ID property of this instance to a certain value. When this dragger is dropped by the user upon a MovieClip it sends a custom event containing the value of ID too. The custom event regularly reaches B.swf but never reaches A.swf. Aside from refactoring the CSDragger class (eg moving its handleDrop method in the B.swf document class), is there any way for the event to reach A.swf? I know I can intercept it and dispatch another event, but I was looking for a different solution (if any).[code]

View 1 Replies

Actionscript 3 :: Assign A Parent's Variable From The Parent's Child?

Nov 7, 2011

i want to pass the variable from parent to child .How Can i pass the Variable.Here i paste my code.

My Parent Class

public class PlayerStrobe_domaincheck extends Sprite
{
private var myService:NetConnection = new NetConnection();
private var _loader:Loader;

[Code]....

View 3 Replies

ActionScript 2.0 :: Parent Not Able To Detect Child Functions

Apr 10, 2008

I've encountered what seems to be a race condition between a parent and its child movie clips, but I don't know what to do to fix it. The parent movie clip is on the stage at compile-time, and the clip contains a number of children. In the parent's constructor function I have the following code

for(var i in this){
if(this[i] instanceof MovieClip){
this[i].hval = this[i]._x;
$tItems.push(this[i]);
this[i].subscribe(this);}}

I'm able to give every child an hval property and push it into $tItems, but the call to the child's subscribe method fails every time. It's as though the child's functions haven't been loaded because the children haven't yet realized that they're members of a class that have a subscribe function. I set up a button to test this function call manually and when I do it that way I succeed in calling the subscribe method in all the children, so it really seems to be some sort of race condition. How can I overcome this?

View 1 Replies

ActionScript 3.0 :: Child SWF Detect Existence Of Parent

Sep 22, 2010

I have a parent.swf file that loads a child.swf. When the child.swf is running on it's own, I'd like it to do one thing, but if it has been loaded into the parent.swf. I want it do something else (i.e. change behavior). Is there a way for the child.swf to detect whether it has been loaded into a parent.swf or not?

View 4 Replies

ActionScript 3.0 :: Parent.removeChild(child) Doesn't Update Parent Width / Height When Child Was Rotated

Jul 29, 2011

I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.[code]Sprite2 is a rectangle. When I rotate it, of course, the height of its parent, SpriteP, GROWS. But I would expect that height to go back to what it should be when I'm removing Sprite2!And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200.

View 10 Replies

ActionScript 3.0 :: Child-parent Relationship \ Adding Them All As Children Of The Stage And Creating A Parent-child Hierarchy Between Them?

Jun 6, 2011

i am slightly confused about the parent and child relationship. lets assume we have several different instances, what would be difference of adding them all as children of the stage and creating a parent-child hierarchy between them(other than the access path).

View 5 Replies

ActionScript 3.0 :: Parent.removeChild(child) Doesn't Update Parent Width/height When Child Was Rotated

Jul 29, 2011

I got a Parent Sprite, let's name it SpriteP, which holds inside it two other Sprites. Sprite1 and Sprite2.

When Sprite2 is NOT rotated:

Code:
trace(SpriteP.width + ' ' + SpriteP.height); //100 250.
SpriteP.removeChild(Sprite2)
trace(SpriteP.width + ' ' + SpriteP.height); //100 200. -> works, 200 is good.
When Sprite2 is rotated at 90:

[Code].....

And it does! If I remove Sprite2 while NOT being rotated, the height of the parent drops back to normal, 200. But if I rotate Sprite2, the Parent won't update its bounds.

View 1 Replies

ActionScript 3.0 :: Accessing A Parent's Variable From The Child?

Aug 27, 2009

This is probably a fairly easy answer, but I can't figure it out. I have a dynamically added child, and I have a dynamic text box on the parent. I'm thinking that it should be possible for me to add to the text box from the child timeline, but I don't know how to target the text box.

View 1 Replies

ActionScript 1/2 :: How To Pass Variable From Child To Parent SWF

Jul 10, 2009

Is it possible to pass a variable from child to parent movieclips. I can pass it from parent to child but not the other way around. I have a main movie which loads a child movie:
loadMovieNum("slides.swf",1);
I want to pass variable from slides.swf to the main movie. Is this possible?

View 2 Replies

Actionscript 3 :: Accessing Variable In Parent From Child

Oct 30, 2011

Im trying to access some variables from the parent in a child mc.[code]nothing shows up in any of the dynamic text fields...

View 1 Replies

ActionScript 3.0 :: Passing Txt Variable Through Parent To Child?

Apr 7, 2011

I have a simple BOOK script where I have 10 pages (for example purposes). Each page has a vocabulary word on it. Currently, I simply created a vocabulary MC separately for each page and it works fine. Problem is, that leaves me with 10 Vocabulary pages and I would rather have 1 that loads info based on a var on the main page.

WORKING SCRIPT
var loaderZ:URLLoader = new URLLoader();
loaderZ.dataFormat = URLLoaderDataFormat.VARIABLES;
loaderZ.addEventListener(Event.COMPLETE, loading);

[Code].....

I am getting the word "depressed" from page 1 (verified by trace) Unfortuntely this does not work.

If I change the last line of code to:

VocText.htmlText = loaderZ.data = word;

Then it outputs the word DEPRESSED to the text field VocText but does not return the value from the txt file.

View 2 Replies

ActionScript 3.0 :: Pass A Variable From Parent To Child?

Nov 10, 2011

Have two swf, A.swf and B.swf: B.swf is a child of A.swf.i want to access the variable of a.swf in b.swf.Is it Possible?

View 9 Replies

ActionScript 3.0 :: Parent Variable Access From Child?

Jan 12, 2010

I am getting the following error:1119:Access of possibly undefined property through a reference with static type TenI am explicitly casting, and tried this.parent and still get the same error. What am I doing wrong.

Here is the code:
package
{ import flash.display.*;

[code]....

View 7 Replies

ActionScript 3.0 :: How A SWF Child Can Control A Parent's Function/variable

Jan 12, 2009

For instance, in the below code a parent can control a SWF child's function "alert ()". But how a SWF child can control parent's function "ReceivingChildMsg()" ?

View 4 Replies

Actionscript 3 :: Flash - Change A Variable In The Parent From The Child?

Mar 6, 2010

I want to change a variable set to 0 in the parent to 1 when a button in the child is clicked.

This is the parent zero.swf:

var noPass:Number=0;
function getPass(event:onLoad, noPass):void {
if(noPass==0) {

[Code]....

View 1 Replies

ActionScript 3.0 :: Pass Variable From Parent To Child Swf Via FlashVars?

Jun 19, 2009

I'm passing a number in my HTML through FlashVars to a swf, I load an external swf into that parent swf which needs the variable that I passed.

I can use the variable passed in the parent, but I just can't understand how to attain that value in the child swf.

I've been looking into dispatch event but it seems way overkill. Haven't seen any examples dealing with something so simple.

View 4 Replies

ActionScript 3.0 :: Create And Define A Variable In A Child From The Parent?

Oct 14, 2010

is there anyway to create and define a variable in a child from the parent? For example, if I add a child to the stage with code, and then want to be able to say

child.variable=0

to create a variable in the child and be able to edit and read the variable. I know the above code is way off but it's just to kinda get the point through.I have to define the variable this way.

View 2 Replies

Flex :: Calculate The Height Of Parent Element?

Jun 3, 2010

I have three datagrids inside VBox container. Since I don't want scrollbar in my flex widget i am increasing the height of SWF through javascript, which increases with each addition of row in my datagrid. My query is how can I get the exact height of my VBox which is the parent element of datagrid. I am not able to get the height of VBox. I have tried to use measuredHeight,height with no success.

View 1 Replies

Php :: Taking Variable From Parent To Child And Inserting It Into Dynamic Text Field?

Aug 4, 2011

I'm trying to take a variable from the parent movieclip and use it in the child movieclip inside of a dynamic text field.

The variable has a value that is taken from a php file.

I'm completely lost at the moment and know that my code is probably completely wrong.

here it is:

parent movieclip:
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE,onLoaded);
loader.load(new URLRequest("../SC/FLA_cont-btn.php"));

[Code]....

View 1 Replies

Flex :: Check If Clicked Element Is Inside Of IVisualElement (parent)?

May 27, 2010

I'm trying to check if a clicked element is inside of an IVisualElement in Flex 4. So I want something like "if this element is in this element, then execute function". I'm aware of the 'parent' property but this doesn't seem to work when my element is not a direct child of the element but for example 3 levels deep.

View 1 Replies

Actionscript 3 :: Flex Element Wrongly Keeps Properties From Previous Parent - Reset It?

Oct 14, 2011

I want to put an element into another component (in this case a print template), print it, and then return it to its place. The problem is that when I return it, it has the properties of the print template! Here is a simplified example. When you click print, the label is removed and then returned but when returned it is affected by the padding of the print template! Why? How can I somehow refresh it to its proper properties? I tried all the invalidate... methods and parentChanged() but nothing worked.

[Code]...

View 2 Replies

Flex :: Move Dynamic Child Or Element?

Dec 25, 2011

It's possible to move a dynamic ctreated element or child? Example:

Create childs:

public function createChilds():void {
for(var i:int=0; i < 10; i++) {
newImage = new Image();[code]...........

View 1 Replies

ActionScript 3.0 :: Positioning Parent MC In Order To Center Child MC On Parent's Parent MC

Feb 5, 2010

[code]All clips are squared.Ok, on the PlayerPlane, there are little soldiers, which have hotkeys. The effect I'm trying to create is I want to position the GameStage so that the currently selected soldier appears in the center of the GameClicker clip.The GameStage is movable by the player (to scan other areas of the map)by holding the CTRL key, so it's easy to kinda lose track of where your players are.I have tried using localTo Global and globalToLocal techniques, but I think I'm lost on the actual math of getting the GameStage to move the correct distance so that the selected soldier is centered to the GameClicker.[code]

View 2 Replies

Flex :: Get The Value From An Mxml To Another (child To Parent)?

Aug 15, 2011

how do I get a value from another mxml.I have a vaule in the child mxml that i would like to parse to the parent mxml.Then use the vaule to create a search method.

View 1 Replies

ActionScript 3.0 :: Remove Parent.parent.parent Child?

Jan 3, 2010

I got a "preloader" that creates an movieclip and loads an SWF. Now in the loaded SWF i want a close button to go back to the "preloader". The preloader isn't an actuall preloader but some sort of mainclip.Now i tried this:removeChild(MovieClip(e.currentTarget).parent.pare nt.parent)But i get error:ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.at flash.display::DisplayObjectContainer/removeChild()at MethodInfo-6()

View 1 Replies

Flex :: Force A Resize From A Child To A Parent?

Jul 22, 2009

I have a page-like flex application. In my main application is a holder (a canvas) that displays all the pages. The problem is that the components that are loaded inside the holder are bigger than the holder is when the main application starts. The holder height is set to 100% but still he gets scrollbars when I load a bigger component inside of him then himselHow can I solve this problem? And if it isn't solvable would it work correct if I use a viewstack?the holder looks like this:

<mx:canvas height="100%">
</canvas>

But the end of the application is 500 pixels lower so canvas height is 500 pixels high. Now I put a new child inside the holder that is 1000 pixels high.

View 2 Replies

Flex :: Move The Child Only Inside The Parent?

Feb 4, 2010

Recently I worked in a project using Flex. Its a Photo editing project. I have took a Canvas and take a image in that canvas using the code canvas.addChild(image) . Now i can move the image freely by using moving code. The image move inside the canvas and outside the canvas. I want to move the image/child only inside the canvas not outside. How can i do this?

View 1 Replies







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