ActionScript 1/2 :: Object Reference Between Two Classes?

Jun 28, 2011

classes. GiftMain and GiftItem. i attached GiftItem objects into GiftMain. Actually there are 2 more movieclips between them. i declare a variable in GiftItem as giftMain to reference it to the GiftMain. i have a function in GiftItem which is as below;

[Code]...
 
trace outputs the right object in this function in GiftItem class but at another place in the same class, it outputs undefined when it is traced even though it is global variable. I just want to reach GiftMain from GiftItem without using _parent or _root. How can i do that?

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Communicating Between Classes - TypeError: Error #1009: Cannot Access A Property Or Method Of A Null Object Reference

Oct 12, 2009

I have this error when I run the files.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.common::stageConfig()
at cloudsMain()
CloudsMain.as which is attached to the .fla

[code]....

Basically I'm trying to create a class that I can call and centralise any mc on stage by eg.stageConfig.centralisedDO(my_mc), However I encounter the above error.

View 2 Replies

ActionScript 3.0 :: [CS4] : Dynamic Reference To Classes?

Dec 9, 2009

Been trying to make the transition from AS 2 to 3 but not without it's speed bumps. My first major hurdle has been trying to dynamically reference a class by only knowing it's name. I came across the code of import flash.utils.getDefinitionByName; but that's not working for some reason. It keeps giving me the error:

Quote:

ReferenceError: Error #1065: Variable characterType5 is not defined.

My code in getting this is:

PHP Code:

import flash.utils.getDefinitionByName;
var className:String = "characterType" + 5;
var tempClass:Class = getDefinitionByName(className) as Class;
var char = new tempClass();

View 2 Replies

ActionScript 3.0 :: Reference Error, Creating Classes On The Fly?

Jun 28, 2009

I am trying to load the movie clips in my library one by one, using a for look and tween them but it seems as i am getting an error Stuff in my Library

6 movie clips
car_mc1
car_mc2

[code]........

View 13 Replies

ActionScript 3.0 :: Dynamically Reference Classes Inside Of Another?

Aug 6, 2010

Is there a good way to dynamically reference a class that is created inside of another class?

Say, for instance, I have a main class called "Country", and from that class, I am creating individual "State" classes. So the Country class is creating State classes named "Texas", "Ohio", and "Iowa". And each State class has a value called Capital. [code]...

View 3 Replies

ActionScript 3.0 :: Flash - Reference Movieclips Between Classes?

Jun 6, 2010

am trying to get a movieclip in one class to stay at the same x and y value of a movieclip in another class. the arm is meant to stay on the player's mc in armClass.as .here is the code.

