ActionScript 3.0 :: Error Accessing A Static Function

Nov 22, 2011

i have two classes , and i need to call static function from one class to the other. also when i call this static function i need access the local variable of that class. Class Test2: Quote:

[Code]...

when i run these class i get the following error Test2.as(18): col: 10 Error: Access of undefined property testVar. this function works if i change [testVar] to a static variable , is there any other way to make this function work other than making the [testVar] variable to static?

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Getting Error When Calling Static Function

Feb 3, 2009

I have never encountered this problem before.

I have a support class called ICSNAArrays.

It contains only static functions.

In my main class file I have imported it and then when I try to call one of the functions I get a compiler error that says there is no method with the name 'ICSNAArrays' I don't understand this. There are no errors importing it. All of the spelling is correct I am 100% sure on that. [url]...

View 1 Replies

ActionScript 2.0 :: Support Class - Getting Error When Calling Static Function

Feb 3, 2009

I have a support class called ICSNAArrays. It contains only static functions. In my main class file I have imported it and then when I try to call one of the functions I get a compiler error that says there is no method with the name 'ICSNAArrays' I don't understand this. There are no errors importing it. All of the spelling is correct I am 100% sure on that.

View 9 Replies

ActionScript 3.0 :: Error Accessing Function After HitTest

Oct 4, 2010

I've been using asGamer's excellent set of game design tutorials to put together a basic 'ship and enemies' shoot 'em style game - my first proper venture into using AS3 and external class files - and I've hit a problem with executing hit test results. To explain: The game uses Engine (the document class), Ship and Enemy classes. Enemies (new instances of the Enemy class) are added to the stage in the Engine class, where they are also stored in an array, enemyList. The Ship fires a Laser, and the Laser class is where we test for a hit on Enemies.

Now, in asGamer's original version he uses the hitTestObject to test for hits, and if a hit is registered, this line
PHP Code:
Engine.enemyList[i].takeHit();
Calls a function in the Enemy class to remove the relevany clip. However, as the hitTestObject includes the bounding box of a clip in its hit test, I decided to use Corey O'Neil's Collision Detection Kit for greater accuracy. The CDK CollisionList class returns an array, the each element of which is a clip with which the target object has collided.

The problem this presents is that rather than using
PHP Code:
Engine.enemyList[i].takeHit();
To deal with a collision, I now use
PHP Code:
collisions[j].object1.takeHit();
Where 'collisions[n].object1' are the movie clips hit.

When I test the game it throws an error
PHP Code:
ReferenceError: Error #1069: Property takeHit not found on com.asgamer.basics1.Laser and there is no default value.
at com.asgamer.basics1::Laser/loop()
Although the movie does not break, and continues to remove destroyed enemies as if there was no problem.

What the problem is with calling the takeHit function via the collisions array rather than the Engine.enemyList array? And perhaps suggest a way to prevent it? I should point out that the 'laser' is in fact a blast that can take out any number of enemies intersecting with the blast radius, which is why I'm using CollisionList to detect hits.

View 6 Replies

ActionScript 3.0 :: 1009 Error - Accessing Parent Function From Child

Oct 5, 2010

