ActionScript 3.0 :: Call A Function For Every Instance Of A Certain Class?

Apr 27, 2009

When I try to use this code to call a function for every instance of a certain class I get an error saying that there is a "call to a possibly undefined method removeInstance through a reference with static type flash.displayObject".

Code:
for (var i:int=0; i<=numInstances; i++) {
if (numInstances!=0&&getChildByName("b"+i)!=null) {
getChildByName("b"+i).removeInstance();
}
}

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Instance Or No Instance - Call A Function From Another Class?

Jan 26, 2009

I have a general / somewhat newbie question. Is it better practice to call a function from another class like so:

[Code]...

Does one way free up more memory or enhance performance?

View 5 Replies

ActionScript 3.0 :: Get The Instance Of The Class To Call The DispatchEvent For The PostTrace Function

Feb 8, 2009

How can I get the instance of the class to call the dispatchEvent for the postTrace function.

1180: Call to a possibly undefined method dispatchEvent.

Code:
package {
import flash.display.*;
import flash.events.*;

[Code].....

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 The Methods Of The Instance Of Class

Jul 7, 2009

i have a main movie. i use a loader to load a "example.swf" file. then i place that file inside a holder movieclip. in example.swf, i have an instance of a class i just wrote. this class has some particular methods. from my main movie, i want to call the methods of the instance of my class i have in example.swf. how can i do that??? i know it's a kind of casting, but none seems to work.

View 1 Replies

ActionScript 3.0 :: Call Method For Instance Of Other Class?

Oct 15, 2009

From my Main class, in the method onBackgrLoad, I am trying to call a couple of public methods (i.e. xmlData, hintergrund & numOfProducts) located in LoadXML. I keep receiving an error message that "loadXML" is undefined. I dont understand why because I clearly defined it in the main class:

PHP Code:[code].............

View 2 Replies

ActionScript 3.0 :: Child Class Object Instance - Anonymous Call

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

Actionscript 3.0 :: Call A Movieclip Using The String Class Together With It's Instance Name To Use GotoAndPlay() Method

Sep 20, 2009

I just want to ask if is it possible to call a movieclip using the String Class together with it's instance name to use gotoAndPlay() method. I know how to use the instance name and the method but then what if I want to use a string together with the instance name and the gotoAndPlay.

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

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

ActionScript 3.0 :: Call Function Outside Of A Class File?

Dec 17, 2008

I like to call a function that is outside of the class file.

for example

main.fla

Code:
function callmepls(){
trace("yes");
}

[Code].....

View 8 Replies

ActionScript 3.0 :: Call A Function From One Document Class From Another

Aug 30, 2010

I'm basically trying to call a function that is on document class from another document class. I have a document class called Main.as in it there is a function called tester(). I need to call this function from another document class called Step1.as.[code]Does anyone know how I can call the function? I cant seen to get it to work.

View 5 Replies

ActionScript 3.0 :: Call Function In Class From 1st Frame?

Oct 3, 2010

I have an external class file that contains code to control the playback of a movie that is defined via FlashVars.

Within this class are functions like this to control playback of the movie:

[Code].....

What I'm trying to do is find a way to trigger those same functions from the 1st frame of the timeline itself. Basically after a certain amount of time I need to pause the video automatically.

how do I trigger functions like the doPlayEvent() function noted above from some AS that's inserted in the first frame of the movie?

View 4 Replies

ActionScript 3.0 :: Call Function / Class From A Loaded MC?

Apr 30, 2010

Can anyone tell me if its possible to call a function or class from within a loaded MC?

mainMovie loads MC > MC calls function in a class of mainMovie

if so, what is the best method?[code]...

View 2 Replies

Call Function In Main Doc Class From External SWF?

Jul 9, 2009

I have a main.swf that loads in an external swf called home.swf. I want to be able to call a function in main.swf's doc class from the loaded swf:

Code:

function loadArtist():void { // my function }

in the main timeline of home.swf I'm calling it this way:

Code:

function timeToGo(m:MouseEvent):void {
trace("button pressed");
MovieClip(this.parent.parent).loadArtist(); }

the home.swf compiles fine but when loaded in the main.swf & the button is pressed i get this error:

TypeError: Error #1006: loadArtist is not a function.
at home_fla::MainTimeline/timeToGo()

It seems that it thinks loadArtist is a property. Ack. I've got 3 objects loaded dynamically using addChildAt(mc, 0) ...

View 2 Replies

Actionscript 3 :: Call Some Mxml Function From Class?

Jan 10, 2011

I have 2 files: Main.mxml with application and one MyObject.as.I create the instance of MyObject in mxml and can call its every public function from mxml. But what if for some reason I need to call some function declared in mxml from MyObject class?

View 2 Replies

AS3 :: Call Function In Root Timeline From Class?

Dec 8, 2011

I want to call a function that is inside the root timeline of Flash from an external class.

This code is from the class:

private function loadImage(event:Event):void
{
addToContainer()
}

[Code].....

View 3 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 :: Call Function Using SetInterval From Another Class?

Feb 4, 2009

I have a custom class called SpeedCheck, in this class I have a function called Activate(), I am trying to call this function using setInterval from another class but I am not sure how to format it.

This is how I would normally call the function:

ActionScript Code:
SpeedCheck.Activate()

I tried this:

ActionScript Code:
setInterval(SpeedCheck ,"Activate",100);

but it doesn't work, what am I doing wrong?

View 3 Replies

ActionScript 2.0 :: Can't Call A Function When Loading XML In Class

Nov 26, 2009

i am developing a AS2 class that loads a XML but i cant call a function from inside the onLoad function. Heres the code:

[Code]....

View 1 Replies

ActionScript 3.0 :: Call A Class Function From Movieclip?

Nov 14, 2011

May I know is it possible to call a class function from the timeline of a movieclip? I had tried:

[Code].....

View 2 Replies







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