ActionScript 2.0 :: Access Variables Within The Main MC Class?

Nov 18, 2007

I have a MC with a class attached to it, and I have other MCs within that MC. I need those MCs to be able to access variables within the main MC class. Here is a quick'n'dirty:

Code:
class Foo extends MovieClip{private var h:Number;
private var subMC:MovieClip;function Foo(_h:Number){h = _h;}
subMC.onEnterFrame = function(){trace(h);}}

How can I access variables in the Foo class from another MCs scope? I have tried using static var but aren't they constant regardless of instance?

View 1 Replies


Similar Posts:


Actionscript 3 :: Access Variables In Main Application Class From Instantiated Class?

Apr 8, 2010

I have a initApp.as which instantiates a class which needs to access the "currentState" property and the States array as well. However we cannot get this to work as we cannot see how we can access this information.

Within initApp.as currentState is accessed via "this.currentState". This does not work in the class which is instatiated within initApp.as. The following error is thrown:

"Access of undefined property currentState."

View 1 Replies

ActionScript 3.0 :: Access Main Timeline Variables?

Dec 30, 2009

Is there a way to access variables on the main timeline in Flash other than MovieClip(root).myVar ? The problem I am having is that I have a movie clip that uses several main timeline variables, but when I instantiate it, it throws a 1009 type error (cannot access property of null object reference). My understanding of whats going on (and please correct me if I am wrong) is that when instantiated it runs the code on the first frame of the movieclip. However, it is not added to display list yet, so it does not have a root. Thus, all the MovieClip(root).myVar lines do not have a root to look at. Does anyone know of a way around this?

View 3 Replies

ActionScript 3.0 :: Access Function At Main Class From A Sub Class?

Mar 3, 2011

My first experience is build an aquarium with a lot of fish swimming, and they can be clicked. When one of them is clicked we should receive a trace message saying ("I�m a Fish!"). To do this, I thought that the best way will be:

1- create a document class, named Main.as

2- create a base class, named Clicked.as

2- create a movie clip with a fish.

3- export the movieclip to actionscript. In the mc properties set Class as "fish" and Base Class as "Clicked".

View 6 Replies

ActionScript 3.0 :: Access A Function In The Main Class From Another Class?

Mar 1, 2010

i have a game that i want to put load screen on, which i created a separate class for. first the main class is initialized and in the constructor function, it does an addChild(loadScreen) which places an instance of the loadScreen MC on the stage. within the loadScreen is a "Play Button" that when a user presses this button i want it to continue startGame in the Main class. the way i tried it was Main.startGame from the loadScreen class, but that obviously does not work. is it possible to call a function from a different class.i have three files:

Main.fla
Main.as
loadScreen.as

the Main.as file:

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

[code]....

View 3 Replies

Actionscript 3 :: Access Variables Of The 'main' SWF From A Loaded SWF By SWFLoader?

Jan 31, 2012

I'm working on a website built in Flex, but the SWF file after compiling is very large. The websites has multiple pages. So I thought to create a new MXML project for every new page and load it with SWFLoader. I've found this example:

[Code]...

View 1 Replies

ActionScript 3.0 :: Can't Access Variables That I Declare In Main Timeline From A Child

Sep 14, 2009

I can't access the variables that I declare in the main timeline from a child.

I attach the child to the stage during runtime.

View 3 Replies

ActionScript 2.0 :: Access Variables On Main Scene From Inside A Movie Clip?

Jun 30, 2005

How do I access variables on the main scene from inside a movie clip.

I have a variable called player health, and inside the movie clip I want to do this, playerhealth -= 20, but its not working

View 10 Replies

ActionScript 3.0 :: Flex - How To Get Variables In Main MXML To Be Seen By Class

Nov 2, 2010

How can I get access to public variables in my main .mxml application from my AS class and vice versa? Also, say I have a main container panel defined in mxml, how can I reference to it's id from a separate class file?

