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
Similar Posts:
Oct 7, 2004
I was wondering why my current code for calling a setInterval on a function doesn't work inside my class.I have this code inside one function, calling a second function.
intID = setInterval(selfReferential, dupe, 30, 0x000000);
The selfReferential keyword refers to the current class,but was defined previously (selfReferential = this; ).I get no errors, but the dupe() function is never called.and I had the selfReferential variable replaced with the this keyword at one point as well.
View 5 Replies
Dec 15, 2009
how do use a function from a doc class.... to call a function to work on in
[Code]...
View 2 Replies
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
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
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
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
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
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
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
Jul 23, 2011
I have this piece of code that has a problem.
[Code]...
View 2 Replies
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
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
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
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
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
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
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
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
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
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
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
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
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
Oct 25, 2005
I've got some problems trying to call a function inside a mc in a class.For example:
Code:
class Foo {
private my_mc:MovieClip;
[code]......
View 3 Replies
Jun 14, 2006
I'm trying to call a function with a onLoad function in a Class
XML_var.onLoad = function(success) {
anotherFunction();
}
View 6 Replies
Feb 2, 2007
Is it possible the class can call the function that in the timeline?coz I want to use freetransform actionscript to apply "myMovie" class function ....but the error msg: **Error** There is no method with the name 'addFreeTransform'.in myMovie.as
Code:
class myMovie extends MovieClip{
static var EmptyMovieNum:Number=0;
[code].....
View 2 Replies
Feb 22, 2007
I'm having a bit of trouble with some of the functions in a class I am making. I want to see if a button was pressed, then change some variables, and finally call the update function. My problem is that I cannot call the function updateit() once a key has been pressed. Here's the simplified code:
[Code]...
View 2 Replies
Apr 14, 2009
I have "class A" that makes a bunch of objects from "class B"
class A
Code:
public function classA(){
for(var i:int = 1; i<=num; i++) {
var b:classB = new classB(i);
[Code]....
I need to call a function in "class A" from "class B" but I'm not sure how to do that.
class B
Code:
public function stoppedMoving() {
// check for overlap in "class A" here.
}
View 5 Replies
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