ActionScript 3.0 :: Child Access Parent Sprite's Variables?

Oct 25, 2009

From the two .as files below, I get the following error when I run: 1119: Access of possibly undefined property importantNumber through a reference with static type flash.display:Sprite.

[Code]...

View 2 Replies


Similar Posts:


ActionScript 2.0 :: Child SWF Access Parent SWF Variables?

Jun 21, 2008

The external swf is located at:[url]....In the parent.swf, I put System.security.allowDomain(url....)When you click a button on the child.swf it's suppose to trace data from the parent.swf, but it returns undefined.What am I doing wrong? I MUST access data from the parent.swf

View 4 Replies

ActionScript 3.0 :: Access Another Child From Within The Same Parent

Jul 22, 2009

I have a container with text and a button and an image.

When i Mouse over the button i want to be able to tell the text inside the container to change its TextFormat to another.

How do i tell the text to do so, i though it would be something within the MouseEvent like,

event.target.parent (someway to access other child).setTextFormat()

is their a simple way to access another child from within the same parent?

View 4 Replies

ActionScript 3.0 :: Child Accessing Parent Variables?

Sep 6, 2010

What's the strategy for getting a child to access variables in a parent.I have a Main class.In that class I create instances of a Unit class and save those to an array.In the Unit class, I want to access the x and y coordinates of other instances of the Unit class.So I'd like to access that array I made in the Main class.I tried:this.parent.theArray[i].xbut that doesn't work. I tried using the get command, but I don't really know how to, so my efforts failed.

View 3 Replies

AS3 :: Flash - Passing Variables From Parent To Child?

Oct 14, 2011

I'm trying to access some variables from my parent in my child MC.

Parent code:

