ActionScript 3.0 :: Public Vars From Object Class In Timeline?

Mar 16, 2012

I've made a Horizontal Bar Class which controls an element in library.So I have:Library: HorizontalBar MC - Using class HorizontalBarThis class has some public vars.Library: ContainerGame MC - Using class ContainerGameWhen I add this element to stage (HorizontalBar) inside ContainerGame MC I want to be able to trace public vars from its class inside ContainerGame.

View 2 Replies


Similar Posts:


ActionScript 3.0 :: Do All Vars In Super Class Need To Be Public

Apr 8, 2009

Do all variables and functions in super class, that I want to access from a sub class need to be set as public?

View 2 Replies

ActionScript 3.0 :: Public Class Extends Object

Jul 22, 2010

I'm trying to have a class that is an Object to hold details about the movieclip that it is attached to.

[Code]....

and two others of this nature. I didn't think you had to declare the 'key' of the object as a variable before setting it in the Object. So my guess is that it is angry about the class itself, somehow. (syntax or the like)

View 2 Replies

ActionScript 3.0 :: Public Vars With Bracket Sintax?

Aug 2, 2009

I would like to create a collection of movieclips in the main timeline, but would like to declare them in a loop instead one by one, something like this:

Code:
for (var zz=1;zz<=10;zz++)
var ["mc"+zz]:MovieClip = new MovieClip();
Instead:[code].....

I know that my sample doesnt work,

View 3 Replies

Actionscript 3 :: Access A Public Property From AvEniroments Class Through The Player Class?

Nov 24, 2011

I have the following inheritance structure:

var environment:AvEnvironment = new AvEnvironment(...);
addChild(environment);
environment.addChild(new Terrain());
environment.addChild(new Player());

I am trying to access a public property from AvEniroments class through the Player class, however I'm getting an undefined property error (#119). I've tried the following:

this.x = AvEnvironment.xs // public property in this class
this.x = parent.xs

I've also tried something like this:

var ev:AvEnvironment = AvEnvironment(parent);
this.x = ev.xs

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

View 1 Replies

ActionScript 2.0 :: Load Vars From A Text File Into A Load Vars Object?

May 19, 2005

i am trying to load vars from a text file into a load vars object.

var kitchentext = new LoadVars();
kitchentext.load('moccastext.txt');

Once in the object, i thought i could reference them like so

kitchentext.name
kitchentext.style

but i am having trouble doing this.

i have a textbox called displytext.

_root.displaytext.text = kitchentext.name;

doesnt work

View 3 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.0 :: Linking Class With Stage Object And Timeline?

Feb 13, 2009

I've just started using classes while developing my basic platform game in Flash AS3.

On the stage I have a character, instance name 'ball_mc'. I have AS in the time line which controls the characters movements.

I have an external AS file named 'Ground.as' which is basically an ENTERFRAME hittest which stops the character from moving when the character 'hits' the ground.

I have placed a rectangle MC on the stage to represent the ground and linked it to the external AS file 'Ground.as'

The Code for Ground.as is as follows:

