ActionScript 2.0 :: AS2: Accessing Parent MC Class From Child MC?

Jan 27, 2010

I've been using greensock classes in a parent movie, but am now looking to use the same classes from within some child movies, but it doesn't work (I presently have to import them into each child movie - what a waste).

Do I need to create the classes as a shared library object perhaps? If so, how would I go about it? as I've only ever done this for MCs or MP3s.

View 2 Replies


Similar Posts:


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.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 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

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 :: 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 :: Child Swf Accessing Parent Swf Movieclip/s?

Oct 21, 2011

how to access a movie clip/s in a parent swf from a child swf. for example:Interface swf has buttons as mc's (home, about, services, portfolio e.t.c.) and loads in a swf when one of the buttons in the interface swf is pressed. When a button in Interface swf is pressed none of the other buttons can be pressed until the swf of the button that was pressed has loaded.

The reason for this is so that if the user tries to press the buttons quickly lets say the user pressed services button but changed thier mind right after pressing it and wanted to press lets say portfolio button they couldnt press the button until the services swf has loaded. Ive seen websites that dont do this and is makes it all mess up. Ive been able to do this in the past in AS2 but i cant figure it out in AS3.This is the code i would use in AS2:

Interface swf code is:
ActionScript Code:
_level5.btn_1.enabled = false;[code]...........

View 4 Replies

ActionScript 3.0 :: 1009 Error - Accessing Parent Function From Child

Oct 5, 2010