var data_history:String;
function finish_checkUp(event:Event):void{
var checkUp_stat:String;

[Code]....

Now as you can see, i have tried the trace method, but with no luck. Flash doesn't report any errors regarding the trace method, but does report the two undefined vars (data_history). Ive tried to use the trace method above all the functions, at the top of the script, still the same errors though.

View 2 Replies

ActionScript 3.0 :: Accessing Variables Of Child Swf From Parent?

May 4, 2010

I have TestA.as the base class file for my TestA.fla that has nothing but a movie clip with instance name box.

TestA.as

ActionScript Code:
package
{
import flash.events.MouseEvent;
import flash.display.MovieClip;

[Code].....

View 0 Replies

ActionScript 3.0 :: Accessing Parent/child Variables?

Nov 22, 2010

I have a movieclip walls and a movieclip character (both on the same timeline). I want to access and change a variable inside character from the walls timeline.

ActionScript Code:
MovieClip(parent).character.somevariable = true;
...not working.

View 2 Replies

ActionScript 3.0 :: Accessing Variables Between A Parent And Child Swf

Feb 11, 2011

Wondering how to do this:

Parent swf has a class loaded, lets call it 'GlobalUtilities'. Parent swf loads in child swf. Child swf wants to use some of the 'GlobalUtilities' class that is in the parent.

How can I accomplish this? The problem I'm having right now is, when I export the child swf, I'll just error out since it can't find the reference (obviously, since it's not loaded into the parent yet).

View 3 Replies

ActionScript 3.0 :: Defining Variables From Parent In Child

Mar 8, 2012

im working with my main FLA and a script for it child.as i have created a variable in the parent, "svar:Number = 0;" i would like the child to be able to modify this variable when certain triggers are met i've tried something like this in the "child.as" but im assuming its probably much more complicated

[Code]...

im wondering if there is a simple command such as this to call upon an existing variable in the parent? if not, is there a way i can import the variables using the import command?

View 9 Replies

ActionScript 3.0 :: Passing Variables From Parent To Child SWF

Apr 17, 2009

I have a Parent.swf which loads a child.swf.this is a desktop application and the problem is

while loading the child.swf i have to pass a variable from parent.swf to child swf. how can i do it.can anyone give me an implemented code.

View 9 Replies

ActionScript 3.0 :: Access Child.swf Function From Parent.swf?

Dec 22, 2008

I have to access a function in child swf from parent swf. This child swf gets loaded into a canvas object in parent.swf. Everything works fine but I'm unable to call any function that was in child.swf. My code is

Code:
var swf1:SWFLoader = new SWFLoader();
swf1.source = "CHILD.swf";
can.addchild(swf1);

I read on google and then I tried this in parent.swf's code

Code:
var myrequest:URLRequest = new URLRequest("CHILD.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);
canvas.addchild(myloader);

Now this one throws up a runtime error TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@5934b01 to mx.core.IUIComponent.

I also tried this

Code:
var myrequest:URLRequest = new URLRequest("CHILD.swf");
var myloader:Loader = new Loader();
myloader.load(myrequest);

[Code]....

But in this case my swf does not show up at all and there are no runtime errors too!

How do I resolve this error and how do I then access the function in child.swf?

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 :: Accessing Variables Of Parent Class From Child?

Apr 11, 2010

i'm trying to assign a parent's variable from the parent's child

//Parent
public class Main extends Sprite
{
public var selectedSquare:Sprite;

[Code]....

i'm receiving this error, but i'm casting parent from displayObjectContainer to a Sprite so i have no idea why it's not working.

1119: Access of possibly undefined property selectedSquare through a reference with static type flash.display:Sprite.

View 2 Replies

Actionscript 3 :: Fetch Variables From Child Movieclip In Parent?

Sep 20, 2011

I have some variables defined in a child MC:

var first_nme = data.return_first;
var second_nme = data.return_second;
var email_addr = data.return_email;
var user_domain = data.return_domain;
var user_name = data.return_username;

I'm trying to use those variables in a parent movieclip/another movieclip.

[Code]...

View 9 Replies

Actionscript 3 :: Flash Referring To Parent Variables With Child?

Oct 31, 2011

I'm having some trouble getting to grips with how a child can refer to the variables of parents. Here is my Main.as :

package
{
import flash.display.MovieClip;
public class Main extends MovieClip

[code]....

Using trace(MovieClip(parent).i) instead I get:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Child()
at Main()

View 2 Replies

ActionScript 2.0 :: Passing Variables From Parent Flash Into Child?

Jul 26, 2010

how can I pass a variable from a parent flash file to a child flash file which it calls?We have a parent flash file which imports various child flash files based on instructions in an XML file. It's probably easier to see an example - opg2DOTcoDOTuk/flash/yay.html (replace the DOTs, couldn't post an url due to restrictions) - the text above each page, and the 'enlarge page' lightbox links are all in seperate flash files (one per double page) which are brought in, depending on the pages you are looking at, based on the instructions in an XML file which looks like this...

<page ani_swf="pages/text1.swf">pages/white.jpg</page>
<page ani_swf="pages/text1.swf">pages/0001.jpg</page>
<page ani_swf="pages/text2.swf">pages/0002.jpg</page>
<page ani_swf="pages/text2.swf">pages/0003.jpg</page>

etc, where the swf is the header flash file containing the text and one or two lightbox links, and the jpg files are the page images that appear.We had to repeat the imported child flash file because of a glitch when you go backwards through the book otherwise.

This system has been fine for us up until now but recently we've had to look at making it a dynamic system, so the content of the book can be varied depending on a variable being passed into the parent file via FlashVars...

<param name="FlashVars" value="zone=1" />
<embed src="newbook3.swf" FlashVars="zone=1" ....etc

This makes the book load an xml file called "1"). This is fine, except we also need to vary the 'enlarge page' target images to match.The 'enlarge page' links are currently hard coded into each child flash file, like this...

on (release){
getURL("javascript:SWFDelegate('imagename.jpg','Ex ample');");
}

- What we've tried so far:

1. Trying to pass the variables in querystrings from the XML
eg.

<page ani_swf="pages/text2.swf?var1=image1&var2=image2">pages/0002.jpg</page>
<page ani_swf="pages/text2.swf?var1=image1&var2=image2">pages/0003.jpg</page>

with the child flash setting it's action like this...

on (release){
var image1 = var1 + ".jpg"
getURL("javascript:SWFDelegate(image1,'Example');" );
}

I'm not sure if the syntax here is correct. We have to add the ".jpg" in here because, as far as I understand it, you can't pass "." in a querystring.

2. Passing the variables for the child into the parent

I read somewhere that variables passed to a parent are automatically available to a child. Not sure if this is true, but it didn't work for me when I tried it like...

<param name="FlashVars" value="zone=1?var1=image1&var2=image2" />
<embed src="newbook3.swf" FlashVars="zone=1?var1=image1&var2=image2" ....etc

Combined with...

on (release){
var image1 = var1 + ".jpg"
getURL("javascript:SWFDelegate(image1,'Example');" );
}

...in the child button action.

View 2 Replies

Actionscript 3.0 :: Referring To Variables In Parent MC In Multiple Child MC's?

Nov 7, 2010

I have several .as files. The first that loads is Main.as;

package
{
import flash.display.MovieClip;
public class Main extends MovieClip
{

[code]....

So this MC gives the user the ability to type in their name and store it into the parents playerName variable. With the intention that I can refer to it at any point later in any other MC. It stores it okay, a trace proves that, but a problem comes when this movieclip is replaced by the new one ZoneSelector;

package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

[code]....

As you can see, there's hardly anything in the this .as file. But everytime the trace(MovieClip(parent).playerName) tries to run I get the following error;

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at ZoneSelector()
at Setup/onbeginGameButtonClick()

It's as if the ZoneSelector runs its entire script before the playerName is set..or something like that.

View 7 Replies

ActionScript 3.0 :: Pass Variables From External Swf (as Child) To Parent?

May 4, 2009

I am new to flash."I am unable to access the variables of child swf in parent swf after an action(button is clicked) is performed in child swf".

My problem is i had 2 swfs parent.swf and child .swf and i loaded the child.swf file in parent.swf using Loader class there is a textbox and a button in child.swf when we enter text in the textbox(say,notepanel_txt) and click on the button(say, mySubmit) the text present in textbox(notepanel_txt.text) is saved in the database using URLLoader and an variable called success(which is String type) must be available to parent. the code is as follows[code]...

View 8 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 :: Access Parent Child Nodes And Attributes In XML?

Jul 7, 2011

Access parent child nodes and attributes in XML?[code]...

View 1 Replies

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

ActionScript 3.0 :: Access Vars In Parent.swf From Child.swf Class?

Aug 10, 2010

I cant access to var in parent movie from class in child.I have two swf's: parent.swf and child.swf. In parent.swf in frame 6 is:

Code:
stop();
var TestVar:String = "hello!";[code]....

I was trying use parent, parent.parent, parent.parent.parent etc. and any result - null object error.

View 2 Replies

Professional :: Access Methods From/to Parent And Loaded Child Swfs?

Sep 14, 2010

Imagine the following setup. The main swf loads a child swf.In AS2 i would simply use _parent or _root to call the desired function. How can that be done in AS3?Can this still be done? Can I call a function on the main swf from the loaded one? How about the other way around, this time, from main to loaded swf?

View 1 Replies

ActionScript 2.0 :: 'reverse' Inheritance - Parent Access The Properties Of A Child Class?

Feb 10, 2005

i've got an inheritance chain of AS2 classes set up where i have an array in the 'child' class that i'd like to be able to access from the 'parent' class:

bottomClass.as -'parent'
topClass.as -'child'

my question/dilemma is: how can the parent access the properties of a child class...is this even possible, or am i just looking at it wrong?

View 2 Replies

ActionScript 2.0 :: 'reverse' Inheritance - Parent Access The Properties Of A Child Class?

Feb 10, 2005

i've got an inheritance chain of AS2 classes set up where i have an array in the 'child' class that i'd like to be able to access from the 'parent' class:

bottomClass.as -'parent'
topClass.as -'child'

my question/dilemma is: how can the parent access the properties of a child class...is this even possible,

View 2 Replies

ActionScript 3.0 :: Can't Access Parent Class Variables

Feb 11, 2010

Look at this example [code]...

How come the trace in the SlotsSetup function is printing out NaN ?

View 1 Replies

ActionScript 3.0 :: Access Child Text Field Through Parent Movie Clip's Class?

May 16, 2010

I have one movieclip object with a custom class.

That class has a loop that creates / instantiates a number of copies of another movieclip from the library. This second movieclip has a textfield child in it. When I convert this textfield to a movieclip I can access the properties of it fine, but just as a dynamic textbox I can't access it.

This is the custom class of the second movieclip that gets instatiated a few times by the first custom class...

This custom class relates to a movieclip that has a child MC called recent_text (which I can access ok) and in that child is another child (a dynamic text field called "aDynamicTextBox", which I can't access)[code]...

View 1 Replies

Cannot Access Child Variables?

Jul 23, 2009

The error is as follows:1119: Access of possibly undefined property shiftX through a reference with static type flash.displayisplayObject.shiftX is declared in the first line of the movie clipFirst i check to see if the child doesnt exist and if it does I access it like so:getChildByName("ball"+ccc2).shiftX)

View 4 Replies







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