Its a bit strange really, I have a Main class that has 2 children, Child1 has a variable goldCount that needs to be parsed to Child2 via the Main class (directly doesn't work either so far) Child1 has this function:

Code:
public function Getgoldcount():Number {
return goldCount;
}

[Code]....

View 2 Replies

ActionScript 3.0 :: Static Function Calling A None-static Function?

May 18, 2011

Basically, what I mean is I i have few layers of classes, that calls and change something on the 1st(root) class. In between the process I have to use static var and static function.But when I want to run a function which does not change any variables, for example:otoAndStop(someFrames), I need to make the function a static function too or else there would be error

Code:
1061: Call to a possibly undefined method checkStatus through a reference with static type Class.

[code]....

View 4 Replies

ActionScript 3.0 :: Static Function Can't Find Non-static Functions

Jan 6, 2010

Ok, so I have a bit of a mess here (Which I'm probably not doing right anyway, which could be my problem...). I have a document class, I'll call it as Body.as, that creates an object from another class known as Headgear.as. There are also other objects created from other classes, or will be in the future. Now, amoung all this, Headgear.as and all of the other classes Body.as will use to make objects require the use of dragging functions (starting and stopping dragging). On stopping drags, position checks are then made to compare a particular hidden movieclip with the dragged MC.

To try and save myself some hassle (from making the same functions over and over to ensuring that when the objects are created I don't need to send a complete crapload of variables just to ensure the position checking function would work), I had the functions for the event listeners (Which are set-up on the draggable MCs in Headgear.as) just direct to functions in Body.as

[Code]...

View 6 Replies

ActionScript 3.0 :: Static Class Needs A Non-static Function

Nov 22, 2009

Alright, so I have a class that is linked (via the linkage panel) to a scrollbox class. I'll paste the class here:[code]Ignoring the formatting, the commented out functions are the ones causing the issue. Adobe says that it's a static class and I can't use non-static functions. The way I wanted to use it was:

1. Call the page button generating function above.

2. In the main code in my program is this line:scrollbox.setClickFunction(historyContent.generate Page);So when the buttons that are supposed to be generated are clicked, the scrollbox class can call the History pages generatePage function and pass it which page to show. (I did this because there was a lot of text and a limit on how much would display, so small chunks sounded logical).

3. In the onClick function (which I haven't finished yet because the rest wont work), when you click one of the buttons it calls the set function. Its that simple.

View 4 Replies

ActionScript 3.0 :: Static Methods - Error "1119: Access Of Possibly Undefined Property Instance Through A Reference With Static Type Class"

May 4, 2009

I'm kind off oblivious as to what I'm doing wrong here... I have two classes: - Alley - AlleyCat

[Code]...

View 8 Replies

ActionScript 3.0 :: Accessing Static Variables Using The Class Name Itself

Jun 18, 2009

Say I have a class called Ball (movieclip) and I create a number of instances of it. There is a static variable, say, ballArray and need to access that from a different class, say, Bat. How do I go through with it? Can I access that using the class name itself (Ball.ballArray like in Java)?

View 1 Replies

ActionScript 3.0 :: Accessing A Movieclip From A Static Class?

Sep 21, 2009

I'm working on a small networked game (server is written in C# ready to go). I've completed all of the networking classes utilizing xmlsockets (socket handling, packets etc). My issue is once you get to the login screen and attempt to authorize a packet is sent depending if your login has been accepted so if it has you delete the login movieclip and show the game movieclip but I can't access it from my static class (it was created on the main stage).

View 4 Replies

ActionScript 3.0 :: Accessing A Static XML Variable From Within A Switch Statement

Jun 1, 2009

In the following class

Code:
package
{
public class Factory
{

[Code]]....

A break point on the "Okay" line shows that x1 is null but x2 is equal to "<entity id="DRONE" points="100"/>".

If I take the whole block out of the switch statement, both x1 and x2 are equal to the expected xml.

View 6 Replies

ActionScript 3.0 :: Accessing Static Variables Of A Super Class Through A Subclass?

Aug 10, 2011

I'm trying access a static variable located of a super class through an instance of one of it's subclasses and I'm receiving an access of undefined property error (example of which below).&nbsp; Creating another static variable in the subclass and assigning the value from the super class will allow me to dot operate to it.&nbsp;

[Code]....

View 1 Replies

Flex :: Require A Function Parameter To Be A Static Constant Of The Function's Class?

May 22, 2009

Let's say I have a Custom Event Class, and it has several Event types stored in static Constant:

[Code]...

Is there an easy way to validate that the type passed to the Constructor is one of the Static Constants of the Class, without having to check it against each value?

View 5 Replies

ActionScript 3.0 :: Make Function In To A Static Function And Call It From Other Classes

Sep 23, 2009

this is the function i want to turn in to a static function. just dont know how to make it a static function and call it from other classes. i think this would have its own file.

[Code]....

View 2 Replies

ActionScript 3.0 :: Calling A Function From A Private Static Function?

Feb 26, 2010

i'm trying to modify some code and can't figure out what the issue i'm having it. this is the(shortened) code:

public static function Lose():void {
trace("OVER!");
Clock.stop();[code]...

this is the error i get: 1180: Call to a possibly undefined method OverIt.i just want to call a function from inside of the public static funtion.both function are inside this class:

public class Game extends MovieClip {
}

View 4 Replies

ActionScript 3.0 :: Accessing A Class's Static Functions From A Variable Of Type Class?

Feb 19, 2010

I realize this is kind of an odd issue, but I am wondering if there's any way to get Flash to allow me to access a class's static functions using a class variable that points to the class. Example:I create a class called FooClass that has a static function named fooI then create a variable of type Class that points to it

Code:
var class:Class = Class(getDefinitionByName("FooClass"));
However, when I try to call foo() using the variable, it errors saying the function

[code].....

View 6 Replies

AS3 :: Accessing Attributes Of A Static Variable Of An Object From Another Object

Nov 7, 2009

I have 2 classes, Display holds the currently selected Component:

public class Display
{
public static var selectedComponent:Component;
}

Component has an ID string and the selectedComponent variable is set on click:

public class Component extends MovieClip
{
public var id:String;
addEventListener(MouseEvent.CLICK, function() {

[Code]...

Removing the selectedComponent variable type so it reads public static var selectedComponent; removes the conversion error and seems to change the ID variable but it appears to only be a copy of the object.

View 2 Replies

ActionScript 3.0 :: Static Method Accessing Instance Method?

Sep 14, 2010

two classes, both extend EventDispatcher. Static method in 1st class calls instance method in 2nd event not getting caught. [code]also, since dispatchEvent() is an instance method, is there any way of calling it without first instantiating the class? i expect not.

View 2 Replies

Flash :: Use A Static Function In Actionscript 3.0?

Dec 15, 2009

I would like to do the following:Have a few objects (e.g. 20 of them), each time I mouse over any one of them, it moves up and each time my mouse leaves, it moves down.[code]...

View 3 Replies

Actionscript 3 :: Encapsulating A Static Function?

Jun 11, 2010

i would simply like to encapsulate a function in it's own .as file, but i can't quite get it.

[Code]...

View 1 Replies

Flex :: Static Var In Member Function?

Jun 20, 2011

I would like to know, in Flex 4.5.1, if there is a way to create a static variable in a member function, something like bellow:

public function myFunction():void {
static test:Object = null;
}

View 2 Replies

ActionScript 3.0 :: Function Or Static Method?

Sep 9, 2009

Is it more common to use a function for program utilities or a static method?

[Code]...

View 9 Replies

Actionscript 3.0 :: Static Function And AddChild?

Jul 30, 2009

I have some problems working with "static function"For example:

Code: Select all   public static var someText:TextField = new TextField(); 
public static var FORMAT:TextFormat = new TextFormat("Arial", 12, 0x000000);
public static function myText():void

[code].....

View 8 Replies

ActionScript 3.0 :: Creating Textfield Within Static Function?

Jul 10, 2011

Just transitioning into object orient programming and I got stuck trying to create textField using static function. I searched online about this and none of them were useful. I dont want this to be just public function because then I cant access this function from other classes. I would like every classes to access this function so I need it to be static.

package {
import blahblah
public class example extends MovieClip{[code]..........

View 6 Replies

Actionscript 1 :: Create Static Function In A Class In It?

Nov 17, 2010

Can i create static function in a class in action script 1 ?

View 1 Replies

ActionScript 3 :: How To Get Mouse X / Y Inside Static Function

Jan 18, 2012

I need Mouse coordinates inside a static function. It isn't a mouse event function and there isn't anything passed in the function.
// Main class
MyClass.something();
// MyClass
public static function something():void {
// Get Mouse Coordinates
// myclassclip.x = mouse coordinates
}

View 1 Replies

ActionScript 3.0 :: Possible To Dispatch Event From Static Function?

Feb 8, 2009

I've created a class to hold data in static vars with getter and setter methods. The class in never instantiated, i.e. var obj:MyClass = new MyClass();.[code]

View 5 Replies

ActionScript 3.0 :: Declaring And Using Static Method/function

Sep 2, 2009

I wanted to use a couple of stand-alone function/or static methods by declaring them in the external *.as file and import it.

The problem is, when I import it, I had to instantiate a new class from imported class to use any of these functions which is not necessary in my situation, I just wanted to be able call these functions.

It (AS) does not allow me to declare those functions outside of class declaration, (tried with static keyword in front of those functions just like in C++).

I also tried to declare the class itself with static keyword (also just like C++) but AS also does not allow me to do that.

Remember whole points is declare couple of helper functions in external *.as file and use it over and over.

View 5 Replies

ActionScript 3.0 :: Access A Class Var From A Static Function?

Jan 21, 2010

I've summarized my issue in the following [code]...

1119: Access of possibly undefined property mc through a reference with static type Class.

View 9 Replies







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