View 1 Replies

ActionScript 3.0 :: Access Main Class Objects?

Mar 1, 2011

I created an array in my Main class and populated it with instances of a seperate class. Is there a way I can access the original array from within the instances of the separate class.

View 1 Replies

ActionScript 3.0 :: Access Property Of Main Class In Loaded Swf

Aug 28, 2010

i have one main.fla, its document class is main.as. the code in main.as is package.[code]where val is the property of Loading class.so how can i access.

View 2 Replies

ActionScript 3.0 :: Access Main Class Function From External?

Feb 9, 2009

I'm quite confused about how to do it, look at this [code]...

View 2 Replies

ActionScript 3.0 :: Access A Class Object From Main Timeline

Dec 29, 2010

I have a class, and I'm trying access an object outside of that class. For example, in my class I have function: onNodeLoad(node:Object)with that function I can access the properties of node just fine, but outside the class I cannot.In the function that is inside the class, I can trace (node. title)I want to be able to do that trace on the main timeline.[code]So right now, in my main timeline, trace(con.node) comes up null.I've tried to declaring _node public, private, public static.

View 1 Replies

ActionScript 3.0 :: Access Main Time Line From Class?

Feb 12, 2009

document class

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

[Code].....

the highlighted function is what i need to be working but it isnt.. have no idea whats going on... i basically need to jump between frames on the root timeline (superMain)

View 1 Replies

ActionScript 3.0 :: Access Variables From A Class?

Oct 19, 2009

I'm trying to create an XML class to load some images on a stage, but my problem is that I can't access variables in my XML class(which I need to load the images) from the main timeline after I've created a new instance on the XML class.[code]...

View 1 Replies

ActionScript 2.0 :: How To Get Access To Class Variables

Jun 9, 2006

I am just writing this test code in AS1.0. Now the problem, I am not able to get access to my class variables. I am doing this stuff for learning As1.0. Although in 2.0 I get through those using static variable. But in As1.0 I don't know how to do this.