Code:
package {
import flash.display.MovieClip;

[code]......

View 1 Replies

ActionScript 2.0 :: Custom Classes Keep A Reference In The Class

Dec 21, 2011

I'm adding many custom classes on stage using the object.registerclass trick. Those classes all implement the same interface so I can call common functions for all of them. My problem is that I have many of those custom classes for which I keep a reference in the class where I'm attaching them to the stage with attachmovie. So, in this parent class, if I do a for in loop like this:

[Code]...

View 4 Replies

ActionScript 3.0 :: Multiple SWF Load - Keeping A Reference To The Loader And The Classes Holding The Loaders

Jul 31, 2009

I'm loading a bunch of SWFs at the same time. I'm using a custom class to do the loading. Most of the time they all load OK, however occasionally one or two will be unloaded (I can see that in the console) before we get to the Event.COMPLETE. The ProgressEvents are all fine - I can see them loading, but then boom - they're unloaded.

I've done a bit of digging around and discovered that this may be a bug in the Loader class where if you are using multiple instances of the class then sometimes one or more will be Garbage Collected before they finish loading and are therefore unloaded. I've tried keeping a reference to the loader and the classes holding the loaders and I'm still having the problem. The solution is to queue the loads and load each swf in order which isn't a problem, just a bit irritating.

View 2 Replies

Flex :: Null Object Reference After Creating The Object?

Aug 22, 2011

I have one MXML File as

<objecthandles:ObjectHandles xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" backgroundAlpha="1" xmlns:mx="library://ns.adobe.com/flex/mx"

[code].....

View 1 Replies

ActionScript 3.0 :: 1195: Attempted Access Of Inaccessible Method Start Through A Reference With Static Type Classes:RollableChar.

Mar 12, 2009

This .as file was working fine yesterday and now Im getting this error.

View 3 Replies

ActionScript 3.0 :: Interacting Classes - 1119: Access Of Possibly Undefined Property DoWork Through A Reference With Static Type Class

May 12, 2009

I have two custom classes in the same package - sGallery and vChange - within sGallery how can I call a function thats inside vChange?

[Code]...

but gave me error: 1119: Access of possibly undefined property doWork through a reference with static type Class.

[Code]...

View 15 Replies

Actionscript 3.0 :: Classes - Error: 1119: Access Of Possibly Undefined Property Web2 Through A Reference With Static Type Class

Jun 29, 2009

I have a site with ScrollPanes, that are calling a Class on what to display. (so the movieclip that I want displayed in the ScrollPane has a Class name.) Within that movieclip (webScroll) that is being displayed in the scrollpane, I have 2 other movieclips (web1 & web2), with unique instance names and eventlisteners targeting those instances. when I preview my site, i get this error: 1119: Access of possibly undefined property web2 through a reference with static type Class.

View 1 Replies

ActionScript 3.0 :: Accessing Object - Error "Cannot Access A Property Or Method Of A Null Object Reference"

May 31, 2009

I have problem with accessing object created by function imported from another package.
I have 2 packages DragDrop and UserInterface. In UserInterface I create methods for buttons and later add them in DragDrop . I make it in two different ways:
One(this one works):

[Code]....

View 6 Replies

Reference An Object Itself?

May 5, 2010

I want to print the content of the label property in the Alert window.[code]...

But the Alert window is completely empty. What am I doing wrong ?

I guess the keyword "this" is referencing the application instead of the LinkButton, right ?How can I reference the LinkButton itself, without having to add an ID to all my linkButtons?

View 1 Replies

Professional :: Accessing Object Classes?

Apr 9, 2010

I have a project that i'm working on, and in the project it's important that i have an object that i can create with actionscript that already has two arrays inside of it. To do this, i made the movieclip, i checked export for actionscript in the library, and in the custom class that corresponds to that object i made the arrays with the following code:

package {
import flash.display.*;
public class cont extends MovieClip {

[code]......

View 6 Replies

Actionscript :: Constructor For Value Object Classes?

May 9, 2011

Is it OK to use the constructor to set properties for a value object class or must I use dot notation and set each one, one-by-one? I recently read an article that was saying I should do it one-by-one as value objects should only contain properties and went on to say using the constructor is not OK (best-practice wise).

Code:
("not OK")
var employee=new[code].............

View 1 Replies

ActionScript 3.0 :: Classes Object Cannot Be Added

Nov 25, 2010

I have 2 different classes that contains different object. And I control from another custom classes on when to load which class. The custom class will load a class when first run, and switch to another one when selected. My problem is, although I called the next class, but the object does not appear. The class that controls which to load

ActionScript Code:
package classes{
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.events.Event;
import classes.streamVideo;
[Code] .....

View 0 Replies

ActionScript 3.0 :: Classes - Every Object To Be Associated With Own MovieClip?

May 5, 2009

I want to make a flash movie with cars of different kind. Every car looks different and have their own specifications like weight, horse powers, top speed. So.. I want to create a class Car that can hold the variables weight, horsePowers, topSpeed and should be linked with a specific MovieClip (the car).

The problem is I cannot link all my MovieClips, holding the cars, to the same class Car.Should I create a container to associate with the class and then place different car MovieClips in them depending on which car object I'm creating? (so the MovieClip itself is sort of a variable)

Code:
package
{
import flash.display.MovieClip;[code].....

And then I create an empty container_mc and volvo_mc, audi_mc, opel_mc. container_mc is linked with Car

var theVolvo:Car = new Car ( 1230, 230, volvo_mc);

View 13 Replies

Actionscript 3 :: Get List Of Ancestor Classes For The Object?

Jul 3, 2011

I would like to check if object has a DisplayObject as one of it's ancestors and perform some operations on it if it has. Any quick and easy way to do this?

View 2 Replies

Actionscript :: Object (key-value) Use For URLRequest/Loader Classes?

Aug 19, 2011

I am trying to get my Actionscript program to turn in a key-value (more specifically: a key, value1, value2) object into a server. I am doing the html request properly, but I'm not sure what kind of object to send;

View 1 Replies

ActionScript 2.0 :: Functions In Object Oriented Classes

Aug 4, 2009

I'm new to the object oriented stuff and I'm trying to learn how it works. Here's what I've started on - it's led to a few dilemmas. I have one flash file and two .as each with one class. In the timeline of the fla file, it reads:
ActionScript Code:
var FileObject:ScriptFile = new ScriptFile();
function onEnterFrame(){
FileObject.CallInput();
}

Call input is a function in "ScriptFile.as" that calls another function in "Input.as";
ActionScript Code:
class Input{
public function Input(){
} public function keyListener(target:Number):Number{
[Code] .....

In output, when I press Left, it will say -5 over and over again, and I'm trying to add to xpos value but that isn't happening.

View 1 Replies

Actionscript 3.0 :: DispatchEvent For Classes Extending Object?

Mar 9, 2010

I've recently come to a roadblock in my code for a non-visual class I created; a sound class if you want to know. At first I coded with it extending Sprite (I can't remember why I started it out that way, but that's the way it was). When I came back to this code, I thought that extending sprite doesn't make any sense if it's an audio class and non-visual, where is no real reason to add something to the stage if you can't see it. So I removed "extends Sprite" from the class and errors started popping up around "dispatchEvent" coded areas. I then tried putting back the extention with "extends Object", hoping that would solve the problem; got the same thing. I've searched with google on why I can't use dispatchEvent on objects or classes not extending anything, but it only came up with how to use dispatchEvent with the usual MovieClip or Sprite tutorial.

View 3 Replies

Actionscript 3 :: Get An XML Object Reference Instead Of Value In It?

Nov 4, 2010

I need to get a pointer to a piece of XML. I can get a pointer to the parent node and everything works but trying to get a pointer to a node that has no children just returns the value of that node.[code]...

Tracing subNode would be just the value and there is no pointer to the original xml object, so editing the subNode var would only change its value, not the one in the original XML object.

How do I get a pointer to the subNode so it can be edited to change the original xml object?

View 2 Replies

ActionScript 3.0 :: Reference To A Class Instead Of Object

Feb 20, 2009

Is it possible to have a reference to a class instead of an object? [code]so that you can then use static vars of those Classes? from the var b?

View 3 Replies

Alignment Tool - How To Set Reference Object

Jan 1, 2010

I am new to Flash but have used Illustrator and InDesign for years. How to set the reference object by which all other objects are aligned; e.g. Illustrator ->select all objects then a second click on the reference object and all other objects take their cue. InDesign you lock the reference object and that determines the rest. In Flash it seems that either both objects move or the one that I wish to remain in position jumps rather than the other way around.

View 2 Replies

ActionScript 3.0 :: Get The Reference Of One Object's Parent?

Oct 21, 2010

i have classA and classB like bellow

class ClassA{
public var myVar:String="test";
public function ClassA()

[code].....

View 2 Replies

Flash - Getting A Reference To An Object From Within A .as File

May 31, 2011

I am modifying some Flex code written by someone else. There is an mx:text control that I want to change the 'text' property of. I know how to do this within the .mxml file in which the control is defined, however I don't know how to do this from within a separate .as ActionScript file. I recall in Flash there is some way to fully qualify the reference by prepending the stage or something like that

View 1 Replies

Actionscript 3 :: Keep Both Object And Reference On Stage?

Jun 16, 2011

I have some object, which extends movie clip:public class MyClass extends MovieClip Now, I want to put two of this in the stage:[code]That would put one, but the other I want it to be exactly the same as the first, so I just need to add a "reference" of obj to the stage, along with obj itself.In the end, I want two objects of type MyClass doing the same thing in the stage. If I try to simply do:[code]only obj2 will appear in the stage.How could I achieve that with references? (in order to save memory and CPU time (it is really important))

View 6 Replies

Flex :: Object Reference Through Variable Value?

Dec 29, 2011

Is it possible to reference an object using a variable value?

For example, I have a function that is supposed to hide an image and add that image to an inventory list when the item is clicked.

All the image info is stored in an object (name, imgSource, visible, x, y);

I was thinking I could do something like this:

<fx:Script>
<![CDATA[
public var item:Object = new Object();

[Code].....

I want "item" to stand for knife so that I could change knife.visible, knife.xPos, ect.

View 2 Replies

ActionScript 3.0 :: Get Object By Memory Reference?

Dec 18, 2008

When debugging, I see an objects memory reference next to its value. Is it possible to get that as a string or assign a variable based off memory location?

var myInt:int = 5; debugger shows(@afff222)
var copy:int = memor(@afff222);

View 2 Replies







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