ActionScript 2.0 :: Call Function Inside A Class?
Oct 25, 2005I'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]......
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]......
1- i have class and i called its before and its running on runtime. i need to call function inside this class from another class, but without call the first one again, because if i called it, it will run default class function again is this doable ?
2- What super() mean ?
i want to call an external function inside a class. thats the code;
in checkConnectionStatus function,
this[_funcNameForSucceededCon].apply(); doesnt work because "this" is the class, not the Application. How can i reach Application at this time or what can i do?
package myLibrary
{
import air.net.URLMonitor;
import flash.events.Event;
[Code]....
I have an object and would like to call a function from it, which the way I am trying to do it, does not seem to work. Here is what I have:
Code:
private function setTimer():Void
{
[code]......
I'm having some trouble finishing an interface i'm working on,the function indica() adds a menu listing of items (indicadores) inside a mask because its too large, and i added a scrollbar that allows to scroll through the items but now i need to add the buttons inside the movie clip indicative,i can add symbols and buttons, but i'm having trouble having them call functions inside the same class that the function indica() is running.[code]
View 2 RepliesDoes anyone know if there is a way to call a dispatchEvent call from inside of a static function?
View 2 Repliesvar speed:int = 4;
addEventListener(Event.ENTER_FRAME,MoveRight);
function MoveRight(event:Event):void{
[code]......
how do use a function from a doc class.... to call a function to work on in
[Code]...
let's say I have 3 functions like this.
ActionScript Code:
function function1(e:event):void{
//code
[Code]....
Can I somehow, stop the enter frame in function 2 with some code in function3? I know that is not the better practice, but in this case is really needful to have a function inside another.
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 RepliesLets 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].....
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]......
how could i call a mc, from inside a function, being this target stored in a var
ex:
var clipVar:MovieClip = this.main_mc.myClip_mc;
function goX (){
this[clipVar]._x = 100;
}
goX();
no parameters for the function?
This is hard to explain, but basically here goes: have a "frame" movieclip that loads images. I call frame.loadImage(the URL) and everything works. So far so good.When I put "frame" inside of another clip, named "frameHolder", then call frameHolder.frame.loadImage, nothing happens.
View 9 RepliesI 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?
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.
when we write
var obj1=new Object();
var obj2=obj1;
we know obj2 is just a call of obj1, they are the same thing.also, prameters of function are also the calls of the object outside e.g.
var objC=new Object();objC.name = "Jhon";[code].........
it seems that when setting tar to null, the obj outside in the function didn't changeit seem taht everything you do will pass to the real object, but not setting it to null;
my questions: how to make the real object became null with a call?
I'm trying to pass a variable through a function, but I'm getting it's value 0. Here's my code:
thumbLoader.addEventListener(MouseEvent.CLICK, goToCategory);
function goToCategory(e:MouseEvent) {
trace(c);[code]....
this trace gives me value of 0. Normally I would do goToCategory(c) and inside that category I would get it's value, but in this case I'm calling this function with an event, how can that be done?
var c is declared globally, so I'm using it above this code in different place... is there smth like global $c like in PHP.. or there's some other way to do it?!
how do you call a function that is inside another movieclip?Do global functions have to be declared on the root? I'm trying to do a very simple thing, take the grid tutorial and apply it as a mask to an image. Everything works ok, now I would like to call the function that makes the grid after the pic has loaded.
So I have on the root:
mc_picholder
mc_boxholder <---This mc contains the function that makes little boxes
I can assign the mc_boxholder as a mask to the mc_picholder and this works fine. Now say I have a function in mc_boxholder called makeboxes(), and I want to call it from the root once a pic has finished loading into mc_picholder.All the functions to make the boxes are inside the mc_boxholder. I've tried declaring makeboxes as global, and calling it from the root, doesn't work.I've tried tried writing from root: mx_boxholder.makeboxes(), doesn't work either.....
I have a mailTo: function that needs to be added to a button that sits inside of a movieclip. I put the code inside the actionscript layer in the movieclip.[code]...
View 2 Repliespackage{
public class Character{
protected var _hp:uint = 50; //Character Health Points
protected var _power:uint = 5; //Damage dealt
[Code].....
I`m instancing a Character and a Player in the Main Timeline, all in frame 1.
When I use: ""player.attack(character)"" it works fine by itself.
So I added the if (defender._hp <= 0) this.win() which gives me the following error:
1061: Call to a possibly undefined method win through a reference with static type Character.
"defender" is a Character instance, "this" is a Player instance and "win()" is a Player method. I try to call the Player method inside a Character method using the Player instance adding the "." and his method name
Do I really need to define the win() function in the Character class? Is there a bypass to use a subclass method in a parent class method if it`s called from an instance of the subclass?
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.
Can I call a java class method from inside a flash movie?
View 1 RepliesMy 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].....
I have a function at frame 1 (_root). Well, i am trying to call this function from a button, inside a movie clip, but it's not successful..
View 2 RepliesI have to know if a public method has been called from outside the class or from inside. The reason is that depending on this, one of the actions to be executed in this method vary a bit.
View 3 Replieshow can i call function inside movieclip in library panel it is not on time line
View 2 RepliesI'm having a bit of a hard time with calling a function in the main timeline through a button in a movieclip. The mc is in the main timeline and in it I added a button with this.removeMovieClip(); and so far it works, but when I try to call a function from the main timeline it just doesn't seem to work.
View 13 RepliesFrom a button in Flash I just want to call a function written in jQuery.When I place the function outside jQuery's $(document).ready it works fine:[code]
View 1 RepliesI know there are ways to invoke javascript inside the html wrapper template for the flex application using ExternalInterface, but is it possible to reference an external html page?
View 3 Replies