Code:
function main(){
this._xml=new XML();
this._arImages=[];
this._xml.ignoreWhite=true;
this._xml.onLoad=this.LoadData;
} main.prototype.showImage=function() {
[Code] .....

View 1 Replies

ActionScript 3.0 :: How To Access Instance Property Through Child In Main Class

Jan 23, 2011

I have make 3 classes objecthandler, box and nav. Nav is child class of objecthandler, I have make an instance of box into objecthandler and now I wanna access property of box through nav.
See the code:
Objecthandler class
package code{
import flash.display.MovieClip
import code.box
import code.nav
[Code] .....

View 1 Replies

Actionscript 3 :: Access Main Stage From Class Definition File?

Mar 22, 2010

I'd like to access the stage of the main timeline from w/i a class that extends a movieclip. Basically, I have a button in the main timeline that makes a HUD appear. The HUD is an extended MovieClip class. When people click on a button in the HUD, I'd like to remove the object from the stage of the main MovieClip.I think your confusion may come from the fact that I am running this code from a class definition file. Clicking on a button w/i this object should remove it from the DisplayList of the MainTimeline. Here's the code from the class definition file:

package classes {
import flash.display.Stage;
import flash.display.MovieClip;[code]....

trace(e.currentTarget.parent.parent) gets me the MainTimeline, and trace(e.currentTarget.parent.parent.stage) appears to return the main stage, but I cannot use removeChild w/o getting an error that I am trying to coerce the stage to be a DisplayObject (which it ought to be).What's on the stage of the MainTimeline: A single button that, when clicked, adds an instance of the Answers class to the stage.

View 2 Replies

ActionScript 3.0 :: Flash - Access Nested MCs From Main Document Class?

Mar 11, 2012

I have 3 dynamic textfields that are added to the stage through an external class, (I only add the main container from the Main.as) the textfields are nested under 5 MCs (that's what i see when i list objects in the debugger) how can i access those textfield from the Main document class?I've tried by path, by getchildbyname, i've exported the font for AS (the textfields have instance names)... and nothing works, i either get an error or it tells me it has no properties, or null..

View 14 Replies

ActionScript 3.0 :: Can't Access Parent Class Variables

Feb 11, 2010

Look at this example [code]...

How come the trace in the SlotsSetup function is printing out NaN ?

View 1 Replies

ActionScript 3.0 :: Access Class Variables From Another Classes

Jan 10, 2012

The system i am trying to make is structured like this: How can i acess the vars of the class var from the other classes?

View 4 Replies

ActionScript 3.0 :: Flash Variables Between Frames - Put All Code From The Main Timelime To A Document Class?

Feb 6, 2011

I have a little problem in my game. I have a var coins:int = 0; on frame one, and I want to access it from frame 2. I'm not using a document class. Is it possible to make some kind of a global variable like in as2 without having to put all my code from the main timelime to a document class?

View 1 Replies

Actionscript 3 :: Access The Main Class's Stage + Pass Functions As Arguments Like This?

Jan 22, 2011

There are two files in my actionscript project named "TestAPP", TestAPP.as and Draggable.as

TestAPP.as:
package {
import flash.display.Sprite;
import flash.display.Stage;[code].....

In "my actionscript theory", I'm supposed to see a circle that follows the mouse when I click it. (The draggable is not fully implemented) But the circle doesn't even budge .how to access the main class's stage property. I've googled for it, but still no progress.

View 4 Replies

ActionScript 3.0 :: Access Of Variables From Root Or Document Class?

Nov 13, 2010

Anyways, I've been trying to figure this out for quite some time.Let's say I have my document class. I'm guessing the document class can correspond to the first thing that gets run? (such as the "main" function in most C++/low level languages).If I set a variable in it:var myNumber:Number = 10;how would Iaccess: "myNumber" from other objects in my stage?Like a movieclip on my stage for example.If I go inside that movieclip into the movieclip's first frame, how would I say:trace(TheDocumentClass.myNumber);Another similar question is, what about the actual stage frame?If I click on frame 1 of my stage, set a variable:var aNumber:Number = 5;how would I access it from other objects?In my movieclip's first frame, what would I put?trace(root.aNumber); ?trace(stage.aNumber); ?

View 9 Replies

ActionScript 2.0 :: Unable To Access Variables In A Class File

Aug 21, 2007

I am unable to access variables written in a class file.

This is the class file:

class readXML {
public var modArray:Array;
public function setModule() {

[Code]....

When I access the getModule method from flash (on click of a button), I get modArray as undefined.

how I could get the data of modArray?

View 2 Replies

ActionScript 2.0 :: Access To The Class's Instance Variables Inside Display()?

Jan 26, 2006

I've created a class that utilizes setInterval...I call it in a different class...and I can't get it to make the setInterval call. I'm thinking there's a scope problem but I don't see it.

Class w/ setInterval:

Code:
class Foo {
private var id:Number;
public function Foo() {[code]....

The function will get called but I need access to the class's instance variables inside display().

View 5 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 2.0 :: Access The Variables Inside The Class Without Using _root.myComponentName.variableName?

Dec 11, 2006

i am creating my own component. the problem is how can i access the variables inside the Class without using _root.myComponentName.variableName.

[Code]....

View 1 Replies

ActionScript 3.0 :: Access A Public Function (main.as) From Main.fla?

Oct 8, 2010

If I have a main.fla and main.as (where I written a Main class).

How can I access a public function (main.as) from main.fla?

View 4 Replies

ActionScript 3.0 :: Import Other Classes Into Main Class Or Extend Other Classes To Main Class?

Aug 1, 2011

how to get a Class file up and going in Flash and that works fine but say I want to import other classes. I try "import testCass" above in my import statements section of my as file and that doesn't work. What do I have to do to get that to work?

View 6 Replies







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