Its a bit strange really, I have a Main class that has 2 children, Child1 has a variable goldCount that needs to be parsed to Child2 via the Main class (directly doesn't work either so far) Child1 has this function:

Code:
public function Getgoldcount():Number {
return goldCount;
}

[Code]....

View 2 Replies

Actionscript 3 :: Dispatching Events From Parent Class To Child Class

Apr 30, 2010

I think this is a pretty simply problem but I do not seem to be able to pull it off. Basically I have a parent class A, and a child class B.Class A instantiates class B with addChild.There is a shared object which is being updated from a java server (red5) that has an event listener attached to it in class A.I have a function in class A which will pass certain, specific updates from this shared object to class B.The problem occurs is that when class B is instantiated, the event listener from class A doesn't work anymore. I have not removed the event listener from A.?

View 1 Replies

ActionScript 3.0 :: Call Parent Class Function From Child Class?

Nov 25, 2010

Lets say I have a Main Document Class called Main. I also have a child class called childClass that call a function from the Main class and is also imported in the Main class. How should I call the function? I tried this , but when calling the function, it's getting me error.

Main class :

Code:
package {
import flash.display.Sprite;
import com.childClass;

[Code].....

View 6 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 Parent Function From Class?

Nov 17, 2011

I have a .fla file with some code in the actions panel.A bit of code calls a function in a class from the actions panel .The function in the class is run, but I want to be able to call a function in the main actions panel code from the function in that class .The class doesn't extend anything so (parent as MovieClip).function() does not work.

View 7 Replies

ActionScript 3.0 :: Can't Case Child Class As Parent

Jan 28, 2010

I have a SWF with a document class called ClassA. I'm loading in an external SWF with a document class of ClassB. Then ClassB is loading in an external SWF that is used for graphical assets.

The problem is that all of the assets in the third SWF all extend a class called Actor. The assets swf is loaded and set as the var "_assets".[code]...

View 2 Replies

ActionScript 3.0 :: Child Swf Use The Same Class Definitions As The Parent Even Though It Should Be In An Entirely Different Namespace?

Jun 2, 2009

I wrote two projects using the same 3D library but I modified it pretty heavily in one (to the extent that the inheritance is pretty different on one) - now I need to load one into the other and I'm getting some weird errors that look like the child swf is trying to use the same class definitions as the parent even though it should be in an entirely different namespace.

So - anyone have a tricky way of forcing the loaded swf to use the classes it's compiled with rather than the ones already defined in the parent swf (and vice versa) or do I need to refactor all my stuff?

View 2 Replies

ActionScript 3.0 :: Child Class Object Instance - What Can It Tell About It's Parent

Sep 15, 2010

If an object, or say... a document class, creates an instance of a class (and stores it as a variable), and it doesn't pass any arguments to the constructor of the class, can that class object, by simply having a function of it called by the parent, tell who sent it that command/request?In other words, can a class object know who called it (such as it's parent) via a (seemingly) anonymous call?

View 1 Replies

ActionScript 3.0 :: Where Is Document Class In Parent/child Hierarchy

Jan 19, 2011

I have a class linked with a movie clip, and in this movie clip I want to be able to add an event listener that calls a function in the Document class (the class you link with the fla as a whole). How can I do that? Say the name of my document class is KPScript.as. In my GameController.as class, I want to listen for key input and call pageChange() in KPScript.as when it gets called. Would I have to import KPScript.as into the GameController.as? If so, I wouldn't want to create another instance of the KPScript object.

View 1 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

ActionScript 3.0 :: Accessing Parent MovieClip From Child MovieClip?

May 17, 2011

I'm trying to access a parent movieClip from the child movieClip

Here's what I want to do,

I've got a movieClip named wrong_mc, which plays for a couple of frames and on the last frame, its got a close button "close_btn" inside of it, now I wanna write the code such that when close_btn is played the movieClip "wrong_mc" should go and stop at frame1, I'm just not able to access this movieClip from the button.

View 5 Replies

ActionScript 3.0 :: Root And Document Class For Child SWF Loaded By Parent SWF?

Feb 12, 2011

I'm using a PreLoader as a parent SWF that loads the actual website as a child SWF. In the website SWF, the child SWF, will MovieClip(root) still work and refer to it's own root, or the PreLoader's root? And would I still access the websitite's document class (the child's document class), through MovieClip(root)? What if both files have a document class?So my main question is how do document classes and MovieClip(root) behave in the scenario when you have:

Parent SWF - document class, MovieClip(root)
|
Child SWF (loaded by parent) - document class, MovieClip(root)

View 2 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

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 :: 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

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

ActionScript 3.0 :: Add A Clip To The Stage As A Child And Remove The Parent And Set The Parent Equal To Null?

Sep 11, 2010

if I add a clip to the stage as a child and remove the parent and set the parent equal to null, does the child get collected and removed from memory? What if the child has an image loaded into it as its child? 

In my application I'm loading a series of png images as overlays that can be tinted for customizing in this app. When I trace my memory, the basic app idles at 64,000 k. The exact second I load those overlay images it goes up to 205,000k. If I remove those clips and "clear" the stage I should go back down to 64,000 k if everything is removed and collected correctly, right? It's not, it's hanging at 215,000 k. Are my images being cached and that is the reason for the memory staying up? If so, how do I prevent that. Or upon removing the parent of the image how can I un-cache the image.

If a user switches between models and loads several different items then the application actually crashes the Flash environment because of too much memory usage. It also does the same to browsers.

View 29 Replies

ActionScript 3.0 :: Tab Indexing Loop Through Parent, External Child Swf, Back To Parent?

Nov 11, 2009

I have a parent swf which loads many child swfs (though only one is displayed at a time). My intention was to use the loaded SWFs document class to retrieve an array of objects to be assigned a tab index, combine this with the parent's own array of objects and apply sequential tab indices to them all. But what happens is actually that the parent's objects are assigned an index, but the external swf is unaffected. In fact, the external swf retains its automatic tab indexing, when I would expect that having set a value for InteractiveObject.tabIndex, automatic tab indexing would be disabled.

I've seen similar tales elsewhere. Most posts I've read are wanting to load an external swf, give it focus and loop through those objects, then close the swf and return to looping through the parent. However I would like loop through all objects as one. including manipulating the focus manager(s), and basically fiddling with every tab-related property I know.

View 2 Replies







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