ActionScript 3.0 :: Get Parent In A Class

Jan 29, 2009

Ok I have a class. I instantiate it like so:

ActionScript Code:
import com.ronnieswietek.news.NewsV1;
var news:NewsV1 = new NewsV1("news.xml");
addChild(news);

Their is a movie clip on the stage called scrollbox that I need access to in the NewsV1 class. How can I access that movieclip in my class? The only way I've been able to do it is if I replace:

[Code]....

View 0 Replies


Similar Posts:


Actionscript :: Class Loaded Into Parent Class / Get Parent Variables

Apr 20, 2009

I have a child class that is loaded into the parent class when the swf begins, like so: var myvar = 'hello'; public function Parent() { this.child = new Child(); }; How can I retrieve the variable 'myvar' from within child?

View 1 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 :: Calling Method In Parent Class From Imported Class?

Jul 15, 2011

I have the following parent class that I'm working with:

Code:
package {
import com.poptent.SubClassOne;
import com.poptent.SubClassTwo;

[Code].....

I am trying to set it up so that a parent method called by subClassOneInstance can affect subClassTwoInstance.

View 4 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 :: 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 3.0 :: Checking The Parent's Class?

Oct 27, 2010

How can I check what a parent MovieClip's class is?I have a Terrain class that I only want to use a function when the parent movieclip is a specific class, so that the terrain object can be used by multiple classes, but only launch that specific function when the parent's class is "WorldBase". How can i detect this through the Terrain class?

View 1 Replies

ActionScript 3.0 :: Referencing Parent When It Could Be Of Any Class

Nov 17, 2010

I usually would call the parent of my class by something like:
MyCustomClass1(parent).thisFunction();
My problem is this works if I know the class of my parent. How do you handle the case where you class could have a parent of 2 or more possibilities?
parent.thisFunction(); // throws error of course

View 3 Replies

ActionScript 3.0 :: Get Parent / Class Of Event?

Mar 22, 2012

I have a class called "download" and an URLStream object inside it called "urlStream".

From outside the class, I am adding a progress listener like this[code]...

Everything works fine inside the onFileProgress function and bytesLoaded, bytesTotal are read correctly.

What I need is a way to point to the download class from inside the onFileProgress function so that I can retrieve some other public variables defined in the "download" class.[code]...

View 1 Replies

ActionScript 3.0 :: Referencing Parent Class?

Mar 16, 2009

A have two classes: Main and Navigation. I try to referenceobject in Main class from Navigation class based on the buttonnumber I clicked. Doesn't work as I want it to work. What can I do

View 1 Replies

ActionScript 3.0 :: Call A Parent Class?

Sep 6, 2009

So I have[code]...

also... my other classes that are run through initCore aren't doing anything but tracing, so I know there loaded but none of the objects that are supposed to be created are being created.

View 1 Replies

ActionScript 3.0 :: Target Parent Of A Class?

Oct 2, 2009

I am trying got get the parent of a class so I can set a variable. first I problem I have is I cant even trace parent. I have a simple class nothing in it except a trace(parent) I instantiate it on the main timeline of a fla and it returns null. I have tried to trace root and it returns null as well. the class extends movie clip or sprite

View 7 Replies

ActionScript 2.0 :: How To Reference To Parent Class

Mar 21, 2008

I have a site class with different properties. The site class creates a Background class. I want the background class to use the Site class' stylesheet object. How can this be done?At first I thought about passing the site object to the Background class' constructor, but maybe there is a way to reference to the calling class?

View 8 Replies

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

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 :: Event Triggering From A Class To Parent?

Dec 21, 2011

I am trying to write a custom class for image loading.
 
public function imageLoader(url:String, mc:MovieClip):void {
loader = new Loader();
loader.load(new URLRequest(url));

[Code]....

I ll get the events in these listeners in the loadImage class. But i want to trigger a function in the calling class or root or stage, when these loader events are fired.

View 2 Replies

AS 3.0 :: Flash - Reference Parent Class Function?

Mar 23, 2010

I am trying to run a function of the main class, but even with casting it does not work. I get this error

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at rpflash.communication::RPXMLReader/updateplaylist()
at rpflash.communication::RPXMLReader/dataHandler()

[Code].....

View 2 Replies

Flash :: EventListener Function In Parent Class?

Jan 7, 2011

I have class ShowCase that inherite from my class ContentMC (that inherite from MovieClip). In the class ShowCase I have an EventListner that calls a function in the parent class ContentMC. But I get an error that says "Access of undefined property restoreMenuItem".

This is my eventlistner in ShowCase.as.

showcaseItem.addEventListener("CONTENTMCCLOSED", restoreMenuItem);

Here I get the error, it doesn't find the function restoreMenuItem.

The function restoreMenuItem is in ContenMC and looks like this.

public function restoreMenuItem(evt:Event):void
{
}

How do I call this function that's in the parent?

View 1 Replies

Java :: Getters And Setters In Parent Class?

May 17, 2011

if getters and setters are the best option in a specific case. The case is when I have class 'A' instantiating classes 'B' and 'C'. Class A contains public getters and setters for classes B and C to access so data is centralised.Is this best practice or would it be best to pass the data to classes B and C through parameters?

View 3 Replies

ActionScript 3 :: Mport A Class From A Parent Directory?

Sep 13, 2011

I have seen similar questions, but not this specific problem. I have a folder structure like this:

[Code]...

View 3 Replies

Actionscript 3 :: Reference To Parent MXML Within Class?

Feb 27, 2012

I have an AS3 class on my Flex project[code]...

View 2 Replies

Actionscript 3 :: Access A Parent Class In An OOP Correct Way

Mar 11, 2012

I just started programming OOP and I'm running into a scope problem. In the following project, I have a masterClass called App. The App-class has Screens:Screen-class and a Navigation-class as it's children. From the navigation class I want to control which screens will be displayed. I don't know how to do this.

[Code]...

View 2 Replies

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

Jan 23, 2009

how I reference vars/instances from a parent class by using a static function and I wonder if there is a better way to do it.

I have a main document class Main.as with a public static function called mainFunction().

ActionScript Code:
public static function mainFunction( _mc:MovieClip, _nVar:Number ):void
{
// do something

[Code]......

This can be tricky if the static function has many variables from its own class.

View 4 Replies

ActionScript 2.0 :: Access Nested MC From Parent Class

Jan 15, 2010

Ok im rather new to flash so ill do best i can to describe this. I have a HealthBar movie clip with 3 layers, bottom layer is just a red rectangle, middle layer is a green rectangle that is a movie clip, and the top layer is just a border. the green rectangle movie clip has an instance name of bar. i put my HealthBar on my stage with an instance name of healthBar and i change it when the players health goes down by calling _root.healthBar.bar._xscale = health where health is 0-100.

this works all fine and dandy. now i have a movie clip of MiniBoss with an instance name of miniBoss# where # is a number of the layer depth when it is created. in the MiniBoss movie clip i have an instance of the HealthBar with an instance name of bossHealthBar. i tried to call from within the MiniBoss class bossHealthBar.bar._xscale = health but i get an error that there is no property of bossHealthBar.bar._xscale. how do i access the bar in the HealthBar in the MiniBoss clip from the MiniBoss class in its onEnterFrame() method?

View 2 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 :: 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 Parent String From Sub Class?

Jul 11, 2010

I have a Main class that has a public var "foo" which is a string. my subClass is a movi clip that has a text field called txt. I want to access the document variable from the sub class but get error 1119: Access of possibly undefined property foo through a reference with static type flash.displayisplayObjectContainer.[code]...

View 5 Replies

ActionScript 3.0 :: Modifying Parent Class Variable

Dec 7, 2010

I have an app which basically has a page with 2 entry points - each of these entry points needs to pass information into the same variable (colourName). The only way I can envision doing this is to put the variable in the parent class - which for some reason is modifyable and will trace details, but once I've removed the child, and added the new child, the variable returns a null object error!

View 0 Replies

ActionScript 3.0 :: Remove Methods Of The Parent Class

Jul 27, 2011

When I create classes, often I want to remove methods of the parent class (such as addChild(), perhaps), and I just override the method and have it throw an error. Is there a way to remove it completely?

View 9 Replies

Actionscript 3.0 :: Parent Class Function Scope?

Feb 21, 2009

I have 2 class. Main class and a subclass (being an image loader).When the subclass has finished loading I want it to access a timer function in the mainclass.Code: Select all1)mainclass |> subClass.loadMe();2)   When subclass load finished.3)Subclass |> mainclass.startTimer();This i dont know how to do.

View 2 Replies







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