ActionScript 3.0 :: Can't Call Stage From Class

Feb 3, 2011

I have a class "Player" that makes a call to the stage for a number of things. The code is below. If I manually drag and drop the MovieClip to the stage, this class works perfectly. [code]...

it won't let me call stage. I tried changing every "stage" to Object(parent) and got no errors, but it simply did nothing. Temporarily, I passed the stage to a variable inside my class, but this seems extremely inefficient and pretty stupid to do for every object... so I'm looking for any other solutions.[code]....

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Call Stage.stageWidth From Class?

Mar 29, 2009

I made a class to create and handle a google map in my swf and everything works very well. But I want to make my layout completely liquid. To acomplish this, I need to call the stage from the class... But it doesnt seem to be so easy.

the code is bellow:

[Code]....

View 3 Replies

Flash :: Call Stage Objects From A Non Document Class?

Sep 1, 2010

I'm trying to manipulate (in this particular case add eventListeners) objects (in this case some MovieClips) on the stage from a class that isn't the document class.

1120: Access of undefined property trans.

Now I know that it's probably a scope thing and I probably can't access stage objects directly from a non document class (as I'm doing in the code below) but I can't figure out how to access them properly.

Anyway, here's the deal:

I've got 3 dynamic text fields (called "NL", "FR" and "EN") on my stage in a movieclip called "trans". I'm trying to add eventlisteners in a second class to make them do something when clicked on.

Here's my document class:

package {
import flash.display.MovieClip;
// Import custom classes.

[Code].....

View 3 Replies

ActionScript 2.0 :: Call Any Movie Clip On Stage From A Class?

Jan 6, 2009

Anybody know how to call any movie clip on stage from a class?[code]...

View 4 Replies

ActionScript 3.0 :: Call Function, Pass Value, Access Variable In Movieclip Class From Main Stage?

Nov 20, 2008

I have a movieClip named MC, and it's enabled with action script, with the class name MC_Rectangle and a Stage.I override the MC_Rectangle class file in a mc_rectangle.as external file.here is the code:

package{
import flash.display.*;
import flash.events.*;[ code].....

I have new a object in the main stage var

mc_rect:MC_Rectangle = new MC_Rectangle()

in main stage:

1. how can i access the variable "sequence" in "mc_rect"

2. how can i pass parametre from main stage to mc_rect via function setSequence(data:int)?

3. how can i call the function in addSequence() in mc_rect.

in asp.net, i usually use mc_rect.sequenct,mc_rect.setSequence(data), mc_rect.addSequence() to achieve my goals......btw, can function in mc_rect return out result to main stage?

View 1 Replies

ActionScript 3.0 :: Class Can Add The Rectangle To The Root Stage Without Requireing The Instantiated Class To Be Added To The Stage?

May 3, 2010

I have a class called shapeC that only creates a rectangle and then addChild(rectangle);.  That class is instantiated on the main timeline.  Currently, the only way you can see that rectangle is to add the instantiated class to the stage via addChild(shapeC);.  My question is, is there a way that the shapeC class can add the rectangle to the root stage without requireing the instantiated class to be added to the stage?

View 4 Replies

Actionscript 3 :: Call A Server Side Script - Whether In A Document Class Or Sub-class?

Mar 13, 2012

while working with a server side script (php or aspx) which returns some data(from the database) can we call it in a sub-class or do we have to make the calls in the document class itself?

View 2 Replies

ActionScript 3.0 :: Call The Class Into To My Control As File But Can't Import A Class?

Mar 18, 2009

I need to call the class into to my control as file. The problem I'm getting now is this error. "environmentTab.lightsButton.addEventListener(MouseEvent.CLICK, selectLights);" environmentTab is a instance name of a movie clip that is on the stage of my .

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

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

ActionScript 3.0 :: Call Document Class Functions From Outside Class?

Sep 25, 2011

Main is my doccument class . how can i call Main.Caller
 
package { import flash.display.Sprite; import flash.events.Event;
public class Main extends Sprite {
public function Main():void   {   if (stage) init();   else

[Code]....

View 2 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 :: Call A Method From A Different Class In Current Class

Nov 4, 2010

I have a class, my document class, called SilkRoadTweeter. as I also have a class called User.as In my User class I need to call a method called nonce() I have tried this, trace(SilkRoadTweeter(root).nonce()); But I get the error, TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 4 Replies

ActionScript 3.0 :: Call A Method From One Class From Within Another Class?

Jun 9, 2011

They are located in the same package and are both importing each other. I am trying to call a function from Class2 within Class1, but I don't know the syntax. I tried: Class2.godoThisThingNow(); But it gave me an error 1061, call to an undefined method. What's the proper syntax for this, and is it even possible in AS3?

View 3 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 One Class In Other Class File?

Jul 21, 2010

how to call one class in other class file

View 3 Replies

ActionScript 3.0 :: Class A Call A Method From Class B?

Oct 12, 2009

From my LoadXML class I am trying to call a method, named onBackgrLoad, which sits inside the Main class. I made the method onBackgrLoad public. Inside the LoadXML class in the method ParseData I added an event listener. This is supposed to call onBackgrLoad but it doesnt work

[Code]...

View 3 Replies

Flash :: Get Stage.stageHeight Or Stage.stageWidth From Imported Class?

Jul 1, 2010

can you tell me a simple and clean way to pass the dimension of the stage to another class, imported in my documentclass?

View 2 Replies

IDE :: Acesssing Derived Class Children (stage Instances) From Base Class?

Jul 16, 2009

I'm slightly new to Flash CS3 + AS3 combo, so its more of a lack of practice question. My question stems from the problem described here http:[url].... . Note, its not the same problem, its a new one.The Problem ,So I have multiple library assets (which are on teh stage) and I want to assign similar functionality to all of them.

Attempt 1: So I create the n assets, create a custom class in AS3, link them to Flash CS3 and obviously enough it gives me the error that multiple assets can't be linked to the same class.Obvious enough to understand (well not completely, because from a programmers background it doesn't make sense).

Attempt 2: Same as attempt 1, but instead of linking all the assets to the same class I make the base class the same class, and let the derived class be dynamically created by Flash on compile time.So the linking works, but the problem is, in my base class I have a method which does something (say an tween) on a child of the library asset. So if the assets on the stage/library are called asset1, asset2, asset3 (same name for asset name, class name, id name), each of them has a sub-movieclip called ... say 'foo'. now if I manually wrote a class for each asset, I could do 'this.foo' to play with the sub-movieclip. However since this functionality is in the parent class, I'm unable to do it.

P.S. If you're form a programming/OOP background, its basically a abstract class problem. My Base class knows how to doSomething(), but it needs aSomething, which is defined in the Derived classes. However I found out that AS3 classes don't support virtual(C++ )/abstract (Java) in the true sense of the word (unless I missed some obvious documentation).

View 3 Replies

ActionScript 3.0 :: Reference Movieclip On Stage From Custom Class Of Document Class

Dec 7, 2009

Is there a way I can reference a Movie clip I have on the main stage from a custom class of a document class?[code]

View 1 Replies

Actionscript 3 :: Stage Properties In Custom Class, Not Document Class?

Oct 14, 2011

I need to use stage.width/height in my CustomClass so I found some topics about it.

if (stage)
{
init(ar,firma,kontakt,oferta,naglowek,tekst,dane);

[code]......

View 1 Replies

Actionscript 3 :: Access A Displayobject On Stage In A Class That Is Not A Document Class?

Mar 7, 2012

How to access a display object on the stage in a class which is not a document class?

I am looking for a solution that doesn't involve passing the stage as a parameter to the class.

One solution i always come across is using "TopLevel.as". Is it a good method because as far as I have heard using global variables is not recommended because it might cause some problems while working on big projects.

View 1 Replies

ActionScript 3.0 :: Access The Stage Property From A Different Class That's Not The Principal Class?

Jul 2, 2009

I was wondering how do you access the stage property from a different class that's not the principal class tied to the fla? Essentially, I have main.as which calls another class menu.as, and I can't seem to be able to use the stage.stageWidth property from menu.as. What's the proper way to be able to use the stage property from any class? Do I have to import it separately each time?

View 2 Replies

ActionScript 3.0 :: Reference Movieclip On The Stage From A Class Of The Document Class?

Dec 8, 2009

Is there a way to refer to a Movieclip on the stage from a class file of the document class

Lets say I have 3 MovieClips on the stage(a Circle, a Square and a Triangle)

I have the document class which calls another class that controls the MC on the stage

Example

ActionScript Code:
package {
public class Example extends Sprite {
//Create the instance of the class being called

[Code]....

View 1 Replies

ActionScript 3.0 :: Accessing An Object Drawn On The Stage In One Class From Another Class

Jan 6, 2011

I have created a class, call it Class1, that has various objects drawn on the stage (drawn in the IDE). It also has a function, called setColour, for changing the colour of those objects. The function works fine if I call it from within Class1.

Now I have another class, call it testClass1, that imports Class1 and calls the setColour function. First of all, none of the stage objects from Class1 are visible. Secondly, when setColour tries to modify the colour of an object, I get the error:

TypeError: Error #1009: Cannot access a property or method of a null object reference.

This is the code for testClass1:

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

[Code].....

So, what is the problem? Is it possible to change objects that are drawn on the stage of an imported class?

View 3 Replies

'Call' A Movieclip On Stage From Within It?

Jun 5, 2011

I have 2 movie clips on the stage, and i need to call the 2nd movieclip from within the 1st one[code]...

View 1 Replies

ActionScript 3.0 :: Accessing The Stage From A Class Which Isn't The Document Class?

Jul 3, 2009

I'm being really dumb today and I know this should be simple.....How do i access the stage from a class which isn't the Document Class? For instance, I want to create a tween which takes in the parameters of the stage's width? So I've written.....

ActionScript Code:
var myTweenX:Tween = new Tween(this, "x", Regular.easeOut, this.x, stage.stageWidth, 60, true);

[code].....

View 4 Replies

Actionscript 3 :: Flash Call Function In One Child Class From Another Child Class?

Dec 1, 2011

I'm trying to call a function in one child class (Circle.as) from another child class (Wedge.as). Circle.as is instantiated by the document class (Tree.as), and Wedge.as is instantiated by Circle.as. How do I do this? This is my code:

Tree.as
package com.treediagram
{
public class Tree extends MovieClip
{

[code]....

How to call a function in a Class from another Class?but it was a bit hard to follow as it relates to my problem. One of the solutions worked, but was commented as being bad form, and another did not work, so I want to make sure I structure my code properly.

View 3 Replies







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