package
{
import flash.display.MovieClip;
import flash.events.Event;

[Code]....

View 6 Replies

Flash :: Reference Var From Frame On Timeline In An Object Class?

Jan 17, 2011

I'm using Flash Professional cs5/AS3 I'll try and describe this the best I can. I'm new to ActionScript. So, in my timeline I have a var on a frame that represents "lives" and i have some code in the timeline that takes down the number of lives depending on certain events, which all works great.

so, now i wanted to make a constructor class that I could reuse for a bunch of movie clip objects and I only want these objects to be able to move if the lives variable is greater than certain number. So now, building my constructor class for these objects i just wanted put an if statement that is looking to see if the lives are greater than a certain number, which if it is then should make these objects do what i want...But, when i run the project I get "1120: Access of undefined property lives."

lives is the var I made obviously like I said, and it works fine being referenced everyone else except when I make a new .as file for these objects then try and reference it. I get the same error when I try and establish "lives" in the main project class too. I'm not sure where I should put this var or how I can make it so i can reference it from an object class. I'm not really sure how to word or describe my issue which has made it hard to search for a tutorial.

View 3 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 :: Class Created Object To Array In Main Timeline?

Jan 16, 2011

class created object to array in main timeline?

View 1 Replies

ActionScript 3.0 :: Sharing Vars Between Document Class And An Imported Class?

Jan 27, 2009

I've been sorting through the XML docs and i've bumped my head into a bit of a question. So, to preface, I have been able to load the XML successfully, but I want to be able to use my own XML loader class to load the XML and then be able to reference it from the document class. Also, I'd like to be able to send a file path to the loader class when I call it.

The document class:

ActionScript Code:
package rg.sites{
// flash classes

[code]....

View 8 Replies

Using Public Variable From Document Class

Jun 9, 2009

I've created 2 public variables in my Document Class...
 
public var _wall1:Wall=new Wall();public var _wall2:Wall=new Wall();I've then added them to the stage and given them relevant instance names...
  
stage.addChild(_wall1);_wall1.x=32; _wall1.y=510;_wall1.name = "wall1";I then want to use these variables in another Class (Ball.as). They need to be accessed in a function within the Ball Class constructor.
  
function bubble(event:Event):void{if(this.hitTestObject(_wall1)){    this.x += 1;}else if(this.hitTestObject(_wall2)) {    this.x -= 1;}However, the following Error message keeps appearing...
  
1120: Access of undefined property _wall1.1120: Access of undefined property _wall2.Any pointers? Do I need to import something into the Ball Class to point to the _wall# public variables in the Document Class?

View 1 Replies

ActionScript 3.0 :: Have A Class With Public Function?

Jan 14, 2009

Is it possible to have a class with a public function [code]...

View 8 Replies

ActionScript 3.0 :: Change The Value Of A Public Variable From Another Class?

Sep 7, 2010

I have a simple problem. I have two document classes. One is Main.as the other is Step2.as. I want to declare a public variable in Main.as then need to give it a value from Step2.as. That value will later be used in my next Document class Step3.as How would I write the code that gives the value in my Step2.as and then how would I write the code that retrieves the value in my Step3.as?

Note I can't import my Step2/ or Step3 document class into my Main.as.

View 3 Replies

ActionScript 3.0 :: Assigning A Number To A Public Class?

Oct 12, 2011

Here is my code:

package
{
import flash.display.MovieClip;
public class Derp extends MovieClip

[code]...

What I would like to do somehow assign a number or word variable to display one of the public classes on the screen instead of all of them at once.

View 1 Replies

Actionscript 3 :: Use MouseEvent For Getting Object`s Public Variables?

Sep 5, 2011

I have a simple problem which is not easy at the moment. this is a text field class which add a text field to a movieclip (passed from root class) and also save(buffer) some data (like xml file name) in it`s public variables:

package src {
import flash.display.Shape;
import flash.display.MovieClip;[code]............

.. now I use a for loop to add instance of that class to a movie clip on stage:

for (var i:int = 0; i<Bunker[0]["trans0size"]; i++) {
menuData[i] = new menuitem00(i, menu_mc, Bunker[0]["transfile0" + i]);// pass i , a movieclip named menu_mc and an xml file name
menuData[i].name00 = Bunker[0]["transtitle0" + i]; // pass text
menuData[i].activateFlag = true; // set actveFlag to true
menuData[i].init(); // run init() inside the instance. it adds textfield to the menu_mc and also set name00 as Text for the textField
}[code].........

I want to get "xml00" var from that instance on the stage by mouse click but, trace (evt.target.xml00); is not working .. also trace (evt.target.name00); is not working. I can get everything like .alpha or .text from txt00 but not other variables in my object.

View 1 Replies

Flash :: AS3 - Access Class Public Var From Inside Fla File

Oct 24, 2011

I have searched for this everywhere but it seems like every answer is either overcomplicated or simply does not work, and I know for sure there should be a more simple way of achieving what I need. So, until today, I have always coded from within the timeline. But now I realise why I should code in separate class files. However, I still want to include snippets of code in the timeline for simplicity's sake.

[Code]....

View 2 Replies

ActionScript 3.0 :: Externally Override Public Function Of Class?

Aug 2, 2010

Is it possible to externally override a public function of a class (as opposed to override via inheritance)?

For example:

Code:
Class Foo {public function doFoo():void {trace ("Foo");
}
}
Such that:

[Code]...

I know this is possible in JavaScript and ECMAScript, but the compiler won't let me get away with this kind of mischief in ActionScript, from what I've seen: It barfs up a 1168 Illegal Assignment error as soon as I attempt to assign a new function to doFoo.

I'm thinking specifically in terms of a "hot fix" solution where you deploy a small swf that replaces a specific chunk of code in a larger application, without the need to recompile/deploy the full application (or even see the sourcecode for that matter, just know the API).

View 9 Replies

ActionScript 3.0 :: Public Class Mbutton Extends TextField?

Nov 16, 2010

why can I not return this into my main as var btn1:Mbutton = new Mbutton(30, 30, "1");addChild(btn1);?

my class is:
ActionScript Code:
package
{
import flash.text.TextField;

[Code]...

View 1 Replies

ActionScript 3.0 :: Access Public Var/functions In The Document Class?

Mar 27, 2011

How do I acsess public var/functions in the document class?

View 7 Replies

ActionScript 3.0 :: Pull A Variable From A Public Function In Class?

Aug 7, 2009

What would be the scoping to reach a variable within a external class public function FROM a function on the main timeline?In menu.as public function buttonClick()Need to reach a starFunction variable(var starFunction = such and such.@fn) within an if statement within buttonClick function.On main timeline(menu.as declared on first frame main timeline as var menuH:Menu = new Menu()In function aboutUs()here is where I need to use that variable for an if statement

View 1 Replies

ActionScript 3.0 :: Create A Global Vars On The Main Timeline And Change It Within Another Movie Clip

Oct 28, 2009

I need to create a global var in AS3 so that I can create the var on the main timeline and change it within another movie clip.

View 3 Replies

ActionScript 3.0 :: Unable To Access The Public Properties Of Custom Class

Nov 28, 2008

i wonder why i am unable to access the public properties of this custom class the public var w:Number; and the Public var h:Number; i am tracing them and on an instance of the PreLoader() Class.. and ia m getting NAN;

View 12 Replies

ActionScript 3.0 :: Multiple Internal Classes With An Extended Public Class?

Jan 9, 2010

If I have a class that extends another, e.g.,
 
package {
import flash.display.Sprite;
public class MySprite extends Sprite{

[Code]....

and extend that class, if more than one internal classes are defined:
 
package {    
public class MainClass extends MySprite {         
public function MainClass():void{}   

[Code]....

ReferenceError: Error #1065: Variable MainClass is not defined.Note that this only happens (as far as I can tell) when the public class of the package extends another class, and multiple internal classes are defined. The internal classes don't even need to be instanced or referenced to generate the error (the bare-bones code above will error out). If only a single internal class is defined, it works fine (no error).  Even if the internal class is instanced.

View 11 Replies

ActionScript 3.0 :: Know Public Method's Call Has Been Made From Outside / Inside Class?

Jul 16, 2009

I 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 Replies

ActionScript 2.0 :: Difference Between Private And Public Method In Custom Class

Jun 12, 2007

I have this sample class
Code:
class TestPrivate{
public function TestPrivate(){};
private function getGo(){
trace("can execute");
}}

And then after instantiate I just calling the method...for testing the "public" and "private" keyword purposing only...

Code:
import TestPrivate;
var obj1 = new TestPrivate();
obj1.getGo();

The result is still can be execute even though I put the private keyword in front of the methods. So what's the private keyword stands for actually...I thought it prevent been get accessed from outside...

View 2 Replies

ActionScript 3.0 :: Passing Flashvars Into Public Class And Assign This String As Path To XML?

May 29, 2010

I am trying to pass FlashVars into public class EventDispatcher to set the path to data.xml. I need it because the name and path of the xml file will be dynamically created. I need to use Flashvar in order to access the correct path.I was able to pass Flashvar from html page on timeline this way:

Actionscript Code:
var Flashvars:String = LoaderInfo(stage.loaderInfo).parameters.xmlfile;

Then, I was able to use it with new UrlRequest;

Actionscript Code:
var request:URLRequest = new URLRequest(Flashvars);

This method works really good, but this solution only works on timeline.I need to implement this technique in the class. Before I setup a static var for with the path to xml file. I'd like to be able to get FlashVar withing this class and assign this string to 'public static var DATA_XML_URL:String' I have there. This way I can pass Flashwar to the project I already have.

Actionscript Code:
import flash.events.Event;  import flash.events.EventDispatcher;  import flash.display.Sprite;  import flash.display.LoaderInfo;  import flash.display.MovieClip; import flash.display.Stage;public class ConfigManager extends EventDispatcher {

[code]....

View 3 Replies

Actionscript 3 :: Overriding Public Method In Dynamically Loaded Class And GetDefinitionByName()

Aug 22, 2010

I have two SWFs: main.swf and external.swf. main.swf needs to access some methods in external.swf, so it loads external.swf into itself and uses getDefinitionByName("package.Class") to access the class and one of its methods:

var ExternalClass = getDefinitionByName("package.Class") as Class;
var ClassInstance = new ExternalClass();
var NeededFunction:Function = ClassInstance["NeededFunction"] as Function;
var response:String = NeededFunction(param);

Now, I need to extend the functionality of NeededFunction (which is a public method)... I know it's possible to override public methods, but how would I go about this with a dynamically loaded class?

I was thinking I could do something like this, but it doesn't work:

var ClassInstance["NeededFunction"] = function(param1:uint):String {
var newString = "Your number is: "+param1.toString(); //New functionality
return newString;
}

View 2 Replies

ActionScript 3.0 :: Pass FlashVars Into Public Class / Assign String As Path To XML?

May 29, 2010

I am trying to pass FlashVars into public class EventDispatcher to set the path to data.xml. I need it because the name and path of the xml file will be dynamically created. I need to use Flashvar in order to access the correct path. I was able to pass Flashvar from html page on timeline this way:

PHP Code:
var Flashvars:String = LoaderInfo(stage.loaderInfo).parameters.xmlfile;
Then, I was able to use it for new UrlRequest;
PHP Code:
var request:URLRequest = new URLRequest(Flashvars);

This method works really good, but this solution only works on timeline. I need to implement this technique in the class. Before I setup a static var for with the path to xml file. I'd like to be able to get FlashVar withing this class and assign this string to 'public static var DATA_XML_URL:String' I have there. This way I can pass Flashvar to the project I already have.

Below is the class where I can implement it:
PHP Code:
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.display.Sprite;
import flash.display.LoaderInfo;
import flash.display.MovieClip;
[Code] ......

View 3 Replies







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