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


Similar Posts:


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.0 :: Reference The Stage From A Custom Class

Feb 6, 2009

I have created a custom class that extends the movie clip on frame 1 of the main timeline I create it var mainBox2:mainBox = new mainBox(); addChild(mainBox2); Now as I understand it you have to cast the parent as a MC so in the constructor of my external class I try this var myStage:MovieClip = MovieClip(this.parent); trace (myStage); I get null. What am I doing wrong?

View 1 Replies

Data Integration :: Loading XML Using A Custom Class And Accessing It From Other Classes?

Aug 30, 2006

I began with a class for a movie clip rollover function FigureRollOver. It works marvellously. Three things happen:

1) it loads XML from a file "mod1_fig1.xml" and uses another class, XMLMember, to retool the scoping of the XML so that I can get at it

2) an onload call inside of XMLMember calls the myOnLoad function and transfers the XML into an array.

3) so long as the array is finished building, rolling over a movie clip attaches a new movie clip with the rollover text in it.But I don't want all those functions in one because I need it to be more dynamic, starting with being able to load any old xml file instead of just "mod1_fig1.xml", plus it seems lik overbuilding to have all of that in one class, so I've separated out the loading of the XML and building of the array into its own class, FigureXMLLoader. FigureRollOver is then left to just attach the rollover with text in it, extracted from the array built by the new class.

Problem is, though the array builds inside FigureXMLLoader, I can't figure out how to make it available outside the class. I know that I'm constructing things in the wrong order, and that the array needs to be somehow built inside the class function to be available, but I can't figure out how to do that. A cruddy work-around is to put a function call at the end of the building of the array, which calls yet ANOTHER function on the main timeline of my .swf to put the array I've just built into a new variable.This works, but it's messy. It seems like I should be able to have one line of script in the .swf that generates an array on the main timeline (or just a public array) which I can then access from my FigureRollOver class:

var myRollOvers:Array = new FigureXMLLoader("mod1_fig1.xml");

Here is FigureXMLLoader (see comments in the code for more details) which obviously does not return an array as it is, because of all the working around I've had to do. Note the "testing" variable, which can be traced from the main timeline of the .swf, but I will get "not what I want" because of course the array hasn't been built yet, and never will be, inside of the declaration as it is. How do I get it in there so I can return an array?

View 2 Replies

ActionScript 2.0 :: Define A Custom Class To Be An AsBroadcaster In The Classes Constructor?

Feb 22, 2007

Can I define a custom class to be an AsBroadcaster in the classes constructor?

Code:

class myClass{
function myClass(){
AsBroadcaster.initialize(this);
}
}

And if so will that give me the ability to addListeners to an instance of that class?

The reason I want this approach is because I want to broadcast events from inside one of the custom classes methods and I want a textField on the stage to be listening for that broadcast message.

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 :: Loading Swf As Custom Class That Extends MovieClip - Getting Null Object Reference

Aug 16, 2011

I followed the example from a previous question and I am loading an external swf using a loader and inside the loader event handler I am trying to cast the loader.content as my custom class PanelReferenceClip which extends MovieClip

When I publish I receive a this error:

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

Just to make sure and test that the swf location was correct and the swf was actually being loaded, I changed the type of the content to as MovieClip and it worked fine.

EDIT: I also wanted to add that these swfs are being stored locally and not being pulled across the internet, multiple networks or servers.

I am not sure if I did something quirky in my class so I am providing the source to my custom class PanelReferenceClip

