ActionScript 3.0 :: Get The Reference To The Class That Created Mc?

Jul 8, 2010

I have:

Code:
// a class
package
{

[Code].....

how to get the instance of AA that created this mc the_class.big_function( ) ;

View 9 Replies


Similar Posts:


Actionscript 3 :: Reference From The DocumentClass A Movieclip Created By An Instance Of Another Class

Aug 21, 2011

I have this main (document class) in a Flash project:

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

[Code]....

Now: if I pass a reference (ref) of the main class to Other and I add clippo as you can see in the first case, I can reference the movieclip clippo from the main (getChildAt(0) is "clippo" from the main). But, is there any way to use the second method (no ref) and do the same from the main class? I can see clippo onstage when Other creates it but I can't understand where clippo "lives" into the DisplayList.

View 2 Replies

Reference Instances Created By A Loop Elsewhere?

Jan 20, 2010

[code]My code will:

- loop through the Grid array and place each tile on the stage

- assign RedBall a random Grid coordinate and places it on the stage at that coordinate

I want to be able to click RedBall, which will create a border around the tile beneath RedBall, and create borders around the tiles above, below, to the left and to the right. BUT, I don't want to reference the tiles by their distance in pixels from RedBall or from each other; I want to reference the tiles by their coordinates in the Grid array. So I want to:

- get the coordinates of RedBall

- use those same coodinates to reference the tile at the same coordinates in the Grid array

- use the tile's coordinates to reference the tiles above/below/left/right

- apply a border to all these tiles

What's the best way to reference an instance of a tile? Should I apply a name to each instance as it's created in the loop? like myTile.name = "tile"+i+"_"+j; ? If so, how do you reference that instance later? Just tile1_3 ? Do you have to prepend it with root, or stage, or the class it was originally created in? Do you have to use getChildByName? OR, can you still reference it later without having given it a name?

View 1 Replies

ActionScript 3.0 :: Reference Instances Created By A Loop Elsewhere?

Jan 20, 2010

My code will:

- loop through the Grid array and place each tile on the stage
- assign RedBall a random Grid coordinate and places it on the stage at that coordinate

I want to be able to click RedBall, which will create a border around the tile beneath RedBall, and create borders around the tiles above, below, to the left and to the right. BUT, I don't want to reference the tiles by their distance in pixels from RedBall or from each other; I want to reference the tiles by their coordinates in the Grid array.So I want to:

- get the coordinates of RedBall
- use those same coodinates to reference the tile at the same coordinates in the Grid array
- use the tile's coordinates to reference the tiles above/below/left/right
- apply a border to all these tiles

What's the best way to reference an instance of a tile? Should I apply a name to each instance as it's created in the loop? like myTile.name = "tile"+i+"_"+j; ? If so, how do you reference that instance later? Just tile1_3 ? Do you have to prepend it with root, or stage, or the class it was originally created in? Do you have to use getChildByName? OR, can you still reference it later without having given it a name?

View 3 Replies

Flex :: Get The Reference To A Newly Created Button With Actionscript?

Mar 11, 2010

I have a MXML button:

<mx:Button id="myButton1"/>

How do I create N number of Buttons with Actionscript: myButton2, myButton3, myButton4... myButtonN ?

And how to get the reference to the newly created buttons right after they are created? Like I should be able to do myButtonN.x = 100 right after it's created.

View 1 Replies

ActionScript 3.0 :: Reference A Variable Created In A DocumentClass, Via The BaseClass Of A MC

Mar 2, 2012

I have some movie clips in the library of a FLash file, which has a document class. The movie clips in the library are set up (via Linkage) to have a BaseClass. The document class creates containers for the movie clips, which are created by a timer. The base class has a click event that removes the movie clips. My problem is, how to reference the container that's created in the document class, when i want to do so from within the base class.

View 9 Replies

Actionscript 3 :: Flash CS5 Reference A Display Object From A Class Other Than The Document Class

Jul 28, 2011

Using Flash CS5 Professional I have created a symbol, dragged it onto the stage, and given it an instance name of GreenLight1. If I want to make this visible from the document class, I can simply do the GreenLight1.visible=true; and poof it's good to go when I test the file. As long as I stay in the document class I am good to go, but now I'm trying to move to another class and hitting ALL kinds of trouble just trying to get Flash to allow me to access this simple object. All I am looking to do is have this GreenLight1 go invisible (visible=false) when a certain condition occurs in this new class and Flash just won't let me access GreenLight1 at all. Things I've tried thus far:

stage is passed to the class and is referenced by _stage and is working just fine when I do _stage.addchild or anything like that. So I have tried "_stage.GreenLight1.visible=false;" and I get "ReferenceError: Error #1069: Property GreenLight1 not found on flash.display.Stage and there is no default value." My document class extends Sprite, so I figured I'd try the root function. So I tried "Sprite(root).GreenLight1.visible=false;" and I get "1119: Access of possibly undefined property GreenLight1 through a reference with static type flash.display:Sprite." I tried to create the Resource class as described therein. To which I came across the same problem that I started with in that it doesn't know what GreenLight1 is to begin with so I got "1120: Access of undefined property GreenLight1." Here is my code for Resource.as (am I supposed to pass something to this class from the document class?)

[Code]...

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

Flex :: Difference Between Class Reference And Class Instance?

Jun 28, 2010

Given that both of these calls to getQualifiedClassName return the same thing (mx:Label), how would one go about programatically differentiating between an instance of a class and a reference to the class...

var lab1:Label=new Label();
var lab2:Class=Label;
var qcn1:String=getQualifiedClassName(lab1);
var qcn2:String=getQualifiedClassName(lab2);

In other words, how could I know that lab1 is of type Label, while lab2 is type "Class". typeof() simply returns "object" for both... getQualifiedClassName returns "mx.controls::Label" for both...

View 3 Replies

Flash :: Use A New MovieClip As A Class Or To Copy It Without Reference To Its Class?

Jul 21, 2011

I am doing a looping background with 2 identical BG movieClip (B1 and B2). Those 2 are "new" by the same class.

var B1:MovieClip = new BG();
var B2:MovieClip = new BG();

But because this BG class picture is loader from the internet and the picture is rather big. When I addressed its loading by using progressEvent. The picture is really loaded 2 times. Is there anyway I create B2 based on B1 without using new BG() again? Since it definitely makes a new BG with Loader code inside.

[Code]....

View 2 Replies

Actionscript 3 :: Pass A Reference To Class Into Another Class?

Jan 8, 2012

The question is a bit silly. I am trying to implement a skill updating system. So to explain.There is a class

class AppInfo
{
public static var power:int = 10;

[code]......

View 3 Replies

ActionScript 2.0 :: Get Var Reference To Instance Of Class From Within The Class?

Mar 15, 2006

I want to retrieve the var reference of an instance of a class from within the class. For example:

ActionScript Code:
var ref:MyClass = new MyClass ();
//then via some method, I would like to get the var ref inside the class
ref.getRef(); //returns "ref" instead of [object Object]

[Code]....

You may ask why, well I want to do some spring cleaning inside this manager class I am making. Of course the above is a simplistic version of what I am trying to do.

View 2 Replies

ActionScript 2.0 :: Self Reference To A Class Instance Within A Class?

Jan 7, 2005

how can I self refer to an instance of a class within the class definition file?Here is an example

PHP Code:

public function fireBullet(target:MovieClip) {
Bullet_mc = target.attachMovie("Bullet", "Bullet1", 1);
}


Now everytime I want to call the function I have to put this as my target, (fireBullet(this))I cannot just put it in the code as it gives me an error.

View 9 Replies

ActionScript 2.0 :: Create A Custom Class (Testing) That Would Create A Box When An Instance Of The Class Is Created

Aug 29, 2007

I've been playing around with custom classes. My objective was to create a custom class (Testing) that would create a box when an instance of the class is created. I've tried three different approaches, however only (3) seems to be showing up. I'm just curious why (1) or (2) doesn't work?

Also is there a better approach than (3)? Since at the moment it's been created on _root. I hope the box can only be accessible through the instance. Since I'd like to incorporate the whole idea of public, private, encapsulation, etc.

[Code]...

View 3 Replies

ActionScript 3.0 :: Create And Reference Dynamic Variables Created With "for"?

Aug 3, 2009

I am building a Gallery/Case Study application and I am running everything off of XML, and I need to be able to add images/text to the application whenever, without causing any problems. On the sideshow portion of the application, I am putting dynamically generated textfields under the picture viewer, with the number of the current image, highlighted. Similar to the one here:[URL] the first slide haha this was one of the best examples I could find. Anyway I've created the textfields, that display the correct numbers (that is, from "01" until say "07" depending on the .length(); of the XML tag <image>), but that is all they do so far. I am setting the type in the textfields by doing this

Code:
_tf.text = "0" + myIndex as String

myIndex is a varibale incrementing as long as var i:Number is less than the length property of the XMLList I'm using to store the image URL's. I am adding the _tf var to the stage using addChild(); and multiplying i by like 20 or something to make the x values different for every _tf. My problem is that if i try to reference the myIndex value when the textfield is clicked, it says the value of myIndex is 7, which is what it was set to when the last iteration of the loop executed. Basically I need to be able to store a value somewhere, that is unique to each textfield so I can load the corresponding image from my XMLList. I've tried messing around with the .name property of MovieClips, but I'm not exactly sure how it works. I use it earlier in the code with my Loader instance, but I don't know how to use it with MovieClips.

View 2 Replies

Know What Class An Instance Is Created From?

Jan 16, 2011

In actions script 3.0 I would like to retrieve the class of two instances and then compare them. Is there a way to know what class an instance is made of?

View 1 Replies

Professional :: Scope Of Class Created In Flash?

Sep 14, 2010

What is the scope of a class created in Flash? If you create a class on the main timeline, can you use it anywhere in your project? If you use your class in a a movieclip, can you use that class outside of the movie clip?

View 3 Replies

Actionscript 3 :: Determine If The Class That Will Be Created Is A Children Of Another?

Jan 28, 2011

For this example, I will use 2 classes, Entity and CSpawner. CSpawner is a children of Entity.I want to perform the following condition:if((new CSpawner()) is Entity)It works just like intended.But I want to do this test, without creating a new CSpawner object, something like this:if(CSpawner is Entity)But it doesn't work, because CSpawner is a Class.How do I perform that kind of conditional without creating a new CSpawner object?

View 2 Replies

Flash :: Edit Visually Created Class In AS3?

Jul 30, 2011

I have some class that I created visually in Flash Professional CS5 by transferring drawn result into a MovieClip and extorting symbol into AS code. Now, I want to add some properties to the class. To be more specific, I've created Ball class and want to add to it variables that will represent vertical and horizontal speeds. How can I edit the class in order to do it? Also, when I wanted to add some visible external element to the class, at first I decided to add MovieClip property in the code itself, but then recalled method .addChild() that worked perfectly for me. Now, I can't do the same with non-visible properties. So, what is the difference between adding visible elements using .addChild() and adding them in the code itself?

View 3 Replies

ActionScript 3.0 :: Objects Created In Document Class?

Sep 5, 2009

So I'm trying to create an object in my document class then reference it from a custom class file.I'm creating a photoContainer MC in the createPhotoContainer method and directly after it's creation it gets passed to the GalleryView class by calling it's constructor function.

ActionScript Code:
public class GalleryDocument extends MovieClip
{

[code].....

View 5 Replies

ActionScript 3.0 :: Created A Loader Class FileLoader?

Nov 30, 2009

Basically, i have created a Loader class fileLoader.as into which i pass URL of the image to load from my main class and on load complete i dispatch an event from fileLoader.as class which i listen to and respond in my main application class by displaying it on the stage.All this works fine.If i go and click next button 10x, then 10 images will be loaded and displayed. However, my question now is, if i click back button to image 9, it starts loading the image again.So my question is how can i save or reference images that i have loaded already so that i can just call on them within the main application when needed and not start loading again? Can i load these images in an object or an array or just their reference?

View 0 Replies

ActionScript 3.0 :: Accessing MovieClips That Have Been Created In A Different Class?

Dec 15, 2009

I am able to dynamically create an object on the stage with a function, but I am at a loss for how to access and manipulate the properties of that object from my Main Class.

in my Main Class I have:

ActionScript Code:
NLP_addChild.addObject(stage)
// NLP_addChild is the other class  addObject() is the function

in NLP_addChild Class appears the following:

ActionScript Code:
public static function addObject(stage:Stage)
{
var myCircle:MovieClip = new circle()

[code]....

myCircle displays correctly on the stage, myCircle is correctly assigned an x of 300. But myCircle x property cannot be assigned from my main class.

View 2 Replies

ActionScript 3.0 :: Control Of Xml List Created On Different Class?

Jan 20, 2010

ActionScript Code:
package
{

[code].......

View 4 Replies

ActionScript 3.0 :: Access MC's Created In A Custom Class?

Jun 23, 2010

I have a custom class which creates a new MC using a library MC. The library MC contains a dynamic textfield called productName.The custom class object gets created fine and is displaying on the stage. It's also holding custom properties I set as well.How do I control the dynamic textfield inside the MC, which is inside the custom class object?My Product.as:

Code:
package {
import flash.display.MovieClip;

[code]......

View 2 Replies

Actionscript 3.0 :: Assign A Class To Already Created Mc Dynamically?

Jan 16, 2010

Write well let me see if i can explain this:I have created a class that will create a movie class colour block:

Code: Select allimport com.si.mc. CreateBlockClip;
import com.si.mc.newClass;
var myBar:CreateBlockClip = new CreateBlockClip("bar",300,5);

[code]....

View 3 Replies

ActionScript 2.0 :: Properties In A User Created Class?

Sep 16, 2005

If I create a class and set up one property which is a variable initiated at the start of the class but not within a function or a constructor and I reference the property from the .fla in a for loop as:Book is the class and myBook is the new object.

myBook:Book = new Book(); // (fla script).
for(var prop in myBook) {
trace(prop);
}

[code]...

The trace does not return anything. However when I include myProp (the class variable) in a function (other than Book function) and call that function from the .fla then the trace works and I can see myProp. Do I need to include Class variables in called functions (methods of the Class) in order for them to be properties of the Class?

View 2 Replies

ActionScript 3.0 :: Reference Main Document Class From Document Class Of Loaded Swf

May 7, 2011

I have a FLA (say Main.FLA) document class with a child MovieClip on the stage: into the child MovieClip I load other swf files: each of the files contains its own Document Class (every swf is a somewhat independent application, say quizzes and so on).For some reason I must use the Main document class to store data (scores or so) from the child swfs loaded into the Main swf. HOW do I reference the Main class? I can't find a way.[code]and dispatch an Event this way from the loaded swf document class to the Main class:[code]Now, first of all I don't know if this could even work. Secondly, I tried to make it work by adding an event listener to my Main class but id did not work.

View 9 Replies

ActionScript 3.0 :: Access MC's Textfield Created In A Custom Class?

Jun 23, 2010

I have a custom class which creates a new MC using a library MC. The library MC contains a dynamic textfield called productName.

The custom class object gets created fine and is displaying on the stage. It's also holding custom properties I set as well.

How do I control the dynamic textfield inside the MC, which is inside the custom class object?

My Product.as:

Code:
package {
import flash.display.MovieClip;
public class Product extends MovieClip {

[Code].....

View 2 Replies

ActionScript 3.0 :: Completely Remove A Movieclip That Is Created As A New Class?

Mar 6, 2009

how do I completely remove a movieclip that is created as a new class.I have an event listener that does a removeChild like this

e.target.parent.removeChild(e.target);

is this enough or do I have to 'null' the object? I can't just do 'e.target = null' because the property is read only. Will the internal garbage collection do the rest for me if I have no references somewhere else?

View 3 Replies







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