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


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

ActionScript 3.0 :: External SWF Get Variable From DocumentClass?

Dec 9, 2009

I have a problem with my AS3 files .I'm loading an external SWF, from that SWF I need to change a Boolean var that was set in a DocumentClass.My main DocumentClass is:

Code:
package {
import org.papervision3d.materials.special.CompositeMaterial;
import org.papervision3d.materials.WireframeMaterial;[code]..............

View 2 Replies

ActionScript 3.0 :: Keyword "this" - Refer To The Current Instance Variable Being Created When Its The Only One Being Created?

Dec 11, 2009

When an instance variable is constructed by a constructor method, why do you need to refer to the current instance variable being created when its the only one being created? I understand assigning an expression to it but why name it "this." when it is the only object that the constructor is building? Does it have some hing to do with being able to naming that object in the Local Variable? In other words am I creating a generic object that will be named in another class?

View 7 Replies

ActionScript 3.0 :: Use SWC Class As MovieClip Baseclass?

Apr 1, 2009

I currently have a generic class library I use across projects for creating UI elements. To use them, I set up an asset in the Library, then set one of these classes as the baseclass

[Code]...

View 3 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 :: 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

Professional :: Child BaseClass Objects Cannot Share Same Name

Jul 3, 2010

On stage I have 2 objects on stage that share the base-class of "ABaseClass". Each has a child object that shares the base-class of "AnotherBaseClass". They child objects do not share the same parent, and have unique Linkage identifiers of "Object2Design" and "Object1Design", so they should be able to share the same name on the display-list, right? But if these child objects share the same name I get the following error. How to allow child objects to share base-classes and names?

TypeError: Error #1034: Type Coercion failed: cannot convert Object2Design@256cfe81 to Object1Design.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at AnotherBaseClass()
at Object2()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
Example: [URL]

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

ActionScript 2.0 :: Reference The Variable Pointed To By The Variable Text Cont?

May 25, 2010

How do I reference the variable pointed to by the variable text but pointed to by more than one function?Say I have:

engine_level = 5;
tank_level = 3;
v_name = 'engine';

[code].....

View 4 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 2.0 :: Reference The Variable Pointed To By The Variable Text?

Jan 5, 2012

How do I reference the variable pointed to by the variable text?

Say I have:

engine_level = 5;
v_name = 'engine';
pb_name = v_name + '_p_button'; // so pb_name = 'engine_p_button';
level = v_name + '_level'; // so level = 'engine_level';

[Code]......

View 2 Replies

ActionScript 3.0 :: Preloader For DocumentClass File?

Apr 5, 2011

This fla have just one frame with all objects in the stage.This fla have a DocumentClass.as to control all the things..It's ALL working perfect, BUT i can't put a preloader for the archive...I try a lot of things and o can't preloader the animation. i try a lot of tutorials in the internet and NOTHING! How can i do it?

View 4 Replies

ActionScript 3.0 :: Refer To Nested Button From DocumentClass?

Jul 17, 2009

I have navbar_mc on the main stage. Within navbar_mc is button1_btn How can i reference this button with an eventListener from the DocumentClass?I have the following in the document class:
 
this.navbar.button1_btn.addEventListener(MouseEvent.CLICK, clickHandler);
 
but get the following error when i compile: TypeError: Error #1009: Cannot access a property or method of a null object reference.also, there are many buttons within navbar_mc, how can i make an elegant switch statement function (in the DocumetnClass) for all of them. To reiterate, with an eventListener for each button, how do i reference the correct one from a single function, in this case clickHandler?

View 4 Replies

ActionScript 3.0 :: Invoke Functions Declared In DocumentClass?

Jul 26, 2009

I have been at it for days now and don't know how to get this going. I have DocumentClass and I have a simple function which returns stage width. I now would like to call this function from othr class which exist within the same package as my DocumentClass. I am able to trace the stage width when I invoke stageWidth() function from the DocumentClassAs I to understand, if the function is public, and it is being accessed by a class that exist within the same package, I should be able to access the function withou any issues.nd If I declare the function as STATIC then it is global and can be accessed by classes from other packages what am I doing wrong,

Function that I have written:
public function stageWidth()
{

[code].....

View 14 Replies

ActionScript 3.0 :: DocumentClass And Access Clips From Other Classes

Apr 13, 2010

I'm new to AS3 and am starting to use OOP in flash. However I run into some problems with accessing movieclips from other classes. I am creating a DocumentClass (like Lee Brimelow showed in one of his tuts) and from that class I want to completely generate the movie using other classes and such. However I run into a problem when I need to access movieclip properties from other classes. Here's an example of what I have:

Code:
Select allpackage{
import flash.display.DisplayObject;
import flash.display.Stage;
import flash.display.MovieClip;
import com.dreamline._root.*;
public class DocumentClass extends MovieClip
[Code] .....

How to add clips from my DocumentClass and access them in the flHandler class without having to forward this.dpStage as a parameter.

View 6 Replies

ActionScript 2.0 :: Xml Created Grid - Variable Plus+

Nov 14, 2007

the "for" loop below creates a grid from xml loaded content.. it first creates a row then populates that row with movieclips. the problem is "row1" creates fine but when it gets to "row2" the information that should be displayed is over written by what is in "row1".. this due to the second running of the inner "for" loop cant create over already set variables by the first running of it:

[Code]...

View 6 Replies

ActionScript 2.0 :: Check To See If A Variable Has Been Created?

May 23, 2008

Im creating an online survery and recording all the answers as a variable in _root.vars.variablename where each question creates a new variable in the vars clip.

When the user answers a question the variable is created and given a value e.g.

_root.vars.variablename1 = 1
_root.vars.variablename2 = 1
_root.vars.variablename2 = 0

But I need a piece of code to check if the variable has actually been created. The reason for this is I have a next button the user has to click once they have answered, and I dont want them to advance if they havent answered. So I need to add something like if (_root.vars.variablename1 exists ) {gotoAndPlay("answered");} else{ gotoAndPlay("noAnswer");}

View 6 Replies

Actionscript 3 :: Linking Library Class To An Extended Class And Baseclass

Jan 22, 2011

The use of library classes confuses me once again. I have the following situation:

[Code]....

I cannot put in any baseclass when using the class, so I'm forced to remove the baseclass. When using only the class I get a whole bunch of errors don't make any sense at all, and still appear even if I comment out all the code in the Page class. comop_padpagesFavorietenPage.as:7: 1152: A conflict exists with inherited definition com.op_pad.pages:Page.help in namespace public.

[Code]...

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

ActionScript 3.0 :: Dynamically Created Variable Names?

Jan 22, 2009

After some further testing, I found out that under Actionscript 3 XML (E4X) I'm unable to use dynamicaly created variable names...

The famous:

Code:
var i:number = 111
this["someVarName" + i] = "actual_value"
trace(someVarName111) // = actual_value

does not work for me with E4X lingo...

Code:
var myXML:XML
myXML = "...." //asume valid XML content here
trace(myXML.XMLData.@Memo_EN)

[code]....

View 0 Replies

ActionScript 3.0 :: Created A Variable That When Defined As String

Jan 31, 2012

I have created a variable that when defined as String can end up containing what I need. It just doesnt do what I need it to do.So I can trace out a1Tap=containa1_ mc.square_ mc. saysquare_btn.That is what I want a1Tap to contain but it isn;t the right kind of data.[code]How do I set up and use the a1Tap variable so that a) it contains containa1_ mc. square_ mc.saysquare_btn (as it currently does)in a way that it work as a path name for an event listener?

View 8 Replies

ActionScript 2.0 :: Passing A Variable Into An MC Created With AttachMovie

Aug 12, 2007

I am creating movie clips with a for loop using attachMovie, I would like to pass a variable into the clip itself at the time of it's creation. It seems simple enough, but my little brain is imploding...

So basically I got an MC: "clip"+i, which I would like to pass a variable (from an array), for it to use on it's own timeline. I want the next clip to be able to use the next variable in the array in it's own timeline.

View 1 Replies

ActionScript 3.0 :: Calling A DocumentClass Based Function From A Constructor Class?

Feb 17, 2011

I've got a simple program that consist of a document class and a buttonTemplate constructor class. I need to call a function called updateText that should be in the document class, when someone clicks on a button. So that after each button is clicked, it updates some text in my document class. My event listeners for the buttons are in the buttonTemplate class. My question is, how do you call a function in the document class from a constructor class? Here is my simplified code below

DOCUMENT CLASS

Code:

package {
import flash.display.MovieClip;
import flash.text.TextField;

[Code].....

View 6 Replies

ActionScript 3.0 :: Instantiating A Class Failing, But DocumentClass Can Make It Work?

Mar 17, 2011

I'm having this problem: I have an external fla (Dawn.as) and I want to instantiate the class from the external file into the main swf timeline, but when I try doing that I get an error:

ActionScript Code:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Code::Chapter/initialise()

[code].....

View 5 Replies

ActionScript 3.0 :: Refererncing Movieclips From Inside Class Instatiated In DocumentClass

Jul 19, 2011

I have this very simple ImageLoader class:[code]this doesn't work anymore, because of the presence of the stage movieclips "preloader" and "imageLoaderClip".Which is the most common way to make the things work? I thought to pass a reference to the ImageLoader class as a parameter (eg I pass the preloader and the movieclip that loads the images).

View 10 Replies

Reference Text With Variable?

Oct 20, 2009

I want to be able to reference the text of a text box within an MCThe MC is called "box1", the text field is called "field1"...I have many MCs (all with field1 in them)... box1, box2, box3 etc etcObviously I can set the text to being something by saying...box1.field1.text = "set_this_text"However, I'm using a variable to come up with the "box1" bit. (Using an array and a loop to figure out which box I want to update based on where the user clicked). So, let's say I have a variable... and I want to say..boxClickedon = box1 //will be defined by userSo I don't know in advance about box1... I can only access it through "boxClickedin" variable, but

boxClickedin.field1.text = "set_this_text"
or
[boxClickedin].field1.text = "set_this_text"

[code]....

View 1 Replies

IDE :: Reference Function With A Variable?

Mar 2, 2010

Is there a way to reference a function via a variable? In other words, instead of saying something like:

var theVar = someString + 'function';
if (theVar == 'functionName') functionName ();
to access it directly:
(someString + 'function') ();

using some kind of bracket notation?

View 1 Replies

ActionScript 3.0 :: Assign Value To A Dynamically Created Flash Variable?

Jun 27, 2009

I want to change the value of a variable which is inside another flash movie .I have loaded the swf file.Inside the 'onLoadInit' function i wrote the code like below.

[Code]...

View 2 Replies

ActionScript 3.0 :: Dynamically Name A Variable Or Created Movie Clip?

Dec 10, 2009

Is there any way to dynamically name a varaiable or created movie clip? I know that I could make an array of movie clips, but what I really want to do is make a new movie clipe name based on another name. The reason I want to do so is that I want to pass a movie clip to a function and have it make a new movie clip (to contain the first) with a slight variation of the test such as "frame" or "handle" which I can then use to center the source movie clip.

View 1 Replies







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