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


Similar Posts:


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 :: Call Function Of Parent Class?

Aug 27, 2009

How can I make a call to a function in the parent class of the class I'm in.

example:

main class

Code:

package {
import flash.display.Sprite;
public class mainClass extends Sprite
{

[Code].....

I realise that there is some stuff that is missing in the "full" code here, but that's just because I'm to lazy to write it all...

How do I get the "someButton" in the "child_class" to call the "theImportantFunction" in the main class? I know that it is possible to make a "dispatchEvent" in the "mouseClick" function, and then add a eventlistener in the main class.. But is there another way to just call the function directly?

View 4 Replies

ActionScript 3.0 :: Call Function In Parent

Jan 29, 2010

i have a swf that loads a swf that loads one swf into that one. i need the final swf (child, child) to be able to call a function on the first swf (parent)

i have tried this:

if(MovieClip(parent.parent.parent)!=null){MovieCli p(parent.parent.parent).parentFunctionCall();}

[Code].....

View 0 Replies

AS 3 :: Child Call A Function In Its Parent?

Mar 7, 2009

I have a function (let's call it testFunction for right now ) on the actions layer in the main timeline There is a movie clip with 15 frames long in the library

i want to add a child of the movie clip on the stage, and call testFunction when it finishes playing

how can i do? i tried to call it in the child but nothing works

Or, is there any way to show child on the stage for only a period of time like 1 second and then remove it automaticly?

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

Flex :: Call Parent Function From ItemRenderer

Feb 6, 2010

I want to call the parent function called "edit_groups()" from the itemRenderer. The code for my itemRenderer is:

<mx:VBox id="vbx_container" paddingBottom="4" paddingLeft="4" paddingRight="4" paddingTop="4" borderStyle="solid"
dropShadowEnabled="true" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:Canvas width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off" >
<mx:Image id="image" width="100" height="100" source="{data.thumb}" scaleContent="true" maintainAspectRatio="true"
complete="{image_smoothing_handler(event);}" trustContent="true" doubleClick="{Call The Parent Function"edit_groups()"}"/>
</mx:Canvas></mx:VBox>

And I call my itemRenderer from an application like:
list_groups_modify.itemRenderer=new ClassFactory(groups.list_groups_modify_item_renderer);
<mx:Label text="{data.label}" textAlign="center" maxWidth="60" toolTip="{data.label}"/>

View 3 Replies

Flex :: Call Child Function From Within Parent?

Jun 1, 2011

Is it possible to call a child function from within the parent? I know to go child > parent, you can do parentApplication.functionName(parameters);, but what about going the other way... that is parent > child?

View 2 Replies

Actionscript 3.0 :: Call A Parent's Function From Child Swf?

Jan 2, 2009

this is the code i found out on the web to call a function in the parent swf from the loaded child swf.

in the child swf:
Code: Select allpanel.next_mc.addEventListener(MouseEvent.CLICK, onClick);

function onClick(e:MouseEvent):void{
MovieClip(this.parent.parent).parentFunction();
}

[Code].....

View 6 Replies

ActionScript 3.0 :: How To Call Function Of Parent Object From Loaded SWF

Nov 10, 2009

I have a swf that should be able to load another swf in runtime. Then I would like the loaded swf to call a method of the parent, loader swf, like this:

Code:
parent.closeForm;
But when I compile it, it throws this error:
1119: Access of possibly undefined property closeForm through a reference with static type flash.displayisplayObjectContainer.

I've tried:
Code:
if (parent != stage){
parent.closeForm;
}

So flash won't run this code at compile time, but it always throws that error. Here is the code of the LOADER swf:

Code:
private function loadForm():void {
var loader:Loader = new Loader()
var mRequest:URLRequest = new URLRequest(formPath);
loader.load(mRequest);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onFormCompleteHandler);
[Code] .....

How could I write an expression that should call a function of the LOADER swf without having this compile-time error?

View 14 Replies

ActionScript 3.0 :: Child Call To Parent Function Not Working

Jan 12, 2010

I have a main MovieClip that creates a new instance of an imported class which is a page in the application. This class tries to call a function on the main MovieClip and it's not finding it. I've done this in the past without any problems with separate swf files and loaders, and with movieclips in a library. I'm at a loss on how to resolve this. Here's what I'm doing (simplified for posting):

[Code]....

View 5 Replies

ActionScript 3.0 :: Make A Loaded SWF Call A Function That Is In The Parent SWF?

Jul 18, 2010

I'm trying to make a loaded SWF call a function that is in the parent SWF, but it is not working.In AS 2.0 I could just put something like _root.myFunction(); and it worked.But in AS 3.0 it does not work anymore.

View 3 Replies

ActionScript 3.0 :: Call Function In Parent Movie Clip?

Feb 23, 2009

I have a child movie clip attached to the parent via the flash interface. The child is running a timer via code on its (the child's) timeline. When the timer finishes it needs to trigger a function on the parent's timeline. All the examples show how to trigger a function on the child - that is easy and I have got that working.

View 1 Replies

ActionScript 3.0 :: Use A Function From A Doc Class To Call A Function To Work On In Another Class?

Dec 15, 2009

how do use a function from a doc class.... to call a function to work on in

[Code]...

View 2 Replies

ActionScript 3.0 :: Call Function Of Document Class From MovieClip Class

Aug 8, 2008

How can I run function of the main document class from a class of a MovieClip? I usually just used MovieClip(parent).function(), but now my MovieClip has another parent. Or what do I have to pass to the MovieClip class when creating the MovieClip to acess the main document class?

View 9 Replies

ActionScript 3.0 :: Flash Call A Function From The Document Class In Another Class?

Apr 20, 2011

I have a Document class that instantiates a class named Other. I need to call a function in the Other class from the Document class.I'm getting this error: Call to a possibly undefined method OtherFunction through a reference with static type Other.I have read online that you need to use make the functions static or use a getter function but I'm unclear how to do that. I haven't been able to make it work and I feel like i'm missing something fundemental with this problem.below are simplified versions of the classes.

Document class

Code:
package {[code]......

View 1 Replies

Flash - Listener In Main Document Class For Custom Dispatch Event From Another Class Does Not Respond Or Call Function?

Apr 1, 2011

I have a document class called Main.as In the class constructor I have the following listener:

enter code here
var listeningFORModeChangeToStudent:Sprite = new Sprite;
listeningFORModeChangeToStudent.addEventListener(TellAllModeChangeToStudent.STUDENT,exp);
addChild(listeningFORModeChangeToStudent);

[code]....

In a third class I make a call to the despatcher in the previous class:

enter code here
var ThisTellAllModeChangeToStudent:TellAllModeChangeToStudent = new TellAllModeChangeToStudent;
ThisTellAllModeChangeToStudent.tellAllModeChangeToStudent();

I have trace statements in eveything and from this I know the despatcher in TellAllModeChangeToStudent is being called.The problem is that the listener in the main.as is not calling the function exp.I cant see why and I dont know how to check if the listener is actually seeing the dispatch event?

View 1 Replies

Flash :: Call A Class Public Function From Another Class?

Jun 30, 2010

can i call a class public function from another class? what's the cleaniest solution to do that?

[Code].....

a button wich is istanced in Menu, run showTheThumbs method, in Thumbs.

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

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

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

Flash :: Call A Function In A Class From Another Class?

Oct 28, 2009

My question today revolves around a CustomEvent I'm trying to send from one sub Class to another.

I've used my CustomEvent class to pass an event from a sub Class to my main class fine, but I'm not sure who to do that between sub classes.

My Custom Event Class

package src.events {
import flash.events.Event;
public class CustomEvent extends Event
{

[Code].....

View 3 Replies

ActionScript 3.0 :: Unable To Reference Function From Non-parent Class?

Sep 19, 2011

So I am trying to access a variable that is defined within my parent code from a class which has been called from my parent code. I am using this:Code:TileCode(parent).game_quests.add_quest(0);to try to access the game_quests variable (which is defined within TileCode). However, for some reason it is not picking that up. It is working for other variables which I have called and ran in a similar fashion

View 7 Replies

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

Mar 15, 2012

I have load child swf in parent swf, from child swf i am trying to run my parent swffunction I am trying this code

MovieClip(parent).testfun()
but this code is giving error.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@2b1aa061

[code].....

View 1 Replies

ActionScript 3.0 :: Call A Function From Another Class?

Apr 27, 2009

How do you call a function from another class in AS3? Functions referring properties/methods from instances created in that class. For example I have a class that creates a textfield and a scrollbar and another that load some images in a Scroll Pane component. I do it in that way because in some menus appears only text and in others text & images

What I need is with the scrollbar, scroll both text and images

View 2 Replies

Flash - Call Function Out Of Class

Jul 23, 2011

I have this piece of code that has a problem.

[Code]...

View 2 Replies

ActionScript 3.0 :: Call A Function From A Class?

May 5, 2010

This is what I can do..Write a Menu Class to build a panel of buttons.Add the event listener to the object in the Class.Instantiate the Class in the main document.

What I cant do or understand is how to respond to the events from the Menu Class in the Main document, say by calling a function that exists in the Main document.

I get around this by instantiating the menu Class and then assigning the listener to it in the Main document.

View 0 Replies

ActionScript 3.0 :: Call Function From Another Class?

Jul 5, 2011

I have a mainIndex.as menu.as (extends movieclip-instantiated in mainIndex)

When a button is clicked in "menu" class I want passing the name of the menu item to a mainIndex so the swf with that name can be loaded.

View 2 Replies

ActionScript 3.0 :: Call A Function In Another Class?

Feb 17, 2012

I'm just beginning to learn AS3. Here's what I intend to do. Create a base movie. Load a footer into the basemovie. When a button is clicked in the footer, I want to call a function in the base movie to load a page on the top.

Please refer to the attachment. Basemovie is the main class, that loads the footer swf. In footer.as, I want to be able to call basemovie.fLoadContent() from the function fClickNext().

View 3 Replies







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