package com.components
{
import com.UI.DevicePanel;
import flash.display.MovieClip;

[Code]....

View 3 Replies

ActionScript 3.0 :: Custom Base Classes And Custom Classes

Jun 25, 2009

I've created a base class to house some basic functions I'd like to have across several movie clips in a game I'm making, however, when I link a custom class to the same movie clip I get the message; "The base class will not be used because the class specified is already defined and extends its own subclass. If you wish to use the base class, specify a class name in the Class field that will be auto-generated or enter the default base class 'flash.display.MovieClip' in the Base Class field." I removed the 'extends MovieClip' inside the Class but it still shows the message. Does this mean that I cannot use a custom class and a custom base class on a movie clip?

View 2 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

ActionScript 3.0 :: Create A Custom Class That Extends The MovieClip Class And Contains A Custom Property Of "marker"

Jan 23, 2010

I am new to AS3, as well as Flash in general, so forgive me if this seems highly elementary. All I am trying to do is create a custom class that extends the MovieClip class and contains a custom property of "marker". I want to be able to use and change the value of this custom property on the timeline for an instance of this class and have it behave just like any other (Ex: this.x ==> this.marker).

[Code].....

View 13 Replies

Actionscript 3 :: Passing Custom Class As Parameter To Custom Class Where Parameter Class Not Constructed?

Jun 16, 2011

I have a custom class being constructed from my main class. In the custom class it has another custom class that is passed in as a parameter. I would like to strictly type the parameter variable but when I do, 'the type is not a compile type constant etc'.This, I understand, is because the custom class used as a parameter has not yet been constructed.It all works when I use the variable type ( * ) to type the parameter.I suspect this is a design flaw, in that I am using an incorrect design pattern.It is actually hand-me-down code, having received a large project from someone else who is not entirely familiar with oop concepts and design patterns.

I have considered using a dummy constructor for the parametered class in my main class but the passed in class also takes a custom class (itself with a parametered constructor). I am considering using ... (rest) so that the custom classes' parameters are optional.Is there any other way to control the order of construction of classes? Would the rest variables work?edit)in main.as within the constructor or another function

var parameter1:customclass2;
customclass1(parameter1);
in customclass1 constructor:

[code].....

View 1 Replies

ActionScript 2.0 :: [FLASH CS5] Custom List Class That Manages Custom List Item Class?

Dec 2, 2011

This is my first time working with a class attached to a movieclip that is nested inside a class attached to a movie clip.I've tested all the properties and methods of PTListItem.as and they work properly but when I try to call them on the list item through PTListTop.as it returns undefined.The end goal is to dynamically load a checklist via a txt file.

View 1 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 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

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

IDE :: How To Add Custom Classes

Apr 8, 2010

I use multiple custom classes like tweenlite, csvparse, papervision and many more. The way I do is put them in one central location and edit Flash CS4 Actionscript 3.0 settings to include that location.The problem I face is even though I don't use all the classes in a project, flash CS4 compiles every single class that is in that central location eventually increasing my compile time by minutes.

View 5 Replies

Actionscript 3 :: Flex 4.5 Not Listening To Custom Event Dispatched In Custom Class?

Nov 4, 2011

I have the following situation:I have an event handler, that displays small messages in my application's statusbar.These messages get passes through by dispatching events from custom components.A simple message could be like "HTTP Error" or so.Now, the main event listener, in the main application file, listens to the event dispatched by any custom component,but seems to refuse listening to events dispatched by custom AS classes.Here is my code for the custom event:

package main.events
{
import flash.events.Event;[code]..

So to sum it all up:

- The event listener listens to the custom event dispatched by any custom component.

- The event listener does not listen to the custom event duspatched by an AS class.

Those who wonder, the event really gets dispatched, that's why I added a trace call.

View 2 Replies

IDE :: Get A List Of Custom Classes?

Aug 26, 2009

Is there any way to get a list of custom classes? I'd like to be able to dynamically access the custom classes (that I've created by the "Export for Actionscript" checkbox in the "Linkage" dialog) without having to hard-code their names into the script.

View 2 Replies

Flex :: Access A Custom Property In A Custom Class?

Jan 25, 2010

I couldn't work it out yet...

package components {
public class templateSelection extends VBox {
static public var tempSelectionBag:Dictionary;

[Code]....

I want to have a custom class tempSelection with a Dictionary as a public accessable property of that class. If I use this code, the compiler tells me:

1046: Typ wurde nicht gefunden oder war keine Kompilierungszeit- onstante:Dictionary

Which translates to:

Type was not found or was not a compile-time constant: Dictionary

View 1 Replies

ActionScript 3.0 :: For Each Loop And Custom Classes

Jun 5, 2009

[code]This is my document class, with the Textfields beeing placed on stage.While this all compiles and displays fine I do not get the trace output for the text fields, actually the only trace I get is "constructing". I tried it without the "each" keyword but to no avail as well.

View 3 Replies

ActionScript 3.0 :: Custom Template Classes?

Jul 26, 2009

I'm looking to extend Vector.<T>, but it's final, so I'm going to have to include it as a member instead.Regardless, I'd like to make the wrapper class type independant, so I was wondering what the snytax for template classes are.

View 6 Replies

ActionScript 3.0 :: Iterate Through Custom Classes?

Dec 26, 2009

Lets suppose, I have a class with so many public properties

class person{
public var address:String;
public var name:String;
public var fathername:String;
//etc etc
}
 
Now i want to iterate over them in a simple way like
 
for (var key:string in person){
trace("property is " + key + " and value is " + person[key]);
}
 
But AS3 doesnt allow this to do with Classes
 
what would be the better and simple way to iterate over them as i dont want to do so many if(else) on it.

View 8 Replies

Actionscript 3 :: Getting Data From Custom Classes?

Oct 27, 2010

How can I get some var / data from a custom classes?The XML class

package classes
{
import flash.net.URLLoader;

[code].....

View 3 Replies

ActionScript 3.0 :: Custom Classes Talking To Each Other?

Aug 28, 2009

i'm still in the process of grasping my move from AS2 to AS3 (or from timeline coding to external classes), and here's a problem i've run into.i have two classes, for the sake of easiness, call them Class1 and Class2.in frame 1, if i have

ActionScript Code:
var c1:Class1 = new Class1();
var c2:Class2 = new Class2();

[code]....

View 4 Replies

ActionScript 3.0 :: Communicating With Other Custom Classes?

Sep 10, 2009

How do I let a custom classes know, what I've done at other classes,so that it would run an action accordingly?a function in the button classes:

ActionScript Code:
public function btnClick(event:MouseEvent):void {
var zoomF:theZoom = new theZoom();

[code].....

View 2 Replies

ActionScript 3.0 :: Extending To Custom Classes?

Dec 14, 2010

Say I have a document class called index, where I set up some variables and methods and include a class.

I get this error:

Error: Error #2136: The SWF file file: index.swf contains invalid data.
at com::index/initIndex()
at com::index()

[Code]...

View 2 Replies

ActionScript 2.0 :: [FMX] Buttons And Custom Classes

Sep 29, 2005

I'm trying to get a button to change color via a Custom class written in ActionScript. I have built and attached an example to show you all what I'm trying to achieve. The code works perfectly with a MovieClip, but when I try to apply it to a Button, it falls flat (can't even find the reference to the button it seems). On my stage are two objects:

1. A Movie Clip
2. A Button

These are both set to "Export for ActionScript", and have an attached class called 'ColorClass'. ColorClass is basically what does all the work (makes a Color object, and has set and get methods). I also have an action layer where all my other code is contained. I'm fairly new to ActionScript, but come from a Java background

View 1